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

'SD init fail' when '#define SHOW_CUSTOM_BOOTSCREEN' is set in Configuration.h #7467

Open
3DFreezeMe opened this Issue Aug 9, 2017 · 10 comments

Comments

Projects
None yet
5 participants
@3DFreezeMe

3DFreezeMe commented Aug 9, 2017

'SD init fail' when '#define SHOW_CUSTOM_BOOTSCREEN' is set in Configuration.h

3D Printer: Creality Ender-2
Configured Board: BOARD_MELZI_CREALITY
Configured Graphical LCD: MINIPANEL
Running on latest Marlin-bugfix-1.1.x firmware
Link to configuration zip: https://github.com/3DFreezeMe/Marlin-issues-files/blob/master/Marlin-bugfix-1.1.x.zip

OK:

  • LCD display
  • controller functionality
  • 'SD card ok' when '//#define SHOW_CUSTOM_BOOTSCREEN' is set in Configuration.h

NOK:

  • 'SD init fail' when '#define SHOW_CUSTOM_BOOTSCREEN' is set in Configuration.h
  • parsing of the 'Print from SD' menu; black stripes alternating with text
  • parsing of 'Change SD card', ' Init. SD card' and 'Refresh' options do create a dark bar, but they go away when scrolling

(possible) related Marlin Github issues:
7213
7211
7155

Pronterface output when connecting:

1. Configuration.h
#define SHOW_CUSTOM_BOOTSCREEN

Connecting...
start
Printer is now online.
echo:Marlin bugfix-1.1.x
echo: Last Updated: 2017-05-04 12:00 | Author: (none, default config)
Compiled: Aug  9 2017
echo: Free Memory: 11819  PlannerBufferBytes: 1232
echo:EEPROM version mismatch (EEPROM=V39 Marlin=V40)
echo:Hardcoded Default Settings Loaded
echo:  G21    ; Units in mm
echo:  M149 C ; Units in Celsius
echo:Filament settings: Disabled
echo:  M200 D3.00
echo:  M200 D0
echo:Steps per unit:
echo:  M92 X80.00 Y80.00 Z4000.00 E93.00
echo:Maximum feedrates (units/s):
echo:  M203 X500.00 Y300.00 Z5.00 E25.00
echo:Maximum Acceleration (units/s2):
echo:  M201 X500 Y500 Z100 E5000
echo:Acceleration (units/s2): P<print_accel> R<retract_accel> T<travel_accel>
echo:  M204 P500.00 R500.00 T1000.00
echo:Advanced: S<min_feedrate> T<min_travel_feedrate> B<min_segment_time_ms> X<max_xy_jerk> Z<max_z_jerk> E<max_e_jerk>
echo:  M205 S0.00 T0.00 B20000 X20.00 Y20.00 Z0.40 E5.00
echo:Home offset:
echo:  M206 X0.00 Y0.00 Z0.00
echo:Material heatup parameters:
echo:  M145 S0 H205 B40 F0
  M145 S1 H235 B65 F0
echo:PID settings:
echo:  M301 P21.73 I1.54 D76.55
echo:SD init fail

>>> M20
SENDING:M20
Begin file list
End file list

2. Configuration.h
//#define SHOW_CUSTOM_BOOTSCREEN

Pronterface output when connecting:

