MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.16k stars 19.21k forks source link

SDHC card of 4GB causes problem. #116

Closed daid closed 10 years ago

daid commented 12 years ago

While using an SDHC card of 4GB with SDSUPPORT then you run into strange problems. My print suddenly restarted on 12% of printing. The Sd2Card.cpp seems to have proper support for SDHC. But the bug might be in the fat implementation.

bkubicek commented 12 years ago

yes, SDHC is much more tricky, because you need fat32. You can try to reformat to 2GB partition size with fat16.

Bernhard

On Fri, Mar 16, 2012 at 4:25 PM, daid < reply@reply.github.com

wrote:

While using an SDHC card of 4GB with SDSUPPORT then you run into strange problems. My print suddenly restarted on 12% of printing. The Sd2Card.cpp seems to have proper support for SDHC. But the bug might be in the fat implementation.


Reply to this email directly or view it on GitHub: https://github.com/ErikZalm/Marlin/issues/116

bkubicek commented 12 years ago

sorry, my reply was false in content. I have actually no clue whats going inside the fat libraries, however I did initially changed them so the work/compile in the Marlin firmware (basically just trying to get rid of unused junk). What I can tell however:

I have a 4gb sdhc card. And a canon powershot camera (sd support) and a dell monitior with sd card reader. Ok, so factory ways, the card was formated with fat32. Both devices did not work with it. Neither after I tried to use a 1.5 gb fat32 parition. And neither if I tried to format the 1.5 gb partition with fat16. I hence have not tried at all with the ultipanel, thinking that if profesional devices fail, most likely the arduino libraries also fail.

Bernhard

On Fri, Mar 16, 2012 at 5:43 PM, Bernhard Kubicek < bernhard.kubicek@gmail.com> wrote:

yes, SDHC is much more tricky, because you need fat32. You can try to reformat to 2GB partition size with fat16.

Bernhard

On Fri, Mar 16, 2012 at 4:25 PM, daid < reply@reply.github.com

wrote:

While using an SDHC card of 4GB with SDSUPPORT then you run into strange problems. My print suddenly restarted on 12% of printing. The Sd2Card.cpp seems to have proper support for SDHC. But the bug might be in the fat implementation.


Reply to this email directly or view it on GitHub: https://github.com/ErikZalm/Marlin/issues/116

daid commented 12 years ago

Well, I can tell you, SDHC always has been a bit of a problem for these kinds of libraries. I've seen it happen with the GP2x and with Wii homebrew.

I have an SD 1GB card, which I formatted fat32, and I haven't seen problems yet with that... maybe it's a problem with an int/int32 mismatch in the fat library? Maybe it just fails to address the right blocks?

daid commented 12 years ago

The plot thickens.

I actually made an image from the 4GB SDHC card that was causing the above problem. And yesterday I picked all the sd card code from Marlin, and added some wrappers around it so I could run it on x86. With some hacking I added a simulated SPI interface which read from my image. However, when I do this the bug does not happen. I also replaced all the occurrences of "int" with "int16_t", so the ints would be 16 bit. But this still keeps the code working.

So I'm not yet sure what is causing the problems with SDHC...

nophead commented 12 years ago

Changing the types to int16 on a 32 bit compiler will not emulate a 16 bit compiler. Expressions get promoted to int in C and C++, so it will still do 32 bit calculations but store 16 bit results, which is not the same as doing 16 bit calculations.

daid commented 12 years ago

True true, but this means there is no variable that is too small. There could still be an over/underflow in a calculation somewhere.

github-actions[bot] commented 2 years ago

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.