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

libuarte_async idle detection using hardware timer and power consumption

Hardware: nRF52840 custom board

Software:

SDK: nRF5_SDK_17.0.2_d674dde

Using FreeRTOS where #define configTICK_SOURCE FREERTOS_USE_RTC  (Using RTC as systick)

2 UART's using libuart_async to achieve 921600 baud

RTC0: SoftDevice

RTC1: FreeRTOS Systick

RTC2: Time keeping counter (Overflow event tied to Hardware Timer 1 in counter mode for overflow count)

Timer0: SoftDevice

Timer1: Counts RTC2 overflows for time keeping purposes

Timer2: NRF_LIBUARTE_DRV_UARTE0

Timer3: NRF_LIBUARTE_DRV_UARTE1

Timer4: Not used

Hello,

From my understanding, I see that libuarte_async supports idle line detection using one of the following timers:

  • Hardware Timer
  • RTC
  • App timer

Question 1: If a hardware timer is used for timeout (idle line detection), is the timer always running or does it only run while data is being received and then stop when a timeout occurs? My concern here is that hardware timers use the HFCLK and I wouldn't want the HFCLK running when no UART data is being received.

Question 2: How do you recommend I configure my timers for lowest power consumption?

I don't have enough free timers (RTC or HW Timer). App timer is inefficient because it always triggers a timeout event at the configured interval regardless if RX data is being received.

Question 3: Is it possible to use the same RTC for FreeRTOS Systick and system time counting? I don't see why I can't free up RTC2 by counting the overflow events of RTC1 and share RTC1 with FreeRTOS. I don't want to interfere with the functions of tickless idle and such though so I am not sure this is possible? If possible, I can then use RTC2 for UARTE0 timeout and Timer4 for UARTE1 timeout.

Thanks,

Derek

Parents
  • Hey Torbjørn,

    Any updates?

    For some reason the forum won't let me reply inline to the previous replies so I am replying to the original post for an update.

    I have mostly resolved my issue. The modem I am using provides a RING GPIO interrupt than can be configured to alert the MCU when unsolicited responses are ready to be received over UART. I now just shutdown the UART using nrf_libuarte_async_uninit() and re-init using nrf_libuarte_async_init() and nrf_libuarte_async_enable() which seems to work well. Since the libuarte_async driver has a large enough buffer to not miss RX bytes at 921600 baud, I always call nrf_libuarte_async_rts_clear() after init as well and leave RTS asserted.

    It would still be nice to know if libuarte has some fancy power management stuff internally that puts the UART interface and timers in low power when it detects that CTS is asserted. I haven't dug into libuarte's internals enough to determine this but I am doubtful it does. I am using a second UART and libuarte as an inter-processor communications interface that would benefit from such functionality.

    Thanks,

    Derek

  • Hi Derek

    I got a hold of the developer, and he confirmed that there is no power management built into the driver unfortunately, but according to him it should be possible to add a wrapper around the library to implement something like this. 

    You might also consider the lpuart driver in NCS, which is a wrapper around the standard async UART interface that adds two flow control lines in order to optimize power consumption. 

    You can read more about this driver here.

    Best regards
    Torbjørn 

Reply
  • Hi Derek

    I got a hold of the developer, and he confirmed that there is no power management built into the driver unfortunately, but according to him it should be possible to add a wrapper around the library to implement something like this. 

    You might also consider the lpuart driver in NCS, which is a wrapper around the standard async UART interface that adds two flow control lines in order to optimize power consumption. 

    You can read more about this driver here.

    Best regards
    Torbjørn 

Children
Related