AnsweredAssumed Answered

STM32F4xx and TIM2->ADC->DMA + SDIO->DMA problems

Question asked by eul on Jan 28, 2013
Latest reply on Jan 28, 2013 by fm
I am building a data logger that will sample 12 ADC channels and store the results on an SD Card.

I have successfully configured the 12 ADC channels using ADC1, ADC2, and ADC3 together in the triple ADC regular simultaneous mode. The ADC1 gets triggered by TIM2. The ADCs are read be DMA2 Stream0 Channel0.

The SD Card is written to using the ST SDIO library in DMA mode. 
I need to write multiple blocks as fast as possible which means I need to use DMA. Polling mode doesn't seem to be implemented in SD_WriteMultiBocks() anyway. I did try to use polling mode with SD_WriteBlock() and that seemed to work ok even with the data acquisition going on. This would indicate that there is something strange going on between the DMA2 stream0 (ADC) and DMA2 stream6 (SDIO).

The thing is that, separately both tasks work perfectly but, when both tasks are active, as soon as the writing to the SD Card begins, the ADC values gets stuck at some random value, the same on all channels.

Another strange behaviour; when data acquisition and storing of data are both active, there seems to be a lot of spurious interrupts arriving to the DMA2 Stream0 Channel0 interrupt handler. This phenomenon starts as soon as the writing to the SD Card starts. It doesn't help to use polling mode for the SDIO either, so I guess it's something with the SDIO port access conflicting with the ADC sampling.

Any ideas as to what can be the cause of this weird behaviour?