elehobica/pico_fatfs

Logic level shifting breakout cannot mount SD card - mount error 3

matt-walker0 opened this issue · 5 comments

Hello,

Firstly many thanks for developing the library.
I seem to have found an issue to get the SD card to mount without error. I'd assumed this was due to my poor wiring or pin selection. However having tried an alternate pico-fatfs library this works without issue, writing Hello World to the SD card (viewable on another device). This is currently setup on a breadboard with a mess of wires, so expect poor signaling but attempting to lower CLK_FAST to as low as 1 MHZ has not helped. I've tried switch SPI lanes and pins to no avail either. The SD card reader used is this and is hooked up-to the 5v rail for power.

Any ideas how to debug a mount error 3?

Doubt it would change anything, but I've set the example code test/main.cpp to use USB serial out for debugging.

Hello @matt-walker0

Thank you for the issue report.
According to your explanation, you're using the microsd board with level-shifter.
If I'm correct, generally, the board with level-shifter should be used with 5V-TTL level I/O interface board such as Arduino UNO to interface between 5V (MCU side) and 3.3V (microsd card side).
On the other hand, rp2040 (Raspberry Pi Pico board) handles directly 3.3V LVTTL, the board without level-shifter like this needs to be used.
I've never make it work with the board with level-shifter even though 3.3V is connect for both side of the voltage inputs. I think that is exactly same as what you saw. In that case, to decrease clock frequency doesn't improve the situation at all. Therefore, my first recommendation is to replace the microsd board.

On the other hand, I also appreciate your information that the other library runs successfully even with the board with level-shifter. That could indicates it has more timing margin than this library. It looks worth investigating what makes difference.

At last, but not least, I'd appreciate if you kindly inform which vendor's microsd card you're using. (vendor, series name and size).

BR

Many thanks for the explaination.

I've got a non-logic level conversion breakout board on order now. It does seem rather unnecessary to do any conversion to interface with a MicroSD card, although at-least in my region there does seem to be more 5V compatible breakout boards available, perhaps for the Arduino ecosystem.

At last, but not least, I'd appreciate if you kindly inform which vendor's microsd card you're using. (vendor, series name and size).

The card used is a SanDisk Ultra 32GB (class 10 / A1) formatted as FAT32.

On the other hand, I also appreciate your information that the other library runs successfully even with the board with level-shifter. That could indicates it has more timing margin than this library. It looks worth investigating what makes difference.

Whilst I'm waiting for delivery are there any known "pinch points" where its worth trying to lower timing tolerances?

Thanks again, and I'll report back once I've got the new reader.

Thanks @matt-walker0 for the card information.
I'll try again the board with level-shifter to check if any condition to work.
Best Regards

Continued to try get the logic level shifting board working to no avail.
The non-logic level shifting breakout board arrived, and it works. This does require lowering the fast clock down to 30 MHZ, but the slow clock works as is.

pico_fatfs_spi_config_t config = {spi1, CLK_SLOW_DEFAULT, 30 * MHZ, 12, 13, 10, 11, true};

Happy to close with the reason of incompatible hardware?

Thanks for the suggestion.

Thank you for the trial and the report with non-level-shifter board.
Yes, for the moment in this library, it should be understood that level shifter makes negative effect on the timing for SPI interface to microsd
Without level shifter, sometimes still speed down should be needed.
Please note that the frequency is not applied in linear but applied as frequency that doesn't exceed to 125MHz/N.
If it is set to 50MHz, then actual frequency is 31.25MHz and if it's set to 30MHz, actual frequency will get 15.625MHz.

Best Regards