-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
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
Fail SD mounting with no SPI re-init #19226
Fail SD mounting with no SPI re-init #19226
Conversation
…et the spi speed to wrong velocity and the SD stop working. Even if correct, that spiInit dont need stay there, as is the calling code the responsability to put spi in the right state before the use.
Thanks! This also addresses the comments left on #19064 |
Doing more research, I found that spiInit is totally wrong, as it assume that the SD is SPI... but a lot of SD uses SDIO with no spi involved ... The bug it fixes, is because that SPI init defaults to SPI 1, that are the same pins as used for creality_v4 end stops: // endstops on Creality v4
#define X_STOP_PIN PA5
#define Y_STOP_PIN PA6
#define Z_STOP_PIN PA7
// spi default pins
#ifndef SCK_PIN
#define SCK_PIN PA5
#endif
#ifndef MISO_PIN
#define MISO_PIN PA6
#endif
#ifndef MOSI_PIN
#define MOSI_PIN PA7
#endif
#ifndef SS_PIN
#define SS_PIN PA4
#endif |
line 386 I changed from (cardreader.cpp) |
@mikemerryguy: Which board/LCD/SDCARD_CONNECTION setting? I tested this on a few printers: With a BTT002 on a MK3S with a With an SKR Mini E3 V2 on an Ender-3 with a With an SKR Mini E3 V1.2 on an Ender-3 with a With an SKR 1.4 on an Biqu B1 with a With an SKR 1.4 on an Biqu B1 with a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikemerryguy: Which board/LCD/SDCARD_CONNECTION setting?
I tested this on a few printers:
With a BTT002 on a MK3S with a
REPRAP_DISCOUNT_SMART_CONTROLLER
(no motherboard-based SD card reader), no errors displayed on boot when no SD card is present in the LCD-based SD card slot.With an SKR Mini E3 V2 on an Ender-3 with a
CR10_STOCKDISPLAY
(no LCD-based SD card reader), "SD Init Fail" is displayed on boot when no SD card is present in the motherboard-based SD card slot.With an SKR 1.4 on an Biqu B1 with a
REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
andSDCARD_CONNECTION
set toONBOARD
, "SD Init Fail" is displayed on boot when no SD card is present in the motherboard-based SD card slot.With an SKR 1.4 on an Biqu B1 with a
REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
andSDCARD_CONNECTION
set toLCD
, no errors are displayed on boot when no SD card is present in either the motherboard or LCD-based SD card slot.
I am using Skr mini e3 1.2 with CR10 stock display settings on an ENDER 3
as per facebook I think the issue is deeper in marlin_state or MF_INITIZLIZING but it DID work for my setup!
Changing to When I send that PR, I was just focused in solving the spiInit problem, that was conflicting with creality board and was totally wrong there. But, as you and @thisiskeithb are reporting, maybe the entire "if not mount, show fail" is wrong... I will review the sd init code. |
@rhapsodyv Yes, I do think its deeper, I just was reporting it worked for now, and as I said, hopefully we get it sorted, I did not dig deeper, I am ehhhh basic programming level haha made some stuff, but never deep into a firmware!!! |
What is happening is: In the marlin boot marlin_state is MF_INITIZLIZING, it call card.mount(). If fail, it will not show any message. After all boot sequence, marlin_state became MF_RUNNING. So, all calls to card.mount() now on will show the message. The issue is, that in the marlin main loop, it always calls: card.manage_mediaI(). This function compares the current card insertion state with the last state from the previews calls. The problem is: some boards don't have the SD_DETECT_PIN. So, the marlin code always consider that the SD was inserted and try mount it every time. It appears to be in the boot sequence, but isn't. The card.mount is called every second (or so), and will try mount and give fail message always if the board don't have SD_DETECT_PIN. So, my suggestion is: only show that |
@mikemerryguy take a look in this PR #19236 |
@rhapsodyv if (flag.mounted) fix from #19236 works perfect, thanks guys! |
Can confirm this fixes the endstop with no SD card inserted issue on the V4.2.7 boards. |
Description
sd2card.init uses SPI_SD_INIT_RATE, not SPI_SPEED. The removed line set the spi speed to wrong velocity and the SD stop working. Even if correct, that spiInit dont need stay there, as is the calling code the responsability to put spi in the right state before the use.
Benefits
Fixes #19223
It removes the false "SD Init Fail" when booting a printer without a SD card.
Related Issues
#19223