Zephyr NCS 2.0.2 UARTE - TX works, RX does not

Im struggling here with porting my code from SDK15 to NCS 2.0.2

Im happily TXing data from NRF52811 via UARTE and receiving via FTDI to PC, but Im unable to receive any data to the uC. I have tried both - the event based initialization of the uart and non-event based, but in both cases I can see the data being transmitted from PC to uC (uing Saleae) with correct voltage levels etc, but the data are never received by the uC. The pins are correct (I can see that they are correct by testing TX on the RX pin). The config of the line follows: 

CONFIG_LOG=y
CONFIG_SERIAL=y
CONFIG_LOG_PRINTK=y
CONFIG_PRINTK=y
CONFIG_UART_CONSOLE=n
CONFIG_USE_SEGGER_RTT=y
CONFIG_CONSOLE=y
CONFIG_RTT_CONSOLE=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_CBPRINTF_FP_SUPPORT=y

CONFIG_LOG_MODE_IMMEDIATE=y

# CONFIG_LOG_MODE_DEFERRED=y
# CONFIG_LOG_MODE_OVERFLOW=y

CONFIG_NRFX_GPIOTE=y
CONFIG_NRFX_UARTE0=y
CONFIG_NRFX_TWIM0=y
CONFIG_NRFX_SPIM0=y

#CONFIG_UART_INTERRUPT_DRIVEN=y

static void uarte_evt_handler(nrfx_uarte_event_t const * p_event,
                              void *                     p_context) {
    nrf_gpio_pin_toggle(LED_PIN);
    LOG_INF("uarte_evt_handler");
    if (p_event->type == NRFX_UARTE_EVT_TX_DONE) {
      LOG_INF("NRFX_UARTE_EVT_TX_DONE");
    } else if (p_event->type == NRFX_UARTE_EVT_RX_DONE) {
      while (1) {
        LOG_INF("NRFX_UARTE_EVT_RX_DONE");
      }
    } else if (p_event->type == NRFX_UARTE_EVT_ERROR) {
      LOG_ERR("NRFX_UARTE_EVT_ERROR");
    }
}

main() {  
  IRQ_CONNECT(DT_IRQN(DT_NODELABEL(uart0)), DT_IRQ(DT_NODELABEL(uart0), priority), nrfx_isr, nrfx_uarte_0_irq_handler, 0);
...
  static nrfx_uarte_t uarte_instance = NRFX_UARTE_INSTANCE(0);
  nrfx_uarte_config_t uarte_config = NRFX_UARTE_DEFAULT_CONFIG(UART_TX_PIN, UART_RX_PIN);
  uarte_config.baudrate = NRF_UARTE_BAUDRATE_38400;
...
  while(1) {
  k_sleep(K_SECONDS(1));
  retcode = nrfx_uarte_tx(&uarte_instance, (uint8_t *)tx_data_ok, sizeof(tx_data_ok));
   if (nrfx_uarte_rx_ready(&uarte_instance)) {
      while (1) {
        LOG_WRN("Getting byte waiting in UART RX buffer");
      }
...

I will never get to the "Getting byte waiting..." part. This is a example of the blocking code; in event based code I simply replace the callback with NULL in

nrfx_uarte_init() and uncomment CONFIG_UART_INTERRUPT_DRIVEN. The uarte_evt_handler() is never called in non-blocking code.

So to summarize - the above code TXses data every second, but never seems to receive any data from the RX pin. Physical connection is OK. I have tested this on two different boards with the same result. Sending data to the line using Python3 from Windows.

Any pointer to how to debug this appreciated. I might be missing something obvious here, but also not totally ruling out damaged pin.

Parents Reply Children
Related