Hello,
While building a custom board, I need 52832 to communicate with a modem at regular intervals, send AT commands and read modem responses. nrf_serial library in IRQ mode seems like a good choice, since it can put CPU to sleep while waiting for the response, and also support Rx timeouts.
Although nrf_serial_read() works as expected when called from the main thread, calls from APP_TIMER never return. It seems that:
1. nrf_serial_read() busy-waits and never goes to sleep,
2. serial_timeout_handler() never fires so nrf_serial_read() keeps busy waiting.
Playing with priorities didn't help much.
I am using SDK 15.2 with softdevice enabled.
Below you can find how to reproduce the problem, can you please assist?
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "nrf_serial.h"
#include "nrf_pwr_mgmt.h"
#include "app_timer.h"
void test_serial_evt_handler(struct nrf_serial_s const *p_serial, nrf_serial_event_t event);
void test_idle_state_handle(void);
NRF_SERIAL_DRV_UART_CONFIG_DEF(test_uart0_drv_config,
8, 6, 0, 0,
NRF_UART_HWFC_DISABLED, NRF_UART_PARITY_EXCLUDED,
NRF_UART_BAUDRATE_115200, 5/*UART_DEFAULT_CONFIG_IRQ_PRIORITY*/);
NRF_SERIAL_QUEUES_DEF(test_serial_queues, 128, 128);
NRF_SERIAL_BUFFERS_DEF(test_serial_buffs, 8, 1);
NRF_SERIAL_CONFIG_DEF(test_serial_config, NRF_SERIAL_MODE_IRQ,
&test_serial_queues, &test_serial_buffs, test_serial_evt_handler, test_idle_state_handle);
NRF_SERIAL_UART_DEF(test_serial_uart, 0);
APP_TIMER_DEF(test_Tx_timer_id);
Thanks,
Thanos