Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SD card problems
#1
I was following a thread on another forum about SD in SPI mode and noticed that the SD needs to have pullups on each line so I looked at my new TTGO board https://www.aliexpress.com/item/TTGO-T8-V1-1-ESP32-4MB-PSRAM-TF-CARD-3D-ANTENNA-WiFi-bluetooth-ESP32-WROVER-Micropython/32851423415.html?ws_ab_test=searchweb0_0%2Csearchweb201602_4_10065_10344_10068_10130_10342_10547_10343_10340_10548_10341_10084_10617_10616_10083_10615_10307_10131_5920011_10132_10133_10313_10059_10534_100031_10103_441_10624_442_10623_10622_10621_10620_10142%2Csearchweb201603_25%2CppcSwitch_3&algo_expid=671d8ab1-4b45-429d-9470-e0cee033e058-6&algo_pvid=671d8ab1-4b45-429d-9470-e0cee033e058&transAbTest=ae803_5&priceBeautifyAB=5 and it had solder pads for resistors on the lines but didn't have any soldered on. I had not yet used SD card on this dev board but has used SD card on my last Lolin 32 pro board successfully. I have checked the Lolin and it does have resistors soldered on the lines

This is the output I got when attempting to mount the SD card.


Quote:>>> os.mountsd()
E (545093) sdmmc_cmd: sdmmc_card_init: send_scr (2) returned 0xffffffff
E (545094) vfs_native: Failed to mount filesystem on SDcard.
Traceback (most recent call last):
  File "", line 1, in
OSError: [Errno 5] EIO
>>>


here's a pic of the SD on the board

   

Also a further question here.

If I am using a board with an SD card interface and it has the SD lines with pull ups on them hard wired on this means if I don't want to use the SD card and want to use those pins as normal I/O pins, the pins will laways be in pull up configuration as they r hard wired that way??
Reply
#2
This board has the sdcard connected the same way as Lolin32 Pro, so it should work in 4-line SD mode.

If the pins have hard wired pullups, you can still use as input and output pins. The only gpio modes which can't be used in this case is input with pull-down and float input.
Reply
#3
Thanks for your response Laboris.

Why am I getting this error when trying to  mount

Quote:>>> os.mountsd()
E (545093) sdmmc_cmd: sdmmc_card_init: send_scr (2) returned 0xffffffff
E (545094) vfs_native: Failed to mount filesystem on SDcard.
Traceback (most recent call last):
  File "", line 1, in
OSError: [Errno 5] EIO
>>>


Also this board isn't wired same as the Lolin32 pro that I had. The Lolin I can see pull up resistors on the SD card lines but the TTGO board does have any pull ups it just has solder pad with blobs of solder but no resistors on them. see pic in above post
Reply
#4
The error is because the sdcard cannot be initialized (not a very useful answer, but the only one).

What I've meant is that the board uses the same gpios to comunicate with sdcard. If the resistors are needed, and the manufacturer  did not soldered them on board, you should probably ask for the replacement.
Reply
#5
Here is a close up image of the TTGO sd card interface
   

Here is 2 close up images of the Lolin32 pro.
   
   
Reply
#6
Is it likely that the sdcard cannot be initialized is caused by the fact the board has the resistors left off??

I am honestly not very happy with this TTGO board as it seems to have a number of problems. No boot button or auto boot (DTR RTS) to select boot mode, no moseft to disconnect the battery or charger IC VOUT from the LDO VIN while the battery is being charged at 4.2v and the LDO VIN being supplied 5v from USB VBUS so this means you can't connect battery and USB at same time or you will have a short so can't use the onboard charger and now I discover the resistors are left off the SD card lines so you can't use the SD card interface either.

This doesn't say good things about TTGO quality.
Reply
#7
I am battling similar issues on my sd card setup.
I have a doit.am brand ESP-WROOM-32 dev board. I have ESP-32_all firmware. I tried to use an sd card slot module but that just didn't work. So I soldered pins to a microSD to SD adapter and connected with short wires. I also have 10K pullup on all 4 lines.  It works:


Code:
>>> uos.mountsd()
D (133376) intr_alloc: Connected src 31 to int 9 (cpu 1)
---------------------
Mode: SPI
Name: SD8GB
Type: SDHC/SDXC
Speed: default speed (25 MHz)
Size: 7600 MB
 CSD: ver=1, sector_size=512, capacity=15564800 read_bl_len=9
 SCR: sd_spec=2, bus_width=5

>>> uos.chdir('/sd')
>>> uos.listdir()
E (220414) sdspi_host: data CRC failed, got=0xab55 expected=0x1c18
E (220415) sdspi_host: sdspi_host_start_command: cmd=17 error=0x109
E (220418) sdmmc_cmd: sdmmc_read_sectors_dma: sdmmc_send_cmd returned 0x109
E (220425) diskio_sdmmc: sdmmc_read_blocks failed (265)
[]

But I can't really use the card since listing the directory will result in CRC failure. I tried two cards and then tried them on PC. Both are FAT32 formatted. I'll investigate further. Is there any way to reduce the SPI bus speed to say 8MHz to see if it works?

By the way, I also tried a card that works on Arduino using SPI mode (probably 1MHz SPI bus speed) and it mounts and lists parameters but throws the same CRC error when I tried to list its directory.
Reply
#8
I previously had a Lolin32 pro, it had a wrover module with an SD slot builtin on the board with the needed pull-ups and it worked 100% in both 4line and 1 line mode but there was other problems with the design in the board that causes the whole board to fail and it has been pulled from the market.

It seems that the ESP32 with psRAM is very new and designers are racing to be the first off the mark with there product and I think this is leading to design faults. I think as time goes by these bugs will be sorted.

I think that I will continue to learn from the failing of other boards and keep working on designing and making my own boards to suit my purposes.
Reply
#9
Found my own cause of error. The doit.am dev board pin markings confused me. I connected the wrong pin for CS. I now have the right pin connected and the card is finally working. I am hoping that some of these boards open their designs. I have some schematics for only the Espressif demo boards but not other boards yet, not to mention no board files. Like OutoftheBOTS, I'm trying to learn from other designers so I can get my own board designs. Got SD card working, now just have to find how to compile the UART module into the lobo firmware.
Reply
#10
Update to this thread.

Although I can't use the SD card reader that is built in on the board (due to no pull-ups on the board) I have successfully connected and external SD card in SPI mode. The extranal SD module does have pull-ups on it.


Quote:MicroPython ESP32_LoBo_v3.1.24 - 2017-03-16 on ESP32 board with ESP32
Type "help()" for more information.
>>> import uos
>>> import os
>>> uos.sdconfig(uos.SDMODE_SPI, clk=14, mosi=15, miso=2, cs=13)
>>> os.mountsd("/sd")
---------------------
Mode: SPI
Name: SD16G
Type: SDHC/SDXC
Speed: default speed (25 MHz)
Size: 14784 MB
CSD: ver=1, sector_size=512, capacity=30277632 read_bl_len=9
SCR: sd_spec=2, bus_width=5

>>> os.listdir()
['System Volume Information', 'JPG', 'VIDEO', 'bots.jpg', 'bots.bmp', 'text.txt']
>>>

   
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)