This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

NRF_SERIAL_EVENT_DRV_ERR on initialization

Using SDK15.3 on 52840.  I've got a UART set up talking to something at 9600 baud..

The short course here is that imediately after init, I get an IRQ with a NRF_SERIAL_EVENT_DRV_ERR.  I can send things on the UART but it's not seeing things coming in.

Setup of the UART is:

NRF_SERIAL_DRV_UART_CONFIG_DEF(m_uart0_drv_config,
                     RX_PIN, TX_PIN,
                      NRF_UART_PSEL_DISCONNECTED, NRF_UART_PSEL_DISCONNECTED,       // no flow control pins
                      NRF_UART_HWFC_DISABLED, NRF_UART_PARITY_EXCLUDED,
                      NRF_UART_BAUDRATE_9600,
                      UART_DEFAULT_CONFIG_IRQ_PRIORITY);

#define SERIAL_FIFO_TX_SIZE 32
#define SERIAL_FIFO_RX_SIZE 32

NRF_SERIAL_QUEUES_DEF(serial_queues, SERIAL_FIFO_TX_SIZE, SERIAL_FIFO_RX_SIZE);

#define SERIAL_BUFF_TX_SIZE 1
#define SERIAL_BUFF_RX_SIZE 20                // this is plenty slow so let's make this not huge anyway

NRF_SERIAL_BUFFERS_DEF(serial_buffs, SERIAL_BUFF_TX_SIZE, SERIAL_BUFF_RX_SIZE);
//
// we're going to run this thing in IRQ mode and deal with it from there.  This is slow
NRF_SERIAL_CONFIG_DEF(serial_config, NRF_SERIAL_MODE_IRQ,
                      &serial_queues, &serial_buffs, Xbee_ISR_Interrupt, NULL);


NRF_SERIAL_UART_DEF(serial_uart, 0);

Call to Init is:

    ret = nrf_serial_init(&serial_uart, &m_uart0_drv_config, &serial_config);

which is returning 0...

Right after this I get an IRQ with that NRF_SERIAL_EVENT_DRV_ERR.  After this I can send out (correctly) stuff on the TX pin (correct baud rates and everything) but it's completely missing anything on the that is coming back in.  I get no IRQs on it at all.

Any hints at what to look for here?

  • Hi there,

    What is the state of the RX pin when you initialize the module, and have you verified that you're using the same setup on both sides(flow control, baud rate etc). You can read out what kind of error that you're getting by checking the ERRORSRC register in debug mode. 

    regards

    Jared 

  • RX pin is low for awhile and then comes up when I release the reset pin on the device I'm talking to.  It is doing hardware flow control but I'm bit banging that because of the particular behaviour it does.

    Nothing really strange really.

    If I had to guess it's showing a break condition.  No big deal.  The problem is that the driver then never comes back from that and allows the this to receive the traffic.

    So the central question here is this: How do I reset the RX part of this thing when it gets bent out of shape because the line isn't what it expects at that point.   What's the API call to get it to ignore things?

  • The yellow trace is the RX pin.  I never see that data coming in.

    From reset going high that's about 50mS so yah, that's a break no doubt.

  • NRF_UART0->ERRORSRC is showing zero here inside the IRQ.

    So according to this, I'm not getting errors so something else is going on in the driver to get to where I'm getting... Which blows my perfectly good theory up. 

  • So this thing is clearing the error before I get to it which is why it's zero.

    Tracing this back, it's coming through line 553 of nrfx_uart.c where it's grabbing (and clearing) the error code (4) and then doing

            nrf_uart_int_disable(p_uart, NRF_UART_INT_MASK_RXDRDY |
                                         NRF_UART_INT_MASK_ERROR);

    which is probably why I'm never getting anything past this.

    The error (4 == framing err) is to be expected and looking at this thing I should even get a BREAK err but neither of these matter in this context so I can ignore them no problem.

    The thing I'm attempting to implement here is a very simple UART problem: Sending out bytes and asnyc getting bytes back (I never know when they are coming back). The async thing is just ISR driven so I assemble information as it comes back and then dispatch other threads to be acting on the buffer.  Is there some simple way to do this or is that this library?

Related