Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

Can anybody tell me on how to config INT priority?

Posted by labelsrbb on October 12, 2013

Hi It is my first time to use FreeRTOS7.5 on STM32F103VC. In my system, I use EXTI INT as exception INT and I use xQueueSendFromISR() to post event to Exception Task in this INT handler. While some times, this INT occured when xPortSysTickHandler() exec and then system halt. So can anybody tell me how to config FreeRTOS's INT priority to disable EXTI handler when xPortSysTickHandler() in processing? Thanks a lot.


Can anybody tell me on how to config INT priority?

Posted by davedoors on October 12, 2013

If you are saying your system crashes when the EXTI interrupt nests with the xPortSysTickHandler() function then it must be your interrupts have bad priority values or your STM32 interrupt controller has not been configured to make the ST peripheral libraries stable.

If the EXTI handler is using xQueueSendFromISR() then it must have a priority equal to or lower than a user defined constant set in FreeRTOSConfig.h. configMAXSYSCALLINTERRUPTPRIORITY and configMAXLIBRARYINTERRUPTPRIORITY are the two to look for.

There are lots of different ways of setting the priority of the EXTI interrupt but I guess you are using the ST libraries. I can't remember the name of the function they provide so you will have to look it up.

Lots about this written on the following link http://www.freertos.org/RTOS-Cortex-M3-M4.html but the interrupt system on Cortex-M3 devices seems so dysfunctional to normal people it is not difficult to see why so many people don't understand it and get it wrong. Luckily, if you are using FreeRTOS V7.5.2, then you can just define configASSERT() in FreeRTOSConfig.h and it will check the configuration for you as you application executes http://www.freertos.org/a00110.html#configASSERT


Can anybody tell me on how to config INT priority?

Posted by labelsrbb on October 12, 2013

thank you very much.

It is true that system crash if EXTI occured and SysTick handler is also in processing. :-(

In my platform, there are USB,COM,EXTI INT. in USB INT Handler, I malloc buffer and send RX buffer pt to the USB RX task. The USB INT has the highest INT priority. I can reduce EXTI priority, but I cannot reduce USB INT priority. So I think the crash will happen if USB INT occured when SysTick handler is in processing. Is it right? The one method to avoid this is portDISABLEINTERRUPTS() when enter xPortSysTickHandler() and portENABLEINTERRUPTS() when leave xPortSysTickHandler(), am I right? Or another method, up the systick INT prio to the highest. am I right? thanks a lot.


Can anybody tell me on how to config INT priority?

Posted by davedoors on October 12, 2013

but I cannot reduce USB INT priority

Why not? I've never heard of an interrupt on a Cortex-M3 that had a fixed priority.

Is the USB interrupt using a FreeRTOS API function? If not, then its priority does not matter, if so, then as already said its priority must be equal to or below the configured maximum syscall priority.

If the USB interrupt is using a FreeRTOS API function and its priority really cannot be changed (I would be amazed if it can't) then you will have to raise the maximum syscall priority to equal the USB priority. That is done using the constants I noted in my first post.

Do not change the SysTick priority. That would not fix anything anyway, just move the problem.

Also do not call portDISABLEINTERRUPTS() in an interrupt. Only functions and macros that end in FromISR or FROMISR can be used in interrupts. If you need a critical section in an interrupt use portSETINTERRUPTMASKFROMISR()/portCLEARINTERRUPTMASKFROMISR() instead. In fact, portDISABLEINTERRUPTS() should not really even be called from a task unless you are an expert user. From a task you should use taskENTERCRITICAL()/taskEXIT_CRITICAL() to create a critical section.

In this case calling portDISABLE_INTERRUPTS() would not change anything anyway as it would still leave non system call interrupts enabled.


Can anybody tell me on how to config INT priority?

Posted by labelsrbb on October 12, 2013

thank you very much, I will try... thanks.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists