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


High priority interrupts on pic24 port

Posted by Chuck on June 3, 2010
I have just isolated a bug in some code I'm debugging on a PIC24 project. The code is using an API function in an ISR that runs at a priority higher than the kernel priority (1).

The priorities were setup because our AD has a very tight timing requirement for clocking the data in (if we take an interrupt in the middle we loose data). The problem is the code right now is queuing up the data (a fair bit) from the ISR for external task processing and saving to an SD card. This mechanism eventually crashes.

So now I'm in a quandary, how best to handle this from an architectural standpoint? Implementation as a queue was natural (as was a semaphore) but it appears that none of the OS centric solutions will work here since I can't call them. Valid assumption? Am I stuck writing to a circular buffer I manage in the ISR and then having a task poll to see if new data has arrived? Seems to defeat some of the reason I'm using an OS!

Any help greatly appreciated, this has been quite a wild goose chase!


RE: High priority interrupts on pic24 port

Posted by Richard Damon on June 3, 2010
Since the interrupt is above configKERNEL_INTERRUPT_PRIORITY then the ISR can not user any FreeRTOS functions, so no queue to send data from ISR to task. You will need to fill a buffer in ram, and somehow signal the task the data is there, one trick would be to take some unused device, and have the A/D interrupt manually trigger it with the IF register, and have that interrupt set a semaphore, etc.

Another option, if your processor supports it, is to use DMA to read the A/D and take an interrupt on buffer full, which would be less critical. (This may not be an option on your processor, I know some of the dsPIC33 have this, I don't know if any of the PIC24s do.

[ 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