Spartan Edge Accelerator SD card not mounting

Hi.



I’ve got my SEA board, but can’t even test if it’s functioning properly.

I followed the “Getting started” article, trying to run the board in Arduino Shield mode.

The example sketch in Arduino IDE did build without errors, and was flashed seemingly ok, yet the fpga side didn’t change its state.

Running the serial monitor and resetting the ESP32 with RST button I see a message, suggesting that something is wrong with SD card:


Googling around I could only find hints that the error code 0x109 means crc error, and it’s likely that some i/o lines of sd card has no proper pullup resistors.

Could this be the case?

In SEA schematics I see 5 out of 7 pullup resistors are marked as DNP (do not place).

Some people with same problem on ‘generic’ ESP32 suggest enabling gpio’s pullups.

Could it be related to Arduino IDE’s and its libraries version?

Hi There

I am a success to finish Sd Card Init when I press the RESET button again. :smiley:



Though I also happened the same thing when I press the REST button the first time, I am a success when I press the REST button again

Randomly passing the initialization stage didn’t save you from failing to read data block in the next request, isn’t it?

I do believe it’s possible, sometimes. But that’s not a solution :slight_smile:

Ok, somehow the behavior depends very much on the exact card being used.



It failed with 32GB cards, multiple trusted brands, all failed to mount. Working ok with laptop/phone.



It mounted 16GB card speed class 4, but failed to read the data, giving same errors as in 595355940’s example.

For the note - that’s failure, bitstream wasn’t read, and fpga wasn’t initialized, even if output gets “run” printed.



It worked ok with 16GB speed class 10, and with 8GB speed class 4 cards.



All the smaller tested cards were of the same brand (Team)



So, any logical explanation?



It’s not brand, all cards were of the same brand.

It’s not the speed class, since two cards of different classes worked, and one failed card was of the same class as working one.

It’s not the size, not directly. One 16GB card worked, the other 16GB didn’t. And I’ve tried to format it with smaller partition size to avoid possible issues with FAT fs implementation in ESP32 libraries - didn’t help.



On the bright side - I’ve got FPGA successfully configured and running.

Still I’d like to understand what’s the problems with SD cards handling.

I wouldn’t want to buy a pack of cards to find the one that’s liked by the board’s spirit :slight_smile:

Hi There

you should format the SDCard with the FAT16/FAT32 filesystem. :smiley:

That’s not a factor in my tests, because all the cards I’ve tried were pre-formatted at factory as FAT32.

When some card failed as FAT32 I tried to create 2GB FAT16 partition.

Mounting/reading that card fails exactly the same, no matter if it was FAT32 or FAT16 partition.

It feels more like a physical/electrical issue. Different capacitance of SD card pins maybe, or different internal pullups characteristics - then the absence of pullups on the board can make a great difference for signal integrity on different cards.

I am currently having the same issue with this. Did anyone ever figure out anything definitive?

Got one more observation.

Simply having one specific SD card plugged in, I get ESP fail to boot because of the flash reading errors.

I have to remove that card in order to program the board, and after some attempts it finally boots.

It really feels like hardware design issue that needs to be addressed.

Hello guys!



That instability you’re all describing here seems to be related to the missing pull up resistors.



I’ve purposed a solution here as a patch to be merged:

<LINK_TEXT text=“https://github.com/sandrobenigno/sparta … a568ad435a”>https://github.com/sandrobenigno/spartan-edge-esp32-boot/commit/38679184b756630a12bc5e2ee5ba07a568ad435a</LINK_TEXT>



It worked fine for me.



However, it would be better adding actual pull up resistor on the hardware in a future revision of the board.

The current schematics does show those resistors as DNP (Do Not Populate) but those ones are necessary for stability.

Usually they go from 10K to 100K. I’ve verified 47K in many different hardwares out there.



Please, it would be nice to see your comments after testing it.



Best regards,



–SB

It did help with reboots by pressing the reset button. Now card mounts ok with every single reset :slight_smile:



Still, powering SEA with SD card inserted doesn’t work with one specific card I have.

If the board is powered on with the card inserted, I get this error printed repeatedly:

If I plug the sd card after the board is booted, and press reset - then it boots fine.

Not only it doesn’t boot on power on that way, it also fails the programming from within Arduino IDE while the card is inserted.



Apparently, external/forced pullups are interfering with the ESP32 bootup sequence. Pulling the MTDI (GPIO12) pin high at boot (/power?) time selects the 1.8v spi flash interface. And while SAE isn’t using VDD_SDIO pin to actually power the flash chip (according to schematic the flash is powered with the main 3.3v rails), the selected 1.8v voltage should be still used for SPI interface buffers, and shouldn’t work properly with 3.3v chip.



In addition to sdmmc_host_pullup_en() call update, I’ve burned fuses with espefuse.py, forcing the ESP to select 3.3v for flash, ignoring the GPIO12 pin. Looks ok now :slight_smile: It starts somewhat longer on cold power on, but it boots, and the fpga is configured without any manipulations with sd card or reset button.



Programming with Arduino IDE is also ok while that “troublesome” SD card plugged in :slight_smile:


That’s good to know it does help on the stability!


Did you try to change the SD mounting type from 4-bit to 1-bit for that tricky one?

Maybe it is an SD card limitation.



You could try it just like here to test it: </s> // Mount SD Card if(!SD_MMC.begin("/sd",true)) { Serial.println("Card Mount Failed,please reboot the board"); while(1); return; }<e>

Got it! I wasn’t aware of that unburned fuses.

Nice!!!

Could you send us a summary of the efuses? Something like: </s>espefuse.py -p COM4 summary<e>

Best regards,



–SB

No, I didn’t try. The card works ok when plugged after the board is powered up, it’s ESP32 that fails to boot.

It simply doesn’t go as far as running sketches, it stops at boot, getting repeatedly rebooted by watchdog, and printing the flash reading error.

The only thing where flash chip and sd card are related - is on the GPIO12 pin. If the card has own pullup (I don’t really know if that’s a thing), the ESP can’t read its code from the flash.

I didn’t save the original report, and only did espefuse.py --port COM19 set_flash_voltage 3.3V.

I’ve found explanations here: <LINK_TEXT text=“https://github.com/espressif/esp-idf/tr … d#hardware”>https://github.com/espressif/esp-idf/tree/master/examples/storage/sd_card#hardware</LINK_TEXT>, see the “Note about GPIO2” and “Note about GPIO12”.