Hello,
I'm using FreeRTOS on nRF51 and I would like to use task notifications instead of semaphore to simply manage task's syncronization.
To test its operation mode, I implemented the simple example shown at www.freertos.org/xTaskNotifyGive.html.
Unfortunately, it seems not working. Could somebody help me to understand why it is not working?
Thanks in advance.
EDIT:
I'm still having this problem. This is my code, Can somebody help me???
#include <stdbool.h>
#include <stdint.h>
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "semphr.h"
#include "bsp.h"
#include "nordic_common.h"
#include "nrf_gpio.h"
#include "nrf_drv_clock.h"
#include "sdk_errors.h"
#include "app_error.h"
#include "nrf_delay.h"
#include "SEGGER_RTT.h"
#define TASK_DELAY_Red 1000
//#define TIMER_PERIOD_Red 700
// Task Handles
TaskHandle_t xTask_1 = NULL;
TaskHandle_t xTask_2 = NULL;
static void vTask_1 (void *pvParameter);
static void vTask_2 (void *pvParameter);
static void vTask_1 (void *pvParameter)
{
//UNUSED_PARAMETER(pvParameter);
for( ;; )
{
SEGGER_RTT_printf(0,"Inside vTask_1, notification to vTask_2\r\n");
xTaskNotifyGive( vTask_2 );
SEGGER_RTT_printf(0,"Inside vTask_1, waiting the notification from vTask_2\r\n");
ulTaskNotifyTake( pdFALSE, 3000 );
}
}
static void vTask_2 (void *pvParameter)
{
//UNUSED_PARAMETER(pvParameter);
for( ;; )
{
SEGGER_RTT_printf(0,"Inside vTask_2, waiting the notification from vTask_1\r\n");
ulTaskNotifyTake( pdFALSE, 3000 );
SEGGER_RTT_printf(0,"Inside vTask_2, notification to vTask_1\r\n");
xTaskNotifyGive( vTask_1 );
}
}
int main(void)
{
xTaskCreate( vTask_1, "T1", configMINIMAL_STACK_SIZE + 200, NULL, 1, &xTask_1 );
xTaskCreate( vTask_2, "T2", configMINIMAL_STACK_SIZE + 200, NULL, 1, &xTask_2 );
vTaskStartScheduler();
while (true)
{
}
}