2011-01-18 07:14 AM
SDIO example: are some steps described in readme.txt missing in the code?
2011-05-17 05:21 AM
Hi Martino,
If I remember correctly the only interrupt handled in ST's examples is the general SDIO interrupt and that's being set in the NVIC_Configuration function in main.c. The function ''SD_ProcessIRQSrc'' is placed into the SDIO vector in stm32f10x_it.c and that function handles things differently depending on whether poll, interrupt or DMA mode is set up.
The SD_SetDeviceMode simply sets an internal flag to tell the interrupt handler what to do. There's no interrupt handler set up for the DMA completion. Instead, at the end of each of the read/write functions there's a loop that waits for the DMA to finish. By the way, there are problems with that particular loop since it neither handles timeouts nor some errors that can occur during the transfer.
If you know exactly how you want your SDIO code to work it's probably better to rewrite the interrupt and completion handling. I think it would be best to have a ''DMA done'' interrupt handler in addition to the SDIO interrupt handler. The example is a little convoluted since it's trying to show three different ways of handling SDIO. I don't think polling or interrupt mode are really a good idea in most real-world applications.
Andrew