app_timer2.c - RTC2

Nordic Team,

I have a question regarding RTC1 with regards to app_timer2.c

My Setup:
nRF52833 - PCA10100 Development Board
nRF SDK v17.1.0
s140_nrf52_7.2.0 

What am I trying to achieve?
Get both UARTs on the nRF52833 working using libuarte . I did get this successfully working, I took the libuarte example for the PCA10056 and made an example for PCA10100. Then I added the second libuarte . Ultimately, I will add BLE peripheral mode to this product which is why I am also using Softdevice S140 v7.2.0.

What does the configuration look like?
I configured both LibUARTe configurations as follows:

NRF_LIBUARTE_ASYNC_DEFINE(libuarte_0, 0, 0, 0, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3);
NRF_LIBUARTE_ASYNC_DEFINE(libuarte_1, 1, 1, 1, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3);

This configuration means the following:

libuarte 0: Uses Timer 0 for byte counting and RTC0 for timeouts. 
libuarte 1: Uses Timer 1 for byte counting and RTC1 for timeouts. 

However, I had to modify the SDK, specifically, app_timer2.c to utilize RTC2 instead of RTC1. Currently, app_timer2.c (on line 75) sets the RTC driver instance ( DRV_RTC_INSTANCE() ) to one and is non-configurable. This forces the user to also define APP_TIMER_V2_RTC1_ENABLED as a C define.

Leaving app_timer2.c as is will result in a compiler error regarding a double definition of RTC1_IRQHandler. This is because both nrfx_rtc.c and drv_rtc.c both define it. 

To force app_timer2.c to only utilize RTC one seems unnecessary? This was brought up in a separate post but looks like it was not resolved: devzone.nordicsemi.com/.../enable-the-use-of-rtc0-rtc1-or-rtc2-in-app_timer2

Follow up questions:

  1. Are there any concerns or consequences with changing app_timer2.c to use RTC2 instead of RTC1? i.e. Is there a use case or reason to make app_timer2.c setup this way?
  2. I'd rather not change the SDK but I also know that Nordic has now moved to NCS which means there won't be a new nRF SDK with this problem addressed. That being said, should I leave app_timer2.c on RTC1 and have libuarte one use RTC2 instead?

I am looking forward to hearing your thoughts and input. Please let me know if you need more information from me. 

Thanks,

Sam

  • Hi Sam

    In the post you linked to we have a link to an internal ticket which unfortunately still has not been resolved, so I have pinged that ticket. It has indeed been implemented incorrectly in the driver.

    1. There should not be an issue changing the RTC instance in app_timer2.c.

    2. If you don't want to change the SDK I would indeed recommend leaving RTC1 for app_timer2.c and change your libuarte to use RTC2 instead. My guess is that this is the easiest change to make as well, since I guess you're most familiar with the libuarte usage you've implemented yourself.

    Best regards,

    Simon

  • Hi Simon,

    Thank you for the prompt response.

    I'm ok with leaving libuarte to use RTC2 in order to avoid modifying the SDK. I have a good understanding of libuarte at this point anyways. At least I know that if I do have to change app_timer2.c, that there aren't any concerns. 

    If the ticket you pinged does get addressed internally what will that mean? I assume Nordic won't release a revised SDK?

    Thanks,

    Sam

  • That means there will be an internal discussion on whether we should add it to an upcoming revision of an SDK if we are to release one.

    Best regards,

    Simon

Related