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

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