This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

FREERTOS timer on NRF52833 doesn't work.

Hello Everyone,

                     I am using NRF52833 in my project. My code is FREERTOS based. I am also using 2 UART, one is normal uart and other is LIBUARTE. I have also initialised timers in my tasks to perform some operations at regular intervals. My timers are not working.

The code for timers is as follows:- 

#define QUEUE_LENGTH    10
#define ITEM_SIZE       sizeof( let_btn_task_evt_t )

/* The variable used to hold the queue's data structure. */
static StaticQueue_t xStaticQueue;

/* The array to use as the queue's storage area.  This must be at least
uxQueueLength * uxItemSize bytes. */
uint8_t led_queue_storage_area[ QUEUE_LENGTH * ITEM_SIZE ];


volatile TaskHandle_t led_task_handle = NULL;


static TimerHandle_t button_timer_handle;
static StaticTimer_t button_timer;

static TimerHandle_t red_led_timer_handle;
static StaticTimer_t red_led_timer;

static TimerHandle_t grn_led_timer_handle;
static StaticTimer_t grn_led_timer;


err_rc_t init_led_button_task(void)
{
    err_rc_t rc = RESULT_SUCCESS;

    do {
        /* Start the two tasks as described in the comments at the top of this
        file. */
        led_task_handle = xTaskCreateStatic(
                              led_button_task,       /* Function that implements the task. */
                              "LEDBTN",          /* Text name for the task. */
                              LED_BUTTON_TASK_STACK_SIZE,      /* Number of indexes in the led_button_stack array. */
                              ( void * ) 1,    /* Parameter passed into the task. */
                              LED_TASK_PRIORITY,/* Priority at which the task is created. */
                              led_button_stack,          /* Array to use as the task's stack. */
                              &task_led_button_tcb );  /* Variable to hold the task's data structure. */

        if(led_task_handle == NULL) {
            rc = RESULT_ERROR_FAILURE;
            break;
        }

        /* Create a queue capable of containing 10 uint64_t values. */
        led_button_queue_handle = xQueueCreateStatic( QUEUE_LENGTH,
                                  ITEM_SIZE,
                                  led_queue_storage_area,
                                  &xStaticQueue );

        if(led_button_queue_handle == NULL) {
            rc = RESULT_ERROR_FAILURE;
            break;
        }

        button_timer_handle = xTimerCreateStatic("ButtonTimer",
                              100,
                              pdTRUE,
                              ( void * ) 0,
                              button_timer_callback,
                              &button_timer);

        if( button_timer_handle == NULL ) {
            /* The timer was not created */
            rc = RESULT_ERROR_FAILURE;
            break;
        }


        red_led_timer_handle = xTimerCreateStatic("RedTmr",
                               1000,
                               pdFALSE,
                               ( void * ) 0,
                               red_timer_callback, //**
                               &red_led_timer);

        if( red_led_timer_handle == NULL ) {
            /* The timer was not created */
            rc = RESULT_ERROR_FAILURE;
            break;
        }

        grn_led_timer_handle = xTimerCreateStatic("GrnTmr",
                               1000,
                               pdFALSE,
                               ( void * ) 0,
                               grn_timer_callback,
                               &grn_led_timer);

        if( grn_led_timer_handle == NULL ) {
            /* The timer was not created */
            rc = RESULT_ERROR_FAILURE;
            break;
        }


    } while(0);

    return rc;
}



void grn_timer_callback( TimerHandle_t xTimer )
{
    let_btn_task_evt_t evt;
    evt.id = LED_TASK_EVT_PROCESS_LED_RC1;

    led_btn_task_queue_event(evt);
}
void red_timer_callback( TimerHandle_t xTimer )
{
    let_btn_task_evt_t evt;
    evt.id = LED_TASK_EVT_PROCESS_LED_RC2;

    led_btn_task_queue_event(evt);
}
void button_timer_callback( TimerHandle_t xTimer )
{
    button_manager_timer_handle();
}

My doubt is that LIBUARTE settings is causing some issue. I am not sure about it. Just guessing. I have also attached sdk_config.h. 

Please help me solve this issue.

6355.sdk_config.h

Related