Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrupted Serial upload to SD card #251

Closed
hunterbeach opened this issue Sep 22, 2018 · 118 comments
Closed

Corrupted Serial upload to SD card #251

hunterbeach opened this issue Sep 22, 2018 · 118 comments

Comments

@hunterbeach
Copy link

hunterbeach commented Sep 22, 2018

I've been trying to upload and print a gcode file in 8.3 format, but every time I upload a file, it never shows up in the files list. If I run a M20 command, sometimes it shows the file on the SD card but I'm unable to run it. If I try to run M23 it returns
Error:Line Number is not Last Line Number+1, Last Line: 0 Resend: 1

Other times I just get upload failed. Not sure if it is related but when I select a file to upload, the progress bar immediately skips to 100% and sticks there for a couple minutes while it attempts to upload I believe.
I've tried both 2.0 dev and am currently on 1.0 with no success running on Marlin firmware.

Also, this happened one time. https://imgur.com/a/gJLRG7j

EDIT: G-code appeared corrupt because Marlin stripped the comments, changing the size and hash.

@hunterbeach hunterbeach changed the title Unable to print from SD card and corrupted gcode Unable to print from SD card Sep 22, 2018
@luc-github
Copy link
Owner

luc-github commented Sep 22, 2018

So it is Upload issue, not really printing issue
looks like this issue : github.com/MarlinFirmware/Marlin/issues/11871 but may be not only
Upload by serial is a nightmare....

When you changed to 2.0 did you used 2.0 Web UI or 1.0 ?

FYI The comment removing is done by ESP3D to speed up serial transmission which is slow like hell

The picture happened on 1.0 or 2.0 ?

Which version of Marlin do you use ?

What baud rate do you use between ESP3D and printerboard ?

Is computer connected to your printer when you upload ?

@luc-github luc-github added the bug label Sep 22, 2018
@luc-github luc-github changed the title Unable to print from SD card Corrupted upload to SD card Sep 22, 2018
@hunterbeach
Copy link
Author

Yes, right now it is an uploading issue but the couple times I did get a print to start, it was very erratic and just grinded the filament at max speed until I shut it down. I am almost certain the gcode is good but we can cross that when we get there.

I tried 1.0, 2.0, 2.1 and 2.0 with async & async UI without success.

I believe the picture was on 1.0 but it's possible I'm wrong.

Marlin version is 1.0.0

Baud rate I use is 250000

The only thing plugged into the printer is the SD card.

@luc-github
Copy link
Owner

luc-github commented Sep 22, 2018

For printing ESP3D has nothing to do with printing process - it just launchs SD print command to Marlin - print is 100% handled by Marlin

if you says GCODE is correct on SD then it is not ESP3D issue - the Upload can be, but printing no, once print is launched it is out of ESP3D.

You can verify that by manually copy GCODE file to SD and print from SD from printer then launch another print from ESP3D to compare.

Can you give me the exact version of Marlin you use?

I will try to see if there was some change since I tested and try again - Marlin code is always changing and I do not really always follow the changes in real time as I do not used Marlin

Also what is the size of the file you upload ?

@hunterbeach
Copy link
Author

hunterbeach commented Sep 22, 2018

This is the output of M115
FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:https://github.com/ErikZalm/Marlin/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:ROBOR1PLUSV2 EXTRUDER_COUNT:1 UUID:00000000-0000-0000-0000-000000000000

I reformatted the SD card as FAT instead of FAT32 to see if that makes any difference. I'm currently doing a upload test with Simplify3D to make sure that works as expected. (It's so slowwww) If so, I'll plug in the ESP8266 and try it again.

File size is 310KB

@luc-github
Copy link
Owner

This FW is pretty old I am surprised ESP3D can list files properly - I will do some tests on a system to check

@hunterbeach
Copy link
Author

Yeah, but it is the latest official release. I might try to update this weekend and transfer over settings. I was able to successfully upload a g-code file with Simplify3D to the SD card but one interesting thing I noticed was that I had to manually send M29 to end the save. Otherwise, it started putting the temperature commands in the file. Not sure if ESP3D sends the M29 command to close the file but it was required in my test in Simpify3D.

Also, the g-code is confirmed good, I did a dry run after uploading the file with Simplify3D and it was successfully printing.

@luc-github
Copy link
Owner

Yes ESP3D send M29 to close the upload process

@hunterbeach
Copy link
Author

That bug you linked in the Marlin repo looks very similar to my problem but I am on a much older version and that is a problem with a recent commit. I dug into my Marlin firmware and found the only place that error is called is the get_command function in Marlin_main.cpp if you want to see the code that throws the error. The line that throws that error is SERIAL_ERRORPGM(MSG_ERR_LINE_NO);

