Quality RTOS & Embedded Software

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


Loading

rtos viewer

Posted by renaldtravispaad on April 30, 2010
Hi all,
I am using freertos version 5.4.2 for a project in PIC24FJ256GB110. I used the following code to service the UART interrupt.
void __attribute__((interrupt,no_auto_psv )) _U2RXInterrupt (void)
{
static portBASE_TYPE taskWoken;
taskWoken=pdFALSE;
IFS1bits.U2RXIF=0;
c=U2RXREG;
xQueueSendFromISR(uartqueue, &c, &taskWoken);
}

The system seems to work fine for a few minutes and then fails. When I removed the source of the UART interrupt, the system worked alright. So, I changed the code as follows
void __attribute__((interrupt,no_auto_psv )) _U2RXInterrupt (void)
{
static portBASE_TYPE taskWoken;
taskWoken=pdFALSE;
IFS1bits.U2RXIF=0;
uartrecdval=U2RXREG;
}

The system now worked with the UART interrupt well. I don't understand this behavior. Am I missing something here??. I would appreciate any help, so that I can understand what might be going on here.

I also see a plugin in MPLAB IDE called RTOS viewer. Can someone point me to some reading resources on this, so that I can get started on this.

Thanks in Advance!!!

RE: rtos viewer

Posted by MEdwards on April 30, 2010
Is the priority of the interrupt set to portKERNEL_INTERRUPT_PRIORITY? If not try changing it to portKERNEL_INTERRUPT_PRIORITY to see if it fixes the problem. Also check the stack sizes of your tasks http://www.freertos.org/Stacks-and-stack-overflow-checking.html.

RE: rtos viewer

Posted by Richard Damon on April 30, 2010
One possible issue I see is that you have declared your interrupt handler no_auto_psv, which means that the handler can not access the PSV segment. You then call xQueueSendFromISR which I am not sure if it needs the auto_psv segment. Most of the time the PSV segment will be setup right, and the interrupt will run fine. There may be a few small sections of your program in which the compiler needs to change the PSV segment, if the interrupt occurs there, and xQueueSendFromISR needs to access the PSV segment, then problems will occur.

A side note, your interrupt routine is not checking the taskWoken flag, so if a character does arrive, the waiting task will not start up right away, but will need to wait for the next time a task switch happens (like at the next timer tick) before it has a chance to process that character. This may be acceptable for your program.

RE: rtos viewer

Posted by renaldtravispaad on April 30, 2010
Thanks edward and richard for replying...

@edward
I have defined
#define configKERNEL_INTERRUPT_PRIORITY0x01
in the freertosconfig.h file. Is it the same as portKERNEL_INTERRUPT_PRIORITY??

@richard
The problem persisted even when I changed no_auto_psv to auto_psv. So, I am not sure if that was the mistake and yes it is okay for my task to start in the next tick

Also, I want to know if there is any material I can look up to use the RTOS viewer plugin in MPLAB.

Thanks in advance!!

RE: rtos viewer

Posted by Richard Damon on April 30, 2010
If configKERNAL_INTERRUPT_PRIORIRY is set to 1, make sure you have changed the interrupt priority of the interrupt to be 1 also. (Interrupts with a priority high than that are not allowed to call FreeRTOS APIs).

As to the documentation of the View Plugin, I know it is in there, I just am not that familiar where. I believe you need to set the option to remove the static qualifications for FreeRTOS locals, enable some tracing options, and it is very helpful to make sure you give each queue a unique name.

RE: rtos viewer

Posted by renaldtravispaad on May 6, 2010
hi richard,
Apologies for a long delay. I got bogged down with another minor project.

I have another define in the freertosconfig.h which is
#define configMAX_SYSCALL_INTERRUPT_PRIORITY0x04

My UART priority is 3. Do you still think I need to make the configKERNEL_INTERRUPT_PRIORITY as 3 or set the UART priority to 1?

Thanks!

RE: rtos viewer

Posted by Richard on May 7, 2010
From the documentation page for the PIC24 port "Interrupt service routines that can cause a context switch must execute with priority portKERNEL_INTERRUPT_PRIORITY, and only call taskYIELD() at the very end of the service routine after the interrupt source has been cleared. See the file serial.c included in the demo application for an example."

Regards.


[ 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