FreeRTOS interrupt settings based on STM32 applications

Publisher:BlissfulHeartLatest update time:2016-09-02 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1. Introduction to FreeRTOS interrupt settings

Two macros are defined in FreeRTOSConfig.h:

  • configKERNEL_INTERRUPT_PRIORITY
  • configMAX_SYSCALL_INTERRUPT_PRIORITY
  •        ​configKERNEL_INTERRUPT_PRIORITY is used to set the interrupt priority of the RTOS kernel. Because the RTOS kernel interrupt is not allowed to preempt the interrupt used by the user, this macro is generally defined as the lowest hardware priority.
  •        configMAX_SYSCALL_INTERRUPT_PRIORITY is used to set the highest interrupt priority that can safely call FreeRTOS API functions in the interrupt service routine. When the priority is less than or equal to the priority represented by this macro, the program can safely call FreeRTOS API functions in the interrupt service routine; if the priority is greater than the priority represented by this macro, it means that FreeRTOS cannot disable this interrupt, and no API function can be called in this interrupt service routine.

       That is, the RTOS interrupt nesting scheme divides the available interrupt priorities into two groups: those that will be overwritten by the RTOS critical section and those that will never be overwritten so these are always enabled. The configMAX_SYSCALL_INTERRUPT_PRIORITY setting is the boundary value between these two groups.

12
13

As shown in the figure above, when using FreeRTOS in STM32, the system defaults to:

//This is the raw value as per the Cortex-M3 NVIC. Values ​​can be 255
(lowest) to 0 (1?) (highest).
#define configKERNEL_INTERRUPT_PRIORITY 255 (0xFF is priority 15)
​ //!!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html.
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 191 (0xBF is priority 11)

Therefore, interrupts with priority levels of 0 to 10 will not be delayed by the kernel and can be nested but cannot call API functions. Interrupts between 11 and 15 can call API functions ending with ​FromISR.


Keywords:STM32 Reference address:FreeRTOS interrupt settings based on STM32 applications

Previous article:Implementing the comprehensive design of stm32 in FSK modem
Next article:Detailed explanation of drone gyroscope application based on STM32

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号