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

led softblink example with freertos rtc

Hi Nordic,

Hardware: custom nrf52840

sw: nRF5_SDK_15.2.0_9412b96

Target example code: blinky_rtc_freertos + led_softblink

Problem faced: I want to integrate this 2 code together and require rtc for freertos tickless idle feature but the softblink example have conflict app_timer_init() between app_timer.c and app_timer_freertos.c . I hope to get solutions on how to make the sofblink code working in rtc freertos environment.

Parents
  • Ideally, you need to delete app_timer.c file from your project.

    You only should be using app_timer_freertos.c only. Both of them are API compatible, so you should not have problems removing app_timer.c from your project and soft_blink example will then use app_timer_freertos API correctly

  • Hi There,

    I have attached my example, what I did is tried to use the softblink main.c directly on the Blink RTC FreeRTOS example, mind help me review is what I have broken? Thanks.

    blinky_rtc_freertos.zip

  • Thanks Susheel Nuguru, I tested the solutions on my DK board. The led blink too fast(don't looks like a softblink) and it will stop blinking intermittently before it start blink again. Was it related to the FreeRTOS timer conflict with the softblink? Do you know whereI could look into? What are the main difference between non freertos vs freertos app timer? Is the nordic softbolink mechanism based on different rtc timer from freertos?

    I tried use debug-break during the part when the led stop blinking and it stopped at the below code (port_cmsis_systick.c), tickless idle seem to interfere with the softblink feature.

  • inghowe83 said:
    What are the main difference between non freertos vs freertos app timer?

     This is a good question.The app_timer_freertos and app_timer does not exactly behave similar.

    The timers scheduling mechanism is completely different and the way they are queued and their linked list nature is completely different. But I am very surprised by the difference in behavior here. I did not expect them to show this big different. But there seems to be a huge difference. 

    In FreeRTOS it is not possible to restart an already running timer (without stopping and restarting) but in app_timer we can do that easily. This difference could be explain a bit of this weird behavior.

  • Hi

    Thanks for your input. I still very new to softdevice and FreeRTOS, the pain part is our customer needs FreeRTOS while supporting softdevices api. Do nordic have any other solutions to make softblink workable under freertos rtc environment?

  • There is no problem using freeRTOS + softdevice. I think the problem for you is to use simulated PWM using app_timer. 

    You need to use real PWM instead of a simulated one to solve . I have edited your example to use PWM instead of app_timer and i can see the softblink now. If you want to understand how PWM works, I would recommend you to read its spec from the product specification.

    blinky_PWM_freertos.rar

  • Thank you

    May I know which is the parameters to affect the blink interval and pwm freq in this sample code?

    Thanks

Reply Children
Related