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

[BUG] Tracked down STM32F1 SD Card problems #24450

Closed
1 task done
GHGiampy opened this issue Jul 4, 2022 · 9 comments
Closed
1 task done

[BUG] Tracked down STM32F1 SD Card problems #24450

GHGiampy opened this issue Jul 4, 2022 · 9 comments

Comments

@GHGiampy
Copy link
Contributor

GHGiampy commented Jul 4, 2022

Did you test the latest bugfix-2.1.x code?

Yes, and the problem still exists.

Bug Description

As noticed here #24422 (comment) , different issues related to the SD Card was spotted in the last days. I found that the problems start from this commit eda61a2 with the sdio.cpp file cleanup (or better a rewrite).
I was able to strip down this commit and the related bootloop fix (c9b97b8) and build the tip of bugfix-2.1.x with the restored SD Card functionalities.
I'm a completely noob in DMA management, but from the code I can see that the new implementation never switches the direction from MEMORY_TO_PERIPH, while the old implementation does the switch based on a read or write operation.
I suspect that this could be the problem or a starting point to look at.
It is worth noting that some people experienced layer shifts, random freeze/reboot and print breaks when using (read) SD Card, so this could be related.
This rewrite should be reviewed from someone with STM32F1 skilled in DMA management, which I'm not, or at least reverted back for the STM32F1 part due to high risk of problems (like power loss recovery which writes to the SD card).

Bug Timeline

eda61a2

Expected behavior

To write to the SD Card and have a reliable filesystem (also for read).

Actual behavior

Can't write to SD Card and as soon as try to write to the SD Card, this silently fails without response, then any further serial/sd card Mxx command are ignored and the FAT table is truncated.
In this stage the only operation that one can do to resume the SD Card is a power cycle.

Steps to Reproduce

  1. Open serial monitor
  2. Issue M28 testfile.gcode to write a file on SDCard.
  3. An "echo:Now fresh file: testfile.gcode" is expected, but the serial communication stops responding with the problems stated before.

Version of Marlin Firmware

bugfix-2.1.x

Printer model

Ender 3 V2

Electronics

Stock V4.2.2

Add-ons

Neopixel leds

Bed Leveling

No response

Your Slicer

No response

Host Software

Configuration.zip

No response

Don't forget to include

  • A ZIP file containing your Configuration.h and Configuration_adv.h.

Additional information & file uploads

LONG_FILENAME_WRITE_SUPPORT, BINARY_FILE_TRANSFER and CUSTOM_FIRMWARE_UPLOAD enabled

@thisiskeithb
Copy link
Member

Duplicate of #24422

@thisiskeithb thisiskeithb marked this as a duplicate of #24422 Jul 4, 2022
@thisiskeithb
Copy link
Member

Please submit a PR so these fixes can be reviewed.

@rhapsodyv
Copy link
Member

I remember that about an year ago I fixed all sdio issues in stm32, tested it with lots of different boards and setups.
The work I did with the SDIO in the stm32 marked the widely adoption of this Hal in marlin, because the sd issues was something that was holding too many boards to use it…

I remember that the sdio was unreliable, randomly halting or stoping to read.

Now we have this complete rewrite of sdio code. I don’t know if it was widely tested, but the proper fix probably will demand lots of test to get everything stable again.

@GHGiampy
Copy link
Contributor Author

GHGiampy commented Jul 4, 2022

Duplicate of #24422

This is not a duplicate, the problem arises from a M28 attempt the fails every time.
The other issue was referenced only to avoid a duplicate comment, that I dropped there.

@thisiskeithb
Copy link
Member

We don't need multiple open issues for the same "SD card issues". Leaving a comment in the other issue is perfectly fine.

@GHGiampy
Copy link
Contributor Author

GHGiampy commented Jul 4, 2022

Now we have this complete rewrite of sdio code. I don’t know if it was widely tested, but the proper fix probably will demand lots of test to get everything stable again.

That's what I'm thinking, too. A complete rewrite of delicate core part in a platform that can't be tested (as stated from the author of the PR) shouldn't be done blinded.

@GHGiampy
Copy link
Contributor Author

GHGiampy commented Jul 4, 2022

We don't need multiple open issues for the same "SD card issues". Leaving a comment in the other issue is perfectly fine.

I opened this new issue to give more info and the bug timeline.

@thisiskeithb
Copy link
Member

I opened this new issue to give more info and the bug timeline.

Again, we don't need multiple issues opened for the same "SD card issues" bug. Just leave a comment in the original bug report.

@github-actions
Copy link

github-actions bot commented Sep 3, 2022

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 and limited conversation to collaborators Sep 3, 2022
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

3 participants