Connecting...
start
Printer is now online.
echo:Marlin bugfix-1.1.x
echo: Last Updated: 2017-05-04 12:00 | Author: (none, default config)
Compiled: Aug  9 2017
echo: Free Memory: 11819  PlannerBufferBytes: 1232
echo:EEPROM version mismatch (EEPROM=V39 Marlin=V40)
echo:Hardcoded Default Settings Loaded
echo:  G21    ; Units in mm
echo:  M149 C ; Units in Celsius
echo:Filament settings: Disabled
echo:  M200 D3.00
echo:  M200 D0
echo:Steps per unit:
echo:  M92 X80.00 Y80.00 Z4000.00 E93.00
echo:Maximum feedrates (units/s):
echo:  M203 X500.00 Y300.00 Z5.00 E25.00
echo:Maximum Acceleration (units/s2):
echo:  M201 X500 Y500 Z100 E5000
echo:Acceleration (units/s2): P<print_accel> R<retract_accel> T<travel_accel>
echo:  M204 P500.00 R500.00 T1000.00
echo:Advanced: S<min_feedrate> T<min_travel_feedrate> B<min_segment_time_ms> X<max_xy_jerk> Z<max_z_jerk> E<max_e_jerk>
echo:  M205 S0.00 T0.00 B20000 X20.00 Y20.00 Z0.40 E5.00
echo:Home offset:
echo:  M206 X0.00 Y0.00 Z0.00
echo:Material heatup parameters:
echo:  M145 S0 H205 B40 F0
  M145 S1 H235 B65 F0
echo:PID settings:
echo:  M301 P21.73 I1.54 D76.55
echo:SD card ok

>>> M20
SENDING:M20
Begin file list
CR-10_~1.GCO 2315020
End file list

Tried following suggestions found in Github Marlin issues:

7211,7155

1. Added the following to Configuration.h

#define SHOW_CUSTOM_BOOTSCREEN // 3DFreezeMe
#if ENABLED (SHOW_CUSTOM_BOOTSCREEN) // 3DFreezeMe
  #define CUSTOM_BOOTSCREEN_TIMEOUT 1000 // 3DFreezeMe
#endif // 3DFreezeMe

--> did not help (tried several values for CUSTOM_BOOTSCREEN_TIMEOUT without success)

2. Added the following to Conditionals_LCD.h (I commented '//' the changes made in Configuration.h for CUSTOM_BOOTSCREEN_TIMEOUT as they are double now)

  // Boot screens
  #if DISABLED(ULTRA_LCD)
    #undef SHOW_BOOTSCREEN
  #elif !defined(BOOTSCREEN_TIMEOUT)
    #define BOOTSCREEN_TIMEOUT 1000 //2500 // 3DFreezeMe
  #endif
  #elif ENABLED(MAKRPANEL) || ENABLED(MINIPANEL)

    #define DOGLCD
    #define ULTIPANEL
    #define NEWPANEL
    #define DEFAULT_LCD_CONTRAST 17
    #define BOOTSCREEN_TIMEOUT 1000 // 3DFreezeMe
    #define CUSTOM_BOOTSCREEN_TIMEOUT 1000 // 3DFreezeMe

--> did not help (tried several values for TIMEOUT without success)

7213
3. Did not try to add this, as I already have #defined the values in Conditionals_LCD.h

@fiveangle

This comment has been minimized.

Show comment
Hide comment
@fiveangle

fiveangle Aug 9, 2017

Contributor

Regarding odd display behavior, not sure if it's relevant but my LCD12864 required additional delays to work 100% correctly:

#define ST7920_DELAY_1 DELAY_5_NOP
#define ST7920_DELAY_2 DELAY_5_NOP
#define ST7920_DELAY_3 DELAY_5_NOP
Contributor

fiveangle commented Aug 9, 2017

Regarding odd display behavior, not sure if it's relevant but my LCD12864 required additional delays to work 100% correctly:

#define ST7920_DELAY_1 DELAY_5_NOP
#define ST7920_DELAY_2 DELAY_5_NOP
#define ST7920_DELAY_3 DELAY_5_NOP
@3DFreezeMe

This comment has been minimized.

Show comment
Hide comment
@3DFreezeMe

3DFreezeMe Aug 9, 2017

I have seen this in some open/closed issues. But why would only the SD card menu be affected? All other menu's I have work ok, without the 'banding' issue.
Of course I would try adding delays for testing purposes, could you give me the values you have had success with?

3DFreezeMe commented Aug 9, 2017

I have seen this in some open/closed issues. But why would only the SD card menu be affected? All other menu's I have work ok, without the 'banding' issue.
Of course I would try adding delays for testing purposes, could you give me the values you have had success with?

@3DFreezeMe

