This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

UART Break condition

Hello,

I found some some threads on similar questions but none answered mine, so here it is:

I try to use UART between nrf52840 and another chip. When the other chip resets the RX line goes low and I get a drive error callback. I have two questions: 

1. Is it possible to configure the RX pin as pullup in order to avoid going low when second chip resets

2. How do I recover from this error. None worked so far. 

I attached the relevant code (SDK 15.3)

NRF_SERIAL_DRV_UART_CONFIG_DEF(m_uarte0_drv_config,
    NRF_GPIO_PIN_MAP(0, 24), NRF_GPIO_PIN_MAP(0, 22),
    RTS_PIN_NUMBER, CTS_PIN_NUMBER,
    NRF_UART_HWFC_DISABLED, NRF_UART_PARITY_EXCLUDED,
    NRF_UART_BAUDRATE_38400,
    UART_DEFAULT_CONFIG_IRQ_PRIORITY);

#define SERIAL_FIFO_TX_SIZE 1024
#define SERIAL_FIFO_RX_SIZE 1024

NRF_SERIAL_QUEUES_DEF(serial0_queues, SERIAL_FIFO_TX_SIZE, SERIAL_FIFO_RX_SIZE);

#define SERIAL_BUFF_TX_SIZE 1
#define SERIAL_BUFF_RX_SIZE 1

NRF_SERIAL_BUFFERS_DEF(serial0_buffs, SERIAL_BUFF_TX_SIZE, SERIAL_BUFF_RX_SIZE);

void My_cdc_acm_user_ev_handler(app_usbd_class_inst_t const *p_inst,
    nrfx_uarte_event_t event);

NRF_SERIAL_CONFIG_DEF(serial0_config, NRF_SERIAL_MODE_DMA,
    &serial0_queues, &serial0_buffs, My_cdc_acm_user_ev_handler_E10, sleep_handler);
    
NRF_SERIAL_UART_DEF(serial0_uarte, 0);

void My_cdc_acm_user_ev_handler(app_usbd_class_inst_t const *p_inst,
    nrfx_uarte_event_t event) 
{
  uint32_t error;   ret_code_t ret;
  switch (event.type) 
  {
    case NRF_SERIAL_EVENT_DRV_ERR:
        NRF_LOG_INFO("DRIVE ERROR E10!!!");
        if(NRF_UART0->EVENTS_ERROR !=0)
        {
            error = NRF_UART0->ERRORSRC;
            NRF_LOG_INFO("Serial driver err: %d", error);
            NRF_UART0->EVENTS_ERROR = 0;
        }
        nrf_serial_uninit(&serial0_uarte);
        ret = nrf_serial_init(&serial0_uarte, &m_uarte0_drv_config, &serial0_config);
        break;
  }
}

//somewhere while init:

ret = nrf_serial_init(&serial0_uarte, &m_uarte0_drv_config, &serial0_config);

  • Hello,

    1. Yes, you can enable the pull-up on the RX input. Recommend doing doing it after nrf_serial_init() in case the pull-configuration is overriden by the driver. Eg., call  NRF_P0->CNF[pin_no] |= GPIO_PIN_CNF_PULL_Msk; after serial init.

    2. The trick to this as I recall it is to re-initialize nrf_serial. But I see you have implemented this already. Can you try to see if you still get this problem with pull up enabled?

    Best regards,

    Vidar

Related