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

FreeRTOS - Events, timer and tasks stop coming after a few minute

Environment
- nrf52832
- SDK 15.3

- SD 6.1.1
- with FreeRTOS

- Project: ble_app_buttonless_dfu

I have project with 4 timers and 3 tasks. Everything works fine when I start program. But after a few minute, timer and tasks stop coming, BLE is off.

I can click pause and continue debug on Segger, PC pointer will run around in tasks.c. After that I see this error "SOFTDEVICE: ASSERTION FAILED".

Any idea where this might come from?

Thanks.

  • I have project with 4 timers and 3 tasks. Everything works fine when I start program. But after a few minute, timer and tasks stop coming, BLE is off.

     Seems like a deadlock. Hard to tell what caused it with the information given.

     

    I can click pause and continue debug on Segger, PC pointer will run around in tasks.c. After that I see this error "SOFTDEVICE: ASSERTION FAILED".

     You cannot halt a program which has enabled the softdevice and continue the execution without softdevice asserting. If you search this forum for "debug softdevice" or "softdevice assert when debugging" you will get many related threads on this behavior. For example this one.

  • I have 2 queues and 3 tasks as below.

    nus_queue = xQueueCreate(3, sizeof(nus_command_t));// 149 bytes *3
    pedo_queue = xQueueCreate(32, sizeof(accelVector_t));//4 bytes x, 4 bytes y, 4 bytes z , 4 bytes amplytude* 32 sample
    UNUSED_VARIABLE(xTaskCreate(bleCommandTask, "CMD", 256, NULL, 3, NULL));
    UNUSED_VARIABLE(xTaskCreate(blePedoSampleTask, "PedoSample", 256, NULL, 4, NULL));
    UNUSED_VARIABLE(xTaskCreate(timeTask, "TimeTASK", 256, NULL, 2, NULL));

    The issue happens after 5 mins. If I remove task "PedoSample", the issue will happen after a few hour.

    nus_queue = xQueueCreate(3, sizeof(nus_command_t));// 149 bytes *3
    //pedo_queue = xQueueCreate(32, sizeof(accelVector_t));//4 bytes x, 4 bytes y, 4 bytes z , 4 bytes amplytude* 32 sample
    UNUSED_VARIABLE(xTaskCreate(bleCommandTask, "CMD", 256, NULL, 3, NULL));
    //UNUSED_VARIABLE(xTaskCreate(blePedoSampleTask, "PedoSample", 256, NULL, 4, NULL));
    UNUSED_VARIABLE(xTaskCreate(timeTask, "TimeTASK", 256, NULL, 2, NULL));

  • BangNquyen,

    BangNguyen said:
    The issue happens after 5 mins. If I remove task "PedoSample", the issue will happen after a few hour.

    it seems very likely that there is an issue with the priorities of your tasks and how/when they communicate. It is still very hard for anyone to narrow down the problem. 

    I suggest you revisit your Tasks architecture and how they communicate and see if there is a need of any critical sections for the inter task communication variables you use.

  • I'm trying to add semaphore. It looks good now. Will share with you late.

Related