SDIO problems

mikemoretti
Posts: 3
Joined: Thu Jun 25, 2020 8:32 pm

SDIO problems

Postby mikemoretti » Thu Jun 25, 2020 8:42 pm

I've been trying to get the SDIO host/slave examples working on two ESP32 dev boards. I'm using the secondary SDIO pins (the ones that are also JTAG pins), not the pins that are used for the SPI flash. I went through all the rigamarole of adding pullups to the lines, dealing with GPIO12 and all that. The boards are actually connected together at the headers (except for EN and some other pins). The boards can talk fine for the most part. It's just that when the example code gets to the "fifo" job, it times out trying to send a packet in esp_slave_send_packet because when it calls esp_slave_get_tx_buffer_num it keeps getting a zero back from the slave and retries a bunch of times until it finally times out. I'm seeing this same issue when using a NXP IMXRT1064 to talk to an ESP32 slave. I've tried this using both 1 and 4 bit transfers. I don't know what's going on. From what I can see, the NXP IMXRT1064 sent data is valid on the rising edge of the sd clock, and the esp32 slave response data is valid on the falling edge. I'm not sure if this has anything to do with it or not. I'm also seeing weird stuff on the lines. Here are some analyzer screenshots of the send and receive of this particular packet.
sdio-txbufreq.png
sdio-txbufreq.png (10.29 KiB) Viewed 409 times
sdio-txbufreq-response.png
sdio-txbufreq-response.png (10.38 KiB) Viewed 409 times
Any ideas? Why is the tx buffer register always zero?

Thanks,
-m

mikemoretti
Posts: 3
Joined: Thu Jun 25, 2020 8:32 pm

Re: SDIO problems

Postby mikemoretti » Fri Jun 26, 2020 3:18 pm

So, actually, for IMXRT to ESP32 the err = esp_slave_read_bytes(context, HOST_SLC0HOST_TOKEN_RDATA_REG, (uint8_t*)&len, 4); in esp_slave_get_tx_buffer_num was getting 0x00001000 in len but then doing some bit math and it ends up 0 at the end.

Also, I tried all the permutations of SDIO_SLAVE_TIMING_ and that did not help. (SDIO_SLAVE_TIMING_PSEND_PSAMPLE, SDIO_SLAVE_TIMING_NSEND_PSAMPLE, SDIO_SLAVE_TIMING_PSEND_NSAMPLE, SDIO_SLAVE_TIMING_NSEND_NSAMPLE). With SDIO_SLAVE_TIMING_NSEND_PSAMPLE, the data was coming on the rising edge (as the IMXRT) expects, but I still got 0x00001000 for the len and then 0 after all the bit math.

The analyzer traces look exactly the same for this call for ESP32 to ESP32, except of course the edge timing for data. The ESP32 to ESP32 gets 0x000c0000 in this call, and gets further in the process but it still doesn't complete the read of fifo data.

I'm at a loss now. I don't know where to turn.

Thanks,
-m

mikemoretti
Posts: 3
Joined: Thu Jun 25, 2020 8:32 pm

Re: SDIO problems

Postby mikemoretti » Fri Jun 26, 2020 4:12 pm

Actually, I solved my problem. I had badly ported part of the esp slave code to the IMXRT. One of my low level functions was passing an invalid parameter. However, I did have to use SDIO_SLAVE_TIMING_NSEND_PSAMPLE on the esp32 slave side to get the IMXRT to be able to read data from it.

-m

Who is online

Users browsing this forum: No registered users and 16 guests