Quality RTOS & Embedded Software

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


Loading

Interupts priorities on PIC18

Posted by Marcelo Adrian Lorenzati Sanz on October 19, 2008
Hi all,
I´m using FreeRTOS with PIC18 and I´ve modified the port to work with priorities (High priority for the prvTickISR) and low priority for the others (like USART and I2C).
Is there any consideration to have in mind? because I´m having a strange behaviour with the task that manages the I2C that waits for the I2C semaphore to be signaled.

here the ISR code:

#pragma code high_vector=0x08
static void prvHighInterrupt( void )
{
/* Was the interrupt the tick? */
if( PIR1bits.CCP1IF )
{
_asm
goto prvTickISR
_endasm
}
}
#pragma code


#pragma code low_vector=0x18
static void prvLowInterrupt( void )
{
/*i2c interrupt*/
if( PIR1bits.SSPIF )
{
_asm
goto vI2cISR
_endasm
}

/* Was the interrupt a byte being received? */
if( PIR1bits.RCIF )
{
_asm
goto vSerialRxISR
_endasm
}

/* Was the interrupt the Tx register becoming empty? */
if( PIE1bits.TXIE && PIR1bits.TXIF )
{
_asm
goto vSerialTxISR
_endasm
}
}
#pragma code

Here the timer int hook and i2c int hook:

#pragma interrupt prvTickISR
static void prvTickISR( void )
{
/* Interrupts must have been enabled for the ISR to fire, so we have to
save the context with interrupts enabled. */
portSAVE_CONTEXT( portGLOBAL_INTERRUPT_FLAG );
PIR1bits.CCP1IF = 0;

/* Maintain the tick count. */
vTaskIncrementTick();

#if configUSE_PREEMPTION == 1
{
/* Switch to the highest priority task that is ready to run. */
vTaskSwitchContext();
}
#endif

portRESTORE_CONTEXT();
}


#pragma interruptlow vI2cISR save=PRODH, PRODL, TABLAT, section(".tmpdata")
void vI2cISR( void )
{ .....

Do I have to manage the global interrupt? (GIEH , GIEL )



RE: Interupts priorities on PIC18

Posted by Dave on October 21, 2008
Looking at this (I try to avoid looking at anything with PIC18 in it) it seems the FreeRTOS code only uses the one priority so using both would require some effort to change the port.

RE: Interupts priorities on PIC18

Posted by Marcelo Adrian Lorenzati Sanz on October 21, 2008
Thanks, its true.
I´ve been diggin around and the port its not optimized to use priorities.


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

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

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