FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [March 2017 Threads] 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.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|