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

Resuming task from interrupt delay problem

Posted by inimicus8 on September 21, 2015

Hi I have a problem that it takes a long time to resume a task when i call ”xTaskResumeFromISR” from within a interrupt. It takes at least 7ms from that I call ”xTaskResumeFromISR” to that the task starts executing. The delay time slowly increases to over 100ms. If i call vTaskResume from another task the task resumes immediately. I only have one interrupt on and only one other task that only contains a while loop and vTaskDelay(100/portTICKRATEMS);. (if I don’t have another task I can’t run the program for some reason)

program:

main: { xTaskCreate( taskB, ( signed char * ) "taskB", configMINIMALSTACKSIZE, NULL, 2, NULL );

xTaskCreate( CANControlTask, ( signed char * ) "CControl", configMINIMALSTACK_SIZE, NULL, 1, &canHandle );

// FreeRTOS start vTaskStartScheduler();

}

void CANControlTask( void* pdata ) { CANConfig(); while (1) {
CANReceiveRoutine(); vTaskSuspend( NULL ); // ulTaskNotifyTake( pdTRUE, (10000/portTICKRATEMS) ); } }

void CANRXInterrupt( void ) { BaseType_t xHigherPriorityTaskWoken = pdTRUE;

IO_OkStatusLedOn();
if (CAN_GetITStatus(CANx, CAN_IT_FMP0) != RESET)
{
    .......................................

	xTaskResumeFromISR( canHandle );
	//  vTaskNotifyGiveFromISR( canHandle , &xHigherPriorityTaskWoken );
	 CAN_ClearITPendingBit(CANx, CAN_IT_FMP0);
}

}

Does anyone know why this happens and how to fix it? Same thing happens when I use “ulTaskNotifyTake” and “vTaskNotifyGiveFromISR” When I run my program In CoOS I don’t get this problem.

Info about platform: MCU: stm32f407: IDE: coocox 2.0.3. toolchain: gcc 4.8 2004. RTOS: FreeRTOS V8.2.2


Resuming task from interrupt delay problem

Posted by rtel on September 21, 2015

Please read the documentation for the xTaskResumeFromISR() as it tells you two things:

1) Don't use the function to synchornise a task with an interrupt - it is dangerous and can lead to missed interrupts as it does not latch interrupts (like a semphore or task notification would). That might be what your problem is.

2) Use the function's return value to know if a context switch is required:

xYieldRequired = xTaskResumeFromISR( handle );
portYIELDFROMISR( xYieldRequired );


Resuming task from interrupt delay problem

Posted by inimicus8 on September 21, 2015

Yep that fixed it!!

I had totally missed that the “portYIELDFROMISR” function existed. Thank you very much for a fast reply :)


Resuming task from interrupt delay problem

Posted by alainm3 on September 21, 2015

Buy the book, it will save you days of fiddling around !!!

Alain

Em 21-09-2015 09:50, Jimmie Hansson escreveu: > > Yep that fixed it!! > > I had totally missed that the “portYIELDFROMISR” function existed. > Thank you very much for a fast reply > :) > > ------------------------------------------------------------------------ > > Resuming task from interrupt delay problem > https://sourceforge.net/p/freertos/discussion/382005/thread/842d6424/?limit=250#941c > > ------------------------------------------------------------------------ > > Sent from sourceforge.net because you indicated interest in > https://sourceforge.net/p/freertos/discussion/382005/ > > To unsubscribe from further messages, please visit > https://sourceforge.net/auth/subscriptions/ >


[ 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