This comment has been minimized.

Show comment
Hide comment
@3DFreezeMe

3DFreezeMe Aug 9, 2017

The SD card is btw not on the LCD panel, it is on the Creality Melzi board itself and possibly not related to this issue?

3DFreezeMe commented Aug 9, 2017

The SD card is btw not on the LCD panel, it is on the Creality Melzi board itself and possibly not related to this issue?

@Kaibob2

This comment has been minimized.

Show comment
Hide comment
@Kaibob2

Kaibob2 Aug 9, 2017

Contributor

Not sure if this applies here, but since i'm using a flashAir SD-Card (about 1 week) i get a "SD init fail" after a reset too message, too. But, except for the message, everything is working fine.

Contributor

Kaibob2 commented Aug 9, 2017

Not sure if this applies here, but since i'm using a flashAir SD-Card (about 1 week) i get a "SD init fail" after a reset too message, too. But, except for the message, everything is working fine.

@3DFreezeMe

This comment has been minimized.

Show comment
Hide comment
@3DFreezeMe

3DFreezeMe Aug 27, 2017

Currently the linked file is broken, I am working on that.

/edit: all links have been fixed

3DFreezeMe commented Aug 27, 2017

Currently the linked file is broken, I am working on that.

/edit: all links have been fixed

@dc740

This comment has been minimized.

Show comment
Hide comment
@dc740

dc740 Oct 7, 2018

Same problem here. First I tried th3d firmware which comes with 1.1.9. No SD card at all. Then moved on to pure Marlin and started debugging:

  • configured using the example Ender-2 configuration
  • tried all possible SPI speeds
  • Removed CUSTOM BOOTSCREEN message and STATUS SCREEN IMAGE
  • tried all spi speeds while disabling the bootscreen and status

