This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SoftBlinking LED | Scheduler | SDK14

Hello guys!

I'm trying to get softblinking led work with a SDK14. The code works perfectly fine in one of my projects that use scheduler and SDK13.

But in SDK14, (only!) when I initialize softblinking, I get an NRF_ERROR_INVALID_LENGTH error on line 385 of app_timer.c

        uint32_t err_code = app_sched_event_put(&timer_event, sizeof(timer_event), timeout_handler_scheduled_exec);
        APP_ERROR_CHECK(err_code);

I'm missing something or I'm doing something wrong with a new SDK14?

Parents
  • Hi,

    You will get an NRF_ERROR_INVALID_LENGTH from app_sched_event_put() when you are exceeding the maximum event size that the scheduler queue is initialized for. Make sure that you initialize the scheduler with a big enough max event size.

    #define SCHED_MAX_EVENT_DATA_SIZE        MAX(APP_TIMER_SCHED_EVENT_DATA_SIZE, \
                                                 BLE_STACK_HANDLER_SCHED_EVT_SIZE)       /**< Maximum size of scheduler events. */
    
    /**@brief Function for the Event Scheduler initialization.
     */
    static void scheduler_init(void)
    {
        APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE);
    }
    
Reply
  • Hi,

    You will get an NRF_ERROR_INVALID_LENGTH from app_sched_event_put() when you are exceeding the maximum event size that the scheduler queue is initialized for. Make sure that you initialize the scheduler with a big enough max event size.

    #define SCHED_MAX_EVENT_DATA_SIZE        MAX(APP_TIMER_SCHED_EVENT_DATA_SIZE, \
                                                 BLE_STACK_HANDLER_SCHED_EVT_SIZE)       /**< Maximum size of scheduler events. */
    
    /**@brief Function for the Event Scheduler initialization.
     */
    static void scheduler_init(void)
    {
        APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE);
    }
    
Children
No Data
Related