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

what should be unblocked

Posted by ady001 on April 28, 2016

I understand that xTaskNotifyGive() can be used to unblock a task blocked by xTaskNotifyTake(). But should xTaskNotifyGive() also unblock a task if blocked by vTaskDelayUntil() ?

It seems to during testing, I assumed the xTaskNotifyGive() would only unblock the corresponding xTaskNotifyTake().

Thanks for a confirmation.


what should be unblocked

Posted by rtel on April 28, 2016

But should xTaskNotifyGive() also unblock a task if blocked by vTaskDelayUntil() ?

No - xTaskNotifyGive() will only unblock a task that is specifically waiting for a notification. xTaskAbortDelay() is the only API function that will unblock a task that called vTaskDelayUntil().

Regards.


what should be unblocked

Posted by ady001 on April 28, 2016

I've attached the source file, there isn't much of it - maybe you can take a look.

If I comment out xTaskNotifyGive() and xTaskNotifyTake() calls within the functions prvTask1() and prvTask2() my test LED ( CMP_ON ) flashes at 200ms rate as expected.

If the xTaskNotifyGive() and xTaskNotifyTake() calls are put in place ( as per the attached file ) the LED flashes at a very high rate as if the vTaskDelayUntil() function is falling through. I wouldn't expect these function to have any significant effect on the 200ms flash rate.

Where is my misunderstanding ?

I know there are much easiers ways to flash a LED !

Kind regards,

Attachments

NotificationTests.c (2704 bytes)

what should be unblocked

Posted by heinbali01 on April 29, 2016

I modified your program:

~~~~ /* Let the delays last 2 seconds. */

define NOTIFICATIONTASKPERIOD pdMSTOTICKS( 2000 )

~~~~

and added some logging:

~~~~ 48.528 [ Task-2 ] Take 48.529 [ Task-1 ] Give 48.529 [ Task-1 ] Take 48.529 [ Task-2 ] Give 48.530 [ Task-2 ] Delay 48.530 [ Task-1 ] Delay

50.528 [ Task-2 ] Take
50.529 [ Task-1 ] Give
50.529 [ Task-1 ] Take
50.530 [ Task-2 ] Give
50.530 [ Task-2 ] Delay
50.530 [ Task-1 ] Delay

52.528 [ Task-2 ] Take
52.529 [ Task-1 ] Give
52.529 [ Task-1 ] Take
52.530 [ Task-2 ] Give
52.530 [ Task-2 ] Delay
52.530 [ Task-1 ] Delay

~~~~

For me itruns fine as it is.

The delays will always last 2 seconds and (indeed) they have nothing to do with the TaskNotify calls.

Note that your code has a potential problem:

task-1 will start running first.When it uses the variable 'xTask2', is task-2 already started? Otherwise I wouldn't know a reason.


what should be unblocked

Posted by ady001 on April 29, 2016

Thanks for the log, I think I understand my oversight now.

The effect of the TaskNotify calls is to 'synchronize' the two functions. This meant that the tasks were still executing every 200ms but my LED appeared to stop flashing because the two tasks calls were now in immediate succession due o the 'synchronization'. Whilst the tasks become synchromized one of the tasks must have been blocked for >200ms whilst waiting on the Notify.

Does this sound right ?


what should be unblocked

Posted by heinbali01 on April 29, 2016

Sounds right.

Do you have a second LED for testing? If so, you might assign a LED to each of the tasks and toggle it after every delay. Andif not: assign the LED to task-1 only and have it toggle the LED after every delay.

Regards.


[ 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