2012-02-04 01:35 PM
Hi,
I managed to read an SD-Card on the MCBSTM32EXL board in SD-Mode (not SPI-Mode) by developing my own driver. But writing does not succeed. If I exchange the FIFO address by a variable then afterwards this variable contains the last buffer value to be send. Checking the SDIO->DCOUNT register shows 0x200 before and 0x000 after the write operation. So this seems okay but on my oscilloscoop I do not see any data on the D0 signal. If I disable the DMA and execute a manual write to the FIFO then data is transmitted. With reading I discovered that SDIO->DCTRL DTDIR must be defined prior to DBLOCKSIZE otherwise no data is read. I use SDIO blocksize of 512 and DMA DMA2_Channel4->CNDT set to 128. I read the errata sheet as there are some issues with the SDIO but not the one I encountered. Who can help me out, Thanks Henk2012-02-04 02:06 PM
Hi,
After hours of testing I got desperate, tested all kinds of weird configuration sequences and finally posted my question on this forum. Just a few minutes later I removed my debug calls (executed parallel to the data-transmission) to the serial port using USART2 and DMA1 channels 6 and 7. Low and behold...my SD-mode write operation just works fine now! I carefully checked my USART2/DMA1 driver code but found no conflicting or wrong instructions. So somehow it seems that USART2/DMA1 has some influence on SDIO/DMA2. I will not investigate it further as it has cost me lots of time but if I find the cause (maybe in software) then I will report it here. Thanks for listening anyway. Henk2012-03-02 08:22 AM
2012-03-02 08:51 AM
sounds like a timing problem, during my testing i discovered, that if i put some code or breakpoints between the read or write block command and the enabling of dma2 then the program fails.
You're describing a race condition, the DMA should always be setup prior to initiating events that will cause it to be used.
2012-03-03 11:47 AM
now, i know that. but in the sdio examples in the standard peripherals lib it is the other way round ;)
You're describing a race condition, the DMA should always be setup prior to initiating events that will cause it to be used.