Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

RTC for FreeRTOS in BLE + Zigbee + FreeRTOS application that uses nrf_serial.c

Hello Nordic Team,

I have a question regarding usage of RTC. My application is based on nrf52840 and uses BLE + Zigbee  + FreeRTOS. From this page: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_tz_v4.2.0%2Fthread_zigbee__intro.html, I understand that RTC0 is used by SoftDevice and RTC2 is used by for sleep through radio driver API. 

So, this leaves RTC1 free but my application uses nrf_serial.c which in turn uses RTC1 for app timer.

Since I need to use a tick source for FreeRTOS, I would like to check if I can use RTC2 as it is used during sleep but my application does not go into sleep mode at all. If yes, can you please let me know points to keep in mind for using RTC2 as FreeRTOS tick source?

Thanks,

Anusha

Parents
  • Hi,

    It would not be trivial to use RTC2 for FreeRTOS along with Zigbee. Although you do not use the sleep APIs, the RTC interrupt handler for RTC2 is compiled into the Zigbee/IEEE 802.15.4 Radio Driver libraries. If you try to use RTC2 in your application, you would get multiple definition error from the IRQ Handler. It might be possible to remove the RTC2 functionality from the libraries, but this have not been tested and might cause other issues.

    A better alternative might be to switch from using nrf_serial to use libUARTE for the UART handling. libUARTE supports using TIMERs for timeout and RX byte counting, freeing up the RTC1 instance for use with FreeRTOS. nrf_serial have been deprecated and removed in nRF5 SDK v17.x.0, as it had some issues. libUARTE have much more test coverage and some additional nice advanced features.

    Best regards,
    Jørgen

  • Hi Jorgen,

    Thanks for clarifying this.

    Regards,

    Anusha

Reply Children
No Data
Related