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

Usage of xTaskNotify/xTaskNotifyWait.

Posted by andy-pevy on March 29, 2017

Hi, I am using xTaskNotify and xTaskNotifyWait to signal interrupt status between an int handler and the supporting task.

Very occasionally I am loosing indications and I'd just like to clarify my understanding of how the pair work together.

I receive data and therefore interrupts asynchronously and it is possible that I am still procesing a previous message and I get another indication informing me of new data being received.

So, my question is that if a new indication arrives while I am 'Busy', when I enter the xTaskNotifyWait routine, will it return immediately because of the existing indication, or will it wait until the next indication arrives thus ignoring the one that it already has ?.

Thanks, Andy Pevy


Usage of xTaskNotify/xTaskNotifyWait.

Posted by rtel on March 29, 2017

If you call a function to wait for a notification, but a notification is already pending, then you won't wait at all, but just return immediately.

xTaskNotify() is not an ISR safe function - is this just an error in your post, or are you actually using that function in an ISR?

Also, if you are using notifications from an interrupt, be sure to use them in their 'counting' form, rather than binary form. See the chapter on task notifications in the following book for more information: http://www.freertos.org/Documentation/RTOS_book.html


Usage of xTaskNotify/xTaskNotifyWait.

Posted by andy-pevy on March 30, 2017

Hi, I am using the HAL callback code so the interrupt domain appears to be lost, so I am really using xTaskNotify.

I am however passing 2 bits of information in the notification, I.E. Which H/W interrupt has triggered the event and an ID of a buffer that is currently being processed. If I have to use the counting notification I loose the ability to do this.

It looks like I am going to have to use a normal quere mechanism to achieve what I need.

Unless there is another way...

Andy


Usage of xTaskNotify/xTaskNotifyWait.

Posted by rtel on March 30, 2017

Hi, I am using the HAL callback code so the interrupt domain appears to be lost, so I am really using xTaskNotify.

Are you 100% sure the callback is not being called by an interrupt? Do you have configASSERT() defined? http://www.freertos.org/a00110.html#configASSERT

I am however passing 2 bits of information in the notification, I.E. Which H/W interrupt has triggered the event and an ID of a buffer that is currently being processed. If I have to use the counting notification I loose the ability to do this.

It looks like I am going to have to use a normal quere mechanism to achieve what I need.

Unless there is another way...

We often use a thread safe circular buffer to 'push' information about an interrupt into a buffer, then use the task notification to wake a task...which then reads the information from the buffer. This will become part of the FreeRTOS feature set as soon as we get time to tidy it up and fully test it - but you could rig up something similar easily enough.


[ 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