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

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 ]    [ 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