WORKAROUND:

  1. Select "Init SD card" in the LCD menu.
  2. remove the sd card and re-insert it (is this OK for the SD? doesn't it get corrupted?), and as a final 3. Select "Init SD card" again.

That's the only way I've made it work, and all those 3 steps are required, and in that same order. The bootscreen doesn't seem to have anything to do with this bug.

Everything else works OK with the latest branch. Including the SD menu that was broken for some time. Now it looks OK, but you need to do the workaround to get the SD card to load.

Weirdest part: hitting "init sd card" while not removing it does not seem to help. You need to unplug and plug the card again to get it to load. Is there any special code that runs on this case? I wasn't able to find any, but I'm not familiar with the codebase at all. Maybe some pin left unconfigured? I tried setting MISO, MOSI and SCK pins manually right before the chip select during the SD card SPI initialization, but it didn't help. I even compared the init code with the (now released) Creality Open Source code, but I couldn't find the difference that makes it work.

Thanks.

dc740 commented Oct 7, 2018

Same problem here. First I tried th3d firmware which comes with 1.1.9. No SD card at all. Then moved on to pure Marlin and started debugging:

  • configured using the example Ender-2 configuration
  • tried all possible SPI speeds
  • Removed CUSTOM BOOTSCREEN message and STATUS SCREEN IMAGE
  • tried all spi speeds while disabling the bootscreen and status

WORKAROUND:

  1. Select "Init SD card" in the LCD menu.
  2. remove the sd card and re-insert it (is this OK for the SD? doesn't it get corrupted?), and as a final 3. Select "Init SD card" again.

That's the only way I've made it work, and all those 3 steps are required, and in that same order. The bootscreen doesn't seem to have anything to do with this bug.

Everything else works OK with the latest branch. Including the SD menu that was broken for some time. Now it looks OK, but you need to do the workaround to get the SD card to load.

Weirdest part: hitting "init sd card" while not removing it does not seem to help. You need to unplug and plug the card again to get it to load. Is there any special code that runs on this case? I wasn't able to find any, but I'm not familiar with the codebase at all. Maybe some pin left unconfigured? I tried setting MISO, MOSI and SCK pins manually right before the chip select during the SD card SPI initialization, but it didn't help. I even compared the init code with the (now released) Creality Open Source code, but I couldn't find the difference that makes it work.

Thanks.

@thinkyhead

This comment has been minimized.

Show comment
Hide comment
@thinkyhead

thinkyhead Oct 7, 2018

Member

Try adding this to the end of the setup() function in Marlin_main.cpp:

	#if ENABLED(SDSUPPORT)
	  if (!card.cardOK) card.initsd();
	#endif
Member

thinkyhead commented Oct 7, 2018

Try adding this to the end of the setup() function in Marlin_main.cpp:

	#if ENABLED(SDSUPPORT)
	  if (!card.cardOK) card.initsd();
	#endif
@dc740

This comment has been minimized.

Show comment
Hide comment
@dc740

dc740 Oct 7, 2018

This works! Thank you!

I should clarify. I'm using branch bugfix-2.0.x because I thought that moving to a newer branch would fix the problem. I added the lines at the end of Main.cpp file in setup() and now it works when I boot. So this probably also works on 1.1.x

What is the difference between that and doing the init manually in the menu selection? I don't understand why doing that at the setup works. I also don't understand why the sotck Ender-2 source code doesn't do that at the end of the setup, and it still works.

Side note on a possible bug (different than this one, but similar):
The stock Ender-2 firmware did something weird: the SD card is not properly initialized when I first start the printer right after I plug it in. I need to shutdown the printer, remove the card, insert it, and then it will initialize correctly every single time (even after a shutdown), until I remove PSU power.

Marlin is doing exactly the same after the fix.

Let me be very clear: the bug 7467 is effectively fixed after applying the changes you mentioned. My 3D printer is back to the same behaviour it used to have before upgrading, and that's great. The reason I clarify this is because maybe there is something that can be done on the software side to overcome this OTHER bug that has been around in my machine and also I'd like to know if this happens to anyone else too so I can file a new bug.

dc740 commented Oct 7, 2018

This works! Thank you!

I should clarify. I'm using branch bugfix-2.0.x because I thought that moving to a newer branch would fix the problem. I added the lines at the end of Main.cpp file in setup() and now it works when I boot. So this probably also works on 1.1.x

What is the difference between that and doing the init manually in the menu selection? I don't understand why doing that at the setup works. I also don't understand why the sotck Ender-2 source code doesn't do that at the end of the setup, and it still works.

Side note on a possible bug (different than this one, but similar):
The stock Ender-2 firmware did something weird: the SD card is not properly initialized when I first start the printer right after I plug it in. I need to shutdown the printer, remove the card, insert it, and then it will initialize correctly every single time (even after a shutdown), until I remove PSU power.

Marlin is doing exactly the same after the fix.

Let me be very clear: the bug 7467 is effectively fixed after applying the changes you mentioned. My 3D printer is back to the same behaviour it used to have before upgrading, and that's great. The reason I clarify this is because maybe there is something that can be done on the software side to overcome this OTHER bug that has been around in my machine and also I'd like to know if this happens to anyone else too so I can file a new bug.

@thinkyhead

This comment has been minimized.

Show comment
Hide comment
@thinkyhead

thinkyhead Oct 8, 2018

Member

It's a matter of timing. Your SD card reader (or SD card) is slow to initialize and the usual initsd method called early in startup is seeing it as a failure. The extra initsd ensures that the card has had enough time to initialize and get the SD card ready. The Ender-2 is probably taking more time after boot-up (or at least differs in timing from the current Marlin) before it tries to init the SD card reader.

Member

thinkyhead commented Oct 8, 2018

It's a matter of timing. Your SD card reader (or SD card) is slow to initialize and the usual initsd method called early in startup is seeing it as a failure. The extra initsd ensures that the card has had enough time to initialize and get the SD card ready. The Ender-2 is probably taking more time after boot-up (or at least differs in timing from the current Marlin) before it tries to init the SD card reader.

@dc740

This comment has been minimized.

Show comment
Hide comment
@dc740

dc740 Oct 8, 2018

dc740 commented Oct 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment