SparkFun Forums 

Where electronics enthusiasts find answers.

#220299
Hi there,

I need SD card functionality using Mbed OS on my Artemis Thing Plus board. That board comes without an SD slot, so i use this breakout board.
I discovered a possible SPI related bug that prevented any writes to the SD card and made a PR on github to fix it (review is pending).

Using the above PR and this code i recently discovered something that really puzzles me and can not find a solution:
If i program my Artemis Thing Plus while the SD card is inserted into the slot everything is fine.
However if i physically remove and then reinsert the SD card into the slot, then the first time the code tries to send a command, it will fail and timeout after 10 seconds (the default SD timeout duration in Mbed). Actually the first command is sent on line 894 within the _go_idle_state() in SDBlockDevice.cpp. Any subsequent commands will succeed without timing out until i physically remove the card again. For debugging it is worth to set SD_DBG and SD_CMD_TRACE to 1 within SDBlockDevice.cpp.

What puzzles me is that using the same SD example code, the same wiring, SD-slot and SD-card on the MAX32630FTHR board i can not reproduce the above issue. With that board even the very first command is succesful no matter if i reinsert the SD card or not. The only relevant thing i found is a comment within Mbed core's SDBlockDevice.cpp file around line 888. It seems that the MAX32630FTHR applies some trick to overcome this issue, but i am not an expert and could not find that trick...which also prevents me implementing that trick for the Artemis boards.

Can you guys please take a look? I mean this issue is for sure independent from the one i addressed with the mentioned PR and would be a nice addition to Artemis' SD functionality with Mbed OS.
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum