I am currently making a program that will interpret serial commands from UARTE1 and then send + read something from the other (UARTE0). Previously, when I have been using a single UARTE I have had no problem setting up an app_timer and waiting for it to expire while waiting for a full "message" from the UARTE (indicated by a newline).
static ret_code_t myTimerTimeoutSetup(uint32_t timeout_ms, my_timer_timeout_t* p_tout_ctx) { uint32_t ticks = APP_TIMER_TICKS(timeout_ms); if (ticks < APP_TIMER_MIN_TIMEOUT_TICKS) { p_tout_ctx->expired = true; return NRF_SUCCESS; } ret_code_t ret = app_timer_create(&my_timer_id, APP_TIMER_MODE_SINGLE_SHOT, fc_adafruitFonaTimeoutHandler); APP_ERROR_CHECK(ret); // If the timer is failed to be created, return the error code if (ret != NRF_SUCCESS) { return ret; } return app_timer_start(my_timer_id, ticks, p_tout_ctx); }
much like is done in nrf_serial, I then have a statement such as: if (tout_ctx.expired) break; in my while loop to break when time is up.
Now that I am using both UARTEs, both of them freeze (when they should transmitting data) until the timer has expired, on which they will finish transmitting (nrf_serial_write). I have also had trouble with the timer never expiring if the interrupt priority is set to the default 6.
Is this an IRQ priority issue?
Thanks very much