2021-06-14 08:44 AM
Please see post over on Arduino forum (since I can't post all that text here) but feel free to reply here.
2021-06-14 09:39 AM
Problem with Arduino is that everything is obfuscated and the debugging is worthless..
The code you're showing is all top-level stuff, the failure is likely at a lower level. Not sure there's a magic answer to this, you're going to need to get a better understand on what exactly is "not working"
If its running FATFS you'd want to debug the DISKIO layer, perhaps consider if its using DMA or POLLED mode.
I personally would be using pull-up resistors on the DATA/CMD lines, the 22R series are good for stopping ringing as you clock faster, although I'd guess this is going along at 24 MHz. I'd be looking at 33K or 47K pull-ups, or at the very least enabled on the pin side. Perhaps you can dig into the variant.cpp/variant.h code.
You could perhaps build a HAL equivalent of the code and test/demo the MicroSD card writing.