cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Discovery - HAL ADC crashes FreeRTOS

jirik09
Associate II
Posted on January 17, 2015 at 21:53

I generated code for FreeRTOS with USB by STM32cube and I�m trying to use ADCs triggered by Timer3 and transfer data to memory by DMA2. There are only three FreeRTOS tasks sending messages to each other and sleeping most of the time. They are not communicating over USB and don�t access to hardware. Application is not using any ISRs (except USB).  When ADC, DMA and Timer are initialized (it is not running yet), FreeRTOS after while crashes on

for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd );

I didn�t found any problem with stack overflow, priorities etc. as suggested on FreeRTOS help.

If I comment out initialization of ADC, DMA and Timer FreeRTOS goes well.

It seems like trouble with HAL, because similar application works perfectly with std-libraries before.

Do you have any ideas how ADC with DMA can break down FreeRTOS scheduler?

Thank you

#stm32f4 #stm32cube #freertos
4 REPLIES 4
Posted on February 27, 2015 at 13:54

Hi jirik,

Could you provide a little more informations about the STM32CubeF4 FW package you are using and your project files so we can better explain it to our development team...

Regards,

Heisenberg.

deimantas
Associate
Posted on September 09, 2015 at 07:49

Hi,

I have the same problem. 

Yesterday i updated STM32CubeF4 FW to v1.8. And still the same.

I'm using ADC DMA example for stm32d4xx discovery and after adc initialization i start free-rtos (using cmsis-os wrapper) kernel with one thread. ADC does only one conversion and after that i have error in ADC handler - 0x2.

Amel NASRI
ST Employee
Posted on September 09, 2015 at 12:14

Hi zvirblis.deimantas,

What is the error exactly?

Does FreeRTOS work as expected when ADC is disabled (as it was the case for jirik09)?

-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.

deimantas
Associate
Posted on September 09, 2015 at 17:56

Error code is HAL_ADC_ERROR_DMA (0x02) which means DMA transfer error.

Free RTOS working fine.

If i dont start FreeRTOS (everything commented) ADC conversions with DMA works fine.