@luc-github
Copy link
Owner

Yes but at that time I had no info about your FW version. I was guessing with info I had

@hunterbeach
Copy link
Author

Right. Is it possible to put the g-code in the SPIFFS filesystem and just stream the commands to the printer from the ESP8266? It would save a lot of time from not having to put the g-code on the printers SD card.

@hunterbeach
Copy link
Author

hunterbeach commented Sep 22, 2018

Also, the problem picture I linked to in the original post happened again with a fresh install of 2.0. I started ESP3D, made sure the SD was clear, started the upload, it stayed at 100% for about a minute and a half (Way too short for the full upload), and then it started trying to erratically print automatically and the files box was filled with temperature data.

What I think could be happening is ESP3D is prematurely ending the save stream but still sending the data, so the printer exits the save state and enters the running state, and it gets fed a bunch of g-code in the middle of the file super fast because the ESP thinks it is still saving to a file, not printing.

@hunterbeach
Copy link
Author

hunterbeach commented Sep 22, 2018

Update: I upgraded to Marlin 1.1.9 and the problem is still there. Uploaded a file, progress bar started at 70%, progressed to 100% in a minute or so before starting printing automatically and erratically so it isn't unique to that firmware version. After stopping the print (Turning off the printer since aborting didn't work) I did M20 and there was still no file on the SD card. This is the new output of M115.

FIRMWARE_NAME:Marlin bugfix-1.1.x (Github) SOURCE_CODE_URL:https://github.com/MarlinFirmware/Marlin PROTOCOL_VERSION:1.0 MACHINE_TYPE:Robo R1+ EXTRUDER_COUNT:1 UUID:cede2a2f-41a2-4748-9b12-c55c62f367ff Cap:SERIAL_XON_XOFF:0 Cap:EEPROM:1 Cap:VOLUMETRIC:1 Cap:AUTOREPORT_TEMP:1 Cap:PROGRESS:0 Cap:PRINT_JOB:1 Cap:AUTOLEVEL:1 Cap:Z_PROBE:1 Cap:LEVELING_DATA:1 Cap:BUILD_PERCENT:0 Cap:SOFTWARE_POWER:0 Cap:TOGGLE_LIGHTS:0 Cap:CASE_LIGHT_BRIGHTNESS:0 Cap:EMERGENCY_PARSER:0 Cap:AUTOREPORT_SD_STATUS:0 Cap:THERMAL_PROTECTION:1

@luc-github
Copy link
Owner

The print start automaticaly ? that is weird, it means the commands are not saved to SD but send to printer

Can you share the file you said it is only 310KB

@hunterbeach
Copy link
Author

Sure, it's attached. That's why I have the theory that ESP3D thinks it is still uploading but in reality, it has exited save mode for some reason and is in normal mode.

openlock.zip

@luc-github
Copy link
Owner

thank you I have setup a system - just need to flash the Marlin FW on it - so I will have a look today

@hunterbeach
Copy link
Author

hunterbeach commented Sep 23, 2018

Sounds good. I thought the firmware update would fix it but I guess not. (Also, the new auto bed leveling is so awesome, I'm glad I decided to upgrade Marlin. The 1.0.0 bed leveling didn't do much.)

@luc-github
Copy link
Owner

Can reproduce issue with ESPD2.0 :
after 3min upload I got :

Error:No Checksum with line number, Last Line: 0
Resend: 1

so no line was accepted

image

what ever I type I got same message:

M29
Error:No Checksum with line number, Last Line: 0
Resend: 1

need to check how to reset this - a part of restart printer board

@luc-github
Copy link
Owner

I have added time stamp for purge and sendLine2Serial and testing now - it is as slow as you I think as after 5 min I am still at 10%
so this is definitly due to LOG to SPIFFS slowing down the whole upload -

@hunterbeach
Copy link
Author

Yeah, 40 minutes later and it still shows uploading. I'll try disabling debug later today.

@hunterbeach
Copy link
Author

hunterbeach commented Nov 4, 2018

So disabling debug seemed to fix the upload time problem and that file uploaded in about 5 minutes, same as you. Also, the diff on the uploaded file and original looked correct, just with all the comments removed so it looks like everything was written properly on first look. Still needed to init the SD card manually though.

@luc-github
Copy link
Owner

Yes LOG on SPIFFS is ok for small things - and more the log file is growing more the system is slowing down - got 4s per line sent just because of SPIFFS write in 1.82MB file - I think I will add a file spliter in future

Happy it works for you
if you never remove the SD you should add card.initsd(); at the end of Marlin Setup this would cover all your usage unless you remove card when printer is on

