Hello,
I intend to use libuarte under FreeRTOS together with the SoftDevice (SDK 17.1.0). An app_timer is used for the RX timeout. I think there might be an incompatibility problem between app_timer and app_timer_freertos.
My application initializes the libuarte as follows:
The macro NRF_LIBUARTE_ASYNC_DEFINE creates xLibUarteCOM0 as follows:
with p_app_timer_t being a pointer to (a pointer to) a variable of type app_timer_t:
The structure is then initialized by the macro as:
In the FreeRTOS version of app_timer_create() called from nrf_libuarte_async_init(), xLibUarteCOM0_app_timer_data gets overlaid by a different structure. It is recasted to app_timer_info_t:
Without further initialization of the structure, app_timer_create() then checks the value of pinfo->active and fails with NRF_ERROR_INVALID_STATE if true.
The pinfo->active variable, however, is part of the pre-initialized 64-bit end_val and has the value 0xff which evaluates to true (!= 0). Hence, the initialization fails.
A possible work-around (although not very clean) is to initialize end_val with 0:
Does my analysis sound corrected or is there a another issue somewhere?
Thanks,
Norbert