Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

High frequency ISRs in FreeRTOS

Posted by peb on February 2, 2010
Hello all,

I am a new to RTOS and starting to be familiarized with FreeRTOS.
My intention is to investigate how to integrate motor control into FreeRTOS.
Usually motor control system (without RTOS) runs Motor_control_ISR at 100[usec] periodic rate and code is executed within this Motor_control_ISR which takes about 40[usec].
It is hard real time system where motor control must complete within a given time limit otherwise results in failure of the system.

Are there any handling techniques of such high frequency ISR to comply with FreeRTOS?
Do you have any suggestions how to handle high frequency ISRs within FreeRTOS?
Should it be such a ISR executed outside of FreeRTOS?
Thank you very much.

regards,
pepe

RE: High frequency ISRs in FreeRTOS

Posted by Dave on February 2, 2010
Look at configKERNEL_INTERRUPT_PRIORITY and configMAX_SYSCALL_INTERRUPT_PRIORITY at the bottom of this page. These parameters are only on new ports though.

The Cortex M3 demo apps run a 20KHz timer test that shows an interrupt entry jitter of about 100ns which is apparently equal to the effect of tail chaining in the core itself.

RE: High frequency ISRs in FreeRTOS

Posted by peb on February 2, 2010
Is your suggestion to execute such ISRs outside FreRTOS? (Interrupts running at these priorities will never be delayed from executing because of anything FreeRTOS.org is doing. )
If so, how to interact with FreeRTOS it means between high frequency ISR and FreeRTOS?

RE: High frequency ISRs in FreeRTOS

Posted by Dave on February 2, 2010
Yes, if you want the interrupt to have a priority higher than any used by the kernel (including critical sections) then the handler cannot use any FreeRTOS functions.

RE: High frequency ISRs in FreeRTOS

Posted by peb on February 2, 2010
Any idea how to interact between ISR (priority higher than any used by the kernel) and FreeRTOS kernel?

RE: High frequency ISRs in FreeRTOS

Posted by Peter on February 2, 2010
You can use anything you like. If you need a buffer just use it and make it globally available. Make sure you have a lock mechanism.

UINT8 bufferLock = 0x00;
UINT8 buffer[8];

_ISR_(...)
{
if (!bufferLock)
{
... check buffer data
...update data
}
...
}


void pvTask(...) // Has a lower priority than the ISR, so pvTask can not interrupt the ISR
{
// Try to access buffer, Method 1
...disable interrupts
if (bufferLock)
{
// Buffer is in use...
} else
{
// Update buffer here
}
...enable interrupts

#Method 2
..disable interrupts
if (!bufferLock)
bufferLock = 0x01;
..enable interrupts
if (bufferLock)
{
// Update your buffer...
...
// Unlock buffer
bufferLock = 0x00;
}
}

This is quick and dirty, but it works...

RE: High frequency ISRs in FreeRTOS

Posted by peb on February 2, 2010
Guys,
Thank you a lot!


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


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

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

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner