RT 19.1: Exception Handling for Fast Interrupt

Discussions and support about ChibiOS/RT, the free embedded RTOS.
logan54
Posts: 22
Joined: Tue Apr 01, 2014 5:59 am
Location: Austria

RT 19.1: Exception Handling for Fast Interrupt

Postby logan54 » Fri Jun 14, 2019 9:43 am

Hello,
I am trying to port the RT Kernel of CHIBIOS 19.1.2 to the Cypress MB9BF516N (Cortex M3) (see SK-FM3-100PMC-MB9BF516N https://www.cypress.com/documentation/development-kitsboards/fm3-100pmc-mb9bf516n).
This MCU has the following core:
    32-bit ARM Cortex-M3 Core
    Processor version: r2p1

    Up to 144 MHz Frequency Operation
    Memory Protection Unit (MPU): improves the reliability of an
    embedded system
    Integrated Nested Vectored Interrupt Controller (NVIC): 1
    NMI (non-maskable interrupt) and 48 peripheral interrupts
    and 16 priority levels
    24-bit System timer (Sys Tick): System timer for OS task
    management
I don't use the the HAL Layer.
Now my question is how to implement Fast Interrupts (without OS Context) and call the task scheduler afterwards to report an Interrupt Event to an appropriate Thread.
Therefore I've the following exception concept in mind:
least priority (OS I-State [Systick, SVC_Handler, PEND_SV])
Fast Priority: Calls PEND_SV Exception to inform Threads by event about interrupt occurance

chcore.h
#define CORTEX_MAXIMUM_PRIORITY 0U
#define PORT_USE_ALT_TIMER FALSE


this definition is set in chcore_v7.mh
#define PORT_SUPPORTS_RT FALSE
#define CORTEX_BASEPRI_DISABLED 0U
#define CORTEX_ENABLE_WFI_IDLE FALSE
#define CORTEX_SIMPLIFIED_PRIORITY FALSE



irq1.gif


+ Q: OS I-State functions should run at CORTEX_MINIMUM_PRIORITY priority?
+ Q: It is sufficient to use the Handler SVC_Handler and PendSV_Handler from chchore_v7m.c ?
+ Q: Is there another way meant to do the job better?

regards
Lorenz

User avatar
Giovanni
Site Admin
Posts: 13572
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 874 times
Been thanked: 748 times
Contact:

Re: RT 19.1: Exception Handling for Fast Interrupt

Postby Giovanni » Fri Jun 14, 2019 9:50 am

Hi,

RT CM port default settings are already OK for what you need to do:

Priorities 0 and 1 are reserved as "fast interrupts", priority 2 is reserved for the OS.

The OS code cannot be invoked from fast handlers, you can use PENDSV (or some other interrupt) to delegate an action to a lower priority handler (3..15) able to interact with the OS. You may, for example, wake up a thread.

Also see this: http://chibios.org/dokuwiki/doku.php?id ... interrupts

Giovanni

logan54
Posts: 22
Joined: Tue Apr 01, 2014 5:59 am
Location: Austria

Re: RT 19.1: Exception Handling for Fast Interrupt

Postby logan54 » Thu Jun 20, 2019 6:47 pm

Hi Giovanni,

thank you for the advice, I'll implement the Handling withing this architecture

regards
Lorenz


Return to “ChibiOS/RT”

Who is online

Users browsing this forum: No registered users and 2 guests