cancel
Showing results for 
Search instead for 
Did you mean: 

Pb with FreeRTOS and USB

serge23
Associate II
Posted on January 05, 2012 at 13:26

Hello,

We are working on the STM3220-G Evaluation Board.

We are using IAR compiler [V6.2] and running a test application with FreeRTOS [7.0.2] and the STM32_F105-07_F2xx_USB-Host-Device_Lib_V2.0.0

The USB is used as Virtual Com Port.

The USB alone works correctly.

The FreRTOS alone works correctly (with only one task).

But when I put USB with FreeRTOS, I have systematically a crash on the IAR environnement (don't answer), I must close the environnment

Have someone already have this kind of problem, please?

Regards

#usb #freertos #freertos #virtual-comm-port
5 REPLIES 5
alok472
Associate II
Posted on January 06, 2012 at 07:47

Can you pls share which functions of USB did you put in Tasks ?

Is the USB Interrupt running Freely without the FreeRTOS Task ?

serge23
Associate II
Posted on January 06, 2012 at 08:31

Thank you for your answer.

I have no task USB, I've just a task that do nothing (just while(1)).

The USB Interrupt (USBD_OTG_ISR_Handler) is running without the FReeRTOS.

serge23
Associate II
Posted on January 06, 2012 at 09:53

The problem is now solved.

It was a problem of priority between USB interrups and FreeRTOS (Systick) interrupts.

I've forgotten tthe line :

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);

that FreeRTOS preconize.

The USB Stack writes

 NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);

and it is incompatible with FreeRTOS.

serge23
Associate II
Posted on January 06, 2012 at 09:54

The problem is now solved.

It was a problem of priority between USB interrups and FreeRTOS (Systick) interrupts.

I've forgotten tthe line :

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);

that FreeRTOS preconize.

The USB Stack writes

 NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);

and it is incompatible with FreeRTOS.

nospam
Associate II
Posted on January 08, 2012 at 11:02

Please always read the FreeRTOS documentation on how to write interrupt service routines for your particular port.  In this case, any documentation page for an STM32 demo will do.  The bit of interest is setting up the interrupt nesting parameter configMAX_SYSCALL_INTERRUPT_PRIORITY. For example, see the Interrupt Service Routines section on the following page

http://www.freertos.org/FreeRTOS-for-STM32F4xx-Cortex-M4F-IAR.html

There is more in the FAQ ''My application does not run, what could be wrong'' - point 3 is most important for Cortex-M users:

http://www.freertos.org/FAQHelp.html

Having any NVIC_PriorityGroupConfig() setting other than NVIC_PriorityGroup_4 massively complicates things.  ST are, to my knowledge, the only Cortex-M vendor who default to something else.

Regards,

Richard (

http://www.FreeRTOS.org

)