Hello,
I want to use libuarte - advanced UARTE driver in our current application developed for nRF52832 with SDK 17.0.2.
My aim is to merge example libuarte and ble_app_beacon .
Because in my application I am receiving 48bytes of sensor data from uart and want to beaconing 4 bytes of data by processing those datas.
Given that fact that SoftDevice requires RTC0 and Timer0 and app_timer library consumes RTC1, I used RTC2 and Timer2 for libuarte implementation:
NRF_LIBUARTE_ASYNC_DEFINE(libuarte, 0, 2, 2, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3);
I followed this ticket https://devzone.nordicsemi.com/f/nordic-q-a/41215/general-libuarte-questions and my project successfully built but problem comes in execution time .
After receiving some bytes program goes to in fatal error . I can't find out what is the issue ?
Here is snippet of my libuarte code .
void uart_event_handler(void * context, nrf_libuarte_async_evt_t * p_evt)
{
nrf_libuarte_async_t * p_libuarte = (nrf_libuarte_async_t *)context;
ret_code_t ret;
switch (p_evt->type)
{
case NRF_LIBUARTE_ASYNC_EVT_ERROR:
bsp_board_led_invert(0);
break;
case NRF_LIBUARTE_ASYNC_EVT_RX_DATA:
memcpy(rx_buffer,p_evt->data.rxtx.p_data,p_evt->data.rxtx.length);
nrf_libuarte_async_rx_free(p_libuarte, p_evt->data.rxtx.p_data, p_evt->data.rxtx.length);
break;
default:
break;
}
}
void uart_init()
{
uint32_t err_code;
nrf_libuarte_async_config_t nrf_libuarte_async_config = {
.tx_pin = TX_PIN_NUMBER,
.rx_pin = RX_PIN_NUMBER,
.baudrate = NRF_UARTE_BAUDRATE_19200,
.parity = NRF_UARTE_PARITY_EXCLUDED,
.hwfc = NRF_UARTE_HWFC_DISABLED,
.timeout_us = 100,
.int_prio = APP_IRQ_PRIORITY_LOW
};
err_code = nrf_libuarte_async_init(&libuarte, &nrf_libuarte_async_config, uart_event_handler, (void *)&libuarte);
APP_ERROR_CHECK(err_code);
nrf_libuarte_async_enable(&libuarte);
}
Thanks in advance for your time and efforts.
Ram