Hi,
We have developed a custom board using nrf52832 chip and currently everything like (BLE, TWI, ADC etc) is working fine but we are having issues with the UART. we have changed the RX and TX pins to following for custom board
UART_TX_PIN 9 UART_RX_PIN 8
and we are using app_uart.c
Pins are configured like this
// UART PINS nrf_gpio_pin_dir_set(UART_TX_PIN, NRF_GPIO_PIN_DIR_OUTPUT); nrf_gpio_pin_write(UART_TX_PIN, 0); nrf_gpio_pin_dir_set(UART_RX_PIN, NRF_GPIO_PIN_DIR_INPUT);
and the following code is used for the initialization of the UART
uint32_t err_code; // Initialize control variables in serial_library.c Init_Uid_Packet(); nrf_gpio_cfg_input(RX_PIN, NRF_GPIO_PIN_PULLUP); nrf_gpio_cfg_output(TX_PIN); APP_UART_FIFO_INIT(&comm_params, RX_BUF_SIZE, TX_BUF_SIZE, Uart_Evt_Callback, UART_IRQ_PRIORITY, err_code); APP_ERROR_CHECK(err_code);
it seems that the UART initializes correctly and when we try to send anything over UART there is no activity over the Uart_Evt_Callback(). I have listed the code of this below,
static void Uart_Evt_Callback(app_uart_evt_t * uart_evt) { char cr; switch (uart_evt->evt_type) { case APP_UART_DATA: //Step1: Data is ready on the UART while(app_uart_get(&cr) != NRF_SUCCESS); // Send each character to rfid reader submodule function //Step2: Passing byte to Rfid module Pass_String(cr); #if defined(DEBUG) SEGGER_RTT_printf(0, "One Char : %c \n",cr); #endif #if defined(TEST) app_sched_event_put(&cr, (sizeof(&cr) * 1), Uart_Evt_Callback_scheduler); #endif break; case APP_UART_DATA_READY: //Data is ready on the UART FIFO //Step1: Data is ready on the UART while(app_uart_get(&cr) != NRF_SUCCESS); // Send each character to rfid reader submodule function //Step2: Passing byte to Rfid module Pass_String(cr); #if defined(DEBUG) SEGGER_RTT_printf(0, "One Char : %c \n",cr); #endif #if defined(TEST) app_sched_event_put(&cr, (sizeof(&cr) * 1), Uart_Evt_Callback_scheduler); #endif break; case APP_UART_TX_EMPTY: //Data has been successfully transmitted on the UART #if defined(DEBUG) SEGGER_RTT_printf(0, "Data successfully sent on UART \n"); #endif break; case APP_UART_FIFO_ERROR: //An error in the FIFO module used by the app_uart module has occured #if defined(DEBUG) SEGGER_RTT_printf(0, "FIFO error \n"); #endif break; case APP_UART_COMMUNICATION_ERROR: // An communication error has occured during reception. #if defined(DEBUG) SEGGER_RTT_printf(0, "UART COMM Error \n"); #endif break; default: break; } }
I also have tested the UART pins by applying the saleae logic analyzer on the RX TX pins but there was no activity over the pins when I try to send/receive anything from there.
Please look into this issue I have debugged a lot by comparing the UART example too but did not found a solution.
Thanks,