SDIO Slave. Sending bug.
Posted: Wed Aug 29, 2018 2:53 pm
Hello.
I've faced some kind of bug i can't understand whet trying to send data from SDIO Slave.
I use 4 bit bus and CLK freq is 400kHz.
As i read from docs, buffer for sending have to be 4-byte alligned and DMA accessable. I create it like that
Then i send to send queue some areas of this allocated buffer.
But if my buffer area crosses with addresses 0x3FFB5A6C - 0x3FFB5ABC, then SDIO Slave driver sends rubbish. While SDIO Host clocks all (100 * 2 + 16) ticks for 100 bytes, but slave sets data for less bytes, and send some zeros. With other buffers driver works fine.
In my case 0x3FFB5A6C is address of dataBuf[200], so second buffer area fails to be sent.
dataBuf[100-199] == 0xC3
dataBuf[200-299] == 0xF0
dataBuf[300-399] == 0xA5
i attached LA file for this case, hope bookmarks will not dissapear.
Moving 100 byte sending interval in allocated buffer i've found area (0x3FFB5A6C - 0x3FFB5ABC), that caused problems. If my send buffer touches this area by any address, sendind will be corrupted.
I also tried that on my second esp32 board with same result.
So, what that can be? Is that problem of DMA or SDIO Slave driver or silicon limitations? Are there some more areas like that?
I also attached sourse file, based on standard exanple, that i used while faced that issue.
Thanks,
alexey.
I've faced some kind of bug i can't understand whet trying to send data from SDIO Slave.
I use 4 bit bus and CLK freq is 400kHz.
As i read from docs, buffer for sending have to be 4-byte alligned and DMA accessable. I create it like that
Code: Select all
uint8_t * dataBuf = heap_caps_malloc(600, MALLOC_CAP_DMA | MALLOC_CAP_32BIT);
Code: Select all
ret = sdio_slave_send_queue(&(dataBuf[100]), 100, &(dataBuf[100]), 0);
if(ret != ESP_OK) {
printf("failed to send buf 1, errcode = %d\n", ret);
}
ret = sdio_slave_send_queue(&(dataBuf[200]), 100, &(dataBuf[200]), 0);
if(ret != ESP_OK) {
printf("failed to send buf 2, errcode = %d\n", ret);
}
ret = sdio_slave_send_queue(&(dataBuf[300]), 100, &(dataBuf[300]), 0);
if(ret != ESP_OK) {
printf("failed to send buf 3, errcode = %d\n", ret);
}
In my case 0x3FFB5A6C is address of dataBuf[200], so second buffer area fails to be sent.
dataBuf[100-199] == 0xC3
dataBuf[200-299] == 0xF0
dataBuf[300-399] == 0xA5
i attached LA file for this case, hope bookmarks will not dissapear.
Moving 100 byte sending interval in allocated buffer i've found area (0x3FFB5A6C - 0x3FFB5ABC), that caused problems. If my send buffer touches this area by any address, sendind will be corrupted.
I also tried that on my second esp32 board with same result.
So, what that can be? Is that problem of DMA or SDIO Slave driver or silicon limitations? Are there some more areas like that?
I also attached sourse file, based on standard exanple, that i used while faced that issue.
Thanks,
alexey.