@hunterbeach
Copy link
Author

Also, you might want to have the debug log exclude the wifi password in the initial setup. I edited it out while I was reviewing it but it should probably be done automatically.

@luc-github
Copy link
Owner

luc-github commented Nov 4, 2018

Hmmm no I do not log wifi password - only SSID
this is what I log in setup :

Set STA mode
SSID NETGEAR_2GEXT_OFFICE2
Setup Done

but I see in your log :

Check Command:o:Unknown command: "scandone"
Check Command:echo:Unknown command: "state: 0 -> 2 (b0)"
Check Command:echo:Unknown command: "state: 2 -> 3 (0)"
Check Command:echo:Unknown command: "state: 3 -> 5 (10)"
Check Command:echo:Unknown command: "add 0"
Check Command:echo:Unknown command: "aid 24"
Check Command:echo:Unknown command: "cnt "
Check Command:echo:Unknown command: "uart input full!"
Check Command:echo:Unknown command: "connected with Hunter, channel 6"
Check Command:echo:Unknown command: "dhcp client start..."
Check Command:echo:Unknown command: "ip:192.168.1.128,mask:255.255.255.0,gw:192.168.1.1"

this is not done by me and I do not understand why you have this

@hunterbeach
Copy link
Author

It was definitely in there. It was only on the first setup though when you set all your settings and pick a wifi network and enter your password.

@luc-github
Copy link
Owner

you mean doing 1st wizard ?

@hunterbeach
Copy link
Author

Yes

@luc-github
Copy link
Owner

I see, this is when you update any EEPROM settings the function save data is generic it does not know it what it is

@luc-github
Copy link
Owner

back to M21 - your printer does have LCD ?
looking at code :

#if SDCARDDETECT == -1
static void lcd_sd_refresh()
{
    card.initsd();
    currentMenuViewOffset = 0;
}
#endif

@hunterbeach
Copy link
Author

No, it doesn't

@luc-github
Copy link
Owner

Ok so the best is to put card.initsd(); in setup then - so when printer power on it will mount SD card automatically

@luc-github
Copy link
Owner

I have added the M21 in serial upload process - 3e38795

So I guess this issue can be closed now

@tkuan
Copy link

tkuan commented Nov 15, 2018

Can reproduce issue with ESPD2.0 :
after 3min upload I got :

Error:No Checksum with line number, Last Line: 0
Resend: 1

so no line was accepted

image

what ever I type I got same message:

M29
Error:No Checksum with line number, Last Line: 0
Resend: 1

need to check how to reset this - a part of restart printer board

I got the same problem when I upgraded to Marlin 1.1.9. There is a bugfix open for this, MarlinFirmware/Marlin#11871. As I understand the issue is the new Marlin no longer taking straight text upload. It needs the line number and the checksum as described in the error in the latest Marlin. If I use Marlin 1.1.8, it works. To create one line "M106" of a gcode file, TEST.G, I will manually type "M28 TEST.G", "N0 M106*36"(not just "M106"), "M29" in ESP3D. It will save the file to the SD card.

@luc-github
Copy link
Owner

If you check the bugfix comments - I am in it 😉
Now ESP3D 2.0 SD upload use Line number and check sum - issue should not happen anymore

@tkuan
Copy link

tkuan commented Nov 15, 2018

Thank you! I will check out the 2.0. I want to create a button in WebUI to control a relay to turn on/off the printer. I have followed your instructions to setup the development environment, but so far I can't install gulp on my Windows 7 computer. What is the best environment to use? Mac, PC or Linux?

@luc-github
Copy link
Owner

I do it under windows and linux so I guess just stick to version I give OS is not important

@luc-github
Copy link
Owner

luc-github commented Nov 15, 2018

But why not use Macro feature for your Button ?
It is the purpose of it

@tkuan
Copy link

tkuan commented Nov 15, 2018

I will love to use Macro, but not sure where to look for instructions.

@luc-github
Copy link
Owner

I am not good at docs
but some people did : https://github.com/bdring/Grbl_Esp32/wiki/ESP3D-Web-UI-for-Grbl_ESP32#macros

Macro is just a link to a file with GCODE and [ESPXXX} commands

@tkuan
Copy link

tkuan commented Nov 15, 2018

I think ESP command will work. I will check it out tonight. Thank you for your help.

@tkuan
Copy link

tkuan commented Nov 16, 2018

I updated to 2.0 with 2.0 UI, but I can't see the Macro panel. How do I turn in on?

@luc-github
Copy link
Owner

push Macro button
image

@tkuan
Copy link

tkuan commented Nov 16, 2018

Got it! Thank you! I will try to power on/off this weekend.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants