Hello, I am currently working on a nr52840 s140 Sdk 17.0 (dev kit) and am using the peripheral/uart example code.
The UART TX & RX works perfectly when connecting to a TTL to USB converter with my PC. However, when I try to connect nr52840 with an LTE modem (dev kit), I can see TX transmitted from the uart_event_handler (APP_UART_TX_EMPTY) but the UART RX never receives any message from the modem.
Here are some more experiments I conducted.
1. Use TTL to USB converter and the modem --> both TX and RX works perfectly.
2. Use a different mcu to communicate with the modem --> both TX and RX works perfectly.
Based on these two experiments, it looks like somehow nordic fails to receive RX messages due to some wrong configuration.
Is there any suggestion on this issue?
Thank you!
code for initializing UART
uint32_t err_code;
const app_uart_comm_params_t comm_params =
{
RX_PIN_NUMBER,
TX_PIN_NUMBER,
RTS_PIN_NUMBER,
CTS_PIN_NUMBER,
APP_UART_FLOW_CONTROL_DISABLED,
false,
#if defined (UART_PRESENT)
NRF_UART_BAUDRATE_115200
#else
NRF_UARTE_BAUDRATE_115200
#endif
};
APP_UART_FIFO_INIT(&comm_params,
UART_RX_BUF_SIZE,
UART_TX_BUF_SIZE,
demo_uart_event_handler,
APP_IRQ_PRIORITY_LOWEST ,
err_code);
code for transmitting UART
uint8_t * tx_data = (uint8_t *)("AT\r\n");
for (uint32_t i = 0; i < strlen((char *)tx_data); i++){
app_uart_put(tx_data[i]);
}
code for event handler
static void demo_uart_event_handler(app_uart_evt_t * p_event)
{
if (p_event->evt_type == APP_UART_COMMUNICATION_ERROR){
APP_ERROR_HANDLER(p_event->data.error_communication);
}
else if (p_event->evt_type == APP_UART_FIFO_ERROR){
APP_ERROR_HANDLER(p_event->data.error_code);
}
else{
if(p_event->evt_type == APP_UART_DATA){
uint8_t rx;
app_uart_get(&rx);
push_to_rx_buffer(rx);
}
SEGGER_RTT_printf(0, "p_event->evt_type = %d\n", p_event->evt_type);
}
}