cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f429i disco, DMA, ADC and FreeRtos

arkadiuszkoziel93
Associate
Posted on September 27, 2015 at 14:19

Hello,

Im developing some applicatnion whitch must use FreeRTOS and sample 2 channels ADC. I decided to use DMA mechanism for easier data preparation. Code is fully generated from ST CubeMx and just without FreeRTOS works fine.

Here is same topic but there is no answer:

/public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=https%3a//my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/ADC%20with%20DMA%20in%20FreeRTOS&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F&currentviews=955

I created few task to refresh LCD, read Touchscreen state and some more... DMA works once and then processor do not goes into DMA interrupt and do not refresh buffer. I have no more ideas. I think FreeRTOS is bad configured for DMA and thats the reason of this behaviour.

Can you help?

#dma #adc #freertos
2 REPLIES 2
Amel NASRI
ST Employee
Posted on September 28, 2015 at 16:36

Hi koziel.arkadiusz,

Is it possible to check where does your project get stuck?

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

jpeacock
Associate II
Posted on September 28, 2015 at 21:03

FreeRTOS does indeed work well with ADC and DMA so it's more likely your code is missing a check for an error condition.  As in the original post you reference you need to provide the state of DMA channel and an example of how you handle DMA interrupts.

Do you enable the error interrupts for DMA?  Never ignore the error interrupts for any device; they exist for a reason.  If you do, your program may never complete, precisely as you describe.  You should also check for ADC errors.  If the ADC conversion stops the DMA will never complete, again, precisely as you describe your problem.

Your first task should be to determine what happens to the DMA.  Use timeouts waiting for DMA completion and insert a breakpoint in the debugger so you can examine the DMA and ADC channel status.

  Jack Peacock