Quality RTOS & Embedded Software

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


Loading

Api in interrupt CM3

Posted by Alessandro Zerbini on September 24, 2009

I've a problem with FreeRtos, i'm programming on CORTEX M3.
My application is very easy, there is a task that waits on semaphore
and toggle a led, the semaphore is give by a ISR:

void EXTI9_5_IRQHandler(void)
{

portBASE_TYPE xHigherPriorityTaskWoken= pdFALSE;

xSemaphoreGiveFromISR(xSem, &xHigherPriorityTaskWoken);

if(xHigherPriorityTaskWoken==pdTRUE)
portYIELD();
}

The problem is that when the API "xSemaphoreGiveFromISR" is called ,
the programm crashes.
If i don't use API the programm runs...
Can someone help me?
thanks

RE: Api in interrupt CM3

Posted by Richard on September 24, 2009
Can you check that the semaphore xSem was created correctly and is not NULL.

Also, can you step into the xSemaphoreGiveFromISR() function to see at what point the crash occurs.

Regards.

RE: Api in interrupt CM3

Posted by Alessandro Zerbini on September 24, 2009
The semaphore is created correctly.
I see, that xSemaphoreGiveFromISR() runs correctly, the program crashes on portYIELD(), infact doesn't force context switch...

RE: Api in interrupt CM3

Posted by Richard on September 24, 2009
portYIELD() should not cause a context switch directly - the switch is just pended. Try placing a break point on the function called xPortPendSVHandler() in port.c.

Regards.

RE: Api in interrupt CM3

Posted by Alessandro Zerbini on September 24, 2009
i can't place a break point, because i don't simulate the program...

RE: Api in interrupt CM3

Posted by Alessandro Zerbini on September 24, 2009
But i place on the function xPortPendSVHandler() a led that have to toggle, but doesn't toggle..

RE: Api in interrupt CM3

Posted by Richard on September 24, 2009
<code> i can't place a break point, because i don't simulate the program...</code>

I don't understand that - are you running in a simulator or on real hardware?

<code>But i place on the function xPortPendSVHandler() a led that have to toggle, but doesn't toggle..</code>

xPortPendSVHandler() is a naked function written in assembly - you cannot add code to it unless it too is assembly code.

Regards.

RE: Api in interrupt CM3

Posted by Alessandro Zerbini on September 24, 2009
I'm running in real hardware..
Regards

RE: Api in interrupt CM3

Posted by Alessandro Zerbini on September 25, 2009
I've tried to take off the function portYIELD, and program runs...
but now the time between the ISR and handler task is not deterministic..


[ 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