Close

SDIO Support

A project log for Lerdge 3d Printer Mainboard Hacking

Breaking the encryption on the Lerdge series mainboards so I can try porting Marlin 2.0 to it.

jc-nelsonJ.C. Nelson 01/03/2019 at 18:490 Comments

Sometimes, it's less about what you do and more about what other people are doing around you.  In this case, someone was already working on adding support for SDIO to Marlin.

This gave a nice way to abstract away the details of block reading, and THAT gave me a simple way to plug in code. I started using the STM32SD library (and still am using code derived from it) but hit a problem where no matter what, the block reads failed.

After a great deal of investigation, I found that the block read calls were passing in the block SIZE as the block number, meaning that in many cases, huge chunks of memory were getting trampled.  A few fixes later, we have the following output from the ESP8266:

M20
Begin file list
echo:Cannot open subdir JOURNA~1.COR
echo:Cannot open subdir JOURNA~1.LIV
echo:Cannot open subdir JOURNA~1.COR
echo:Cannot open subdir JOURNA~1.SCA
echo:Cannot open subdir JOURNA~1.LIV
echo:Cannot open subdir JOURNA~1.COR
echo:Cannot open subdir JOURNA~3.LIV
TEST.GCO 304884
TES~1.GCO 304884
End file list
ok

This code needs to be vastly cleaned up - I literally imported the bsp_sd h and c files directly, but they don't use DMA, there's the afore-mentioned "passing the wrong parameters" bug, and in general, a lot to do before I can proclaim it works. Also troubling is that if I re-init the SD card, it crashes, but that's a problem for another day. 

Getting closer and closer to that first test print.

Also, another member has successfully initialized and written to the LCD. I haven't done this yet, but they have. So, bit by bit, it's coming together.

Discussions