nRF52840 UARTE in Zephyr

I'm having problems using the UARTE in the nRF52840 via Zephyr.    I'm watching the TX pin using a logic analyzer and seeing correct data when running at 9600 baud.   But if I configure the UART for 115200 baud, the data is garbled (sometimes some later characters are correct).   I've tried using the "built-in" Zephyr UART driver and disabling it and using the nrfxlib uarte driver with the same results.

I suspect that there is a clock accuracy issue...

I set:

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=n
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y

in prj.conf since my board has a 32.768 KHz crystal.     Is there some other configuration option needed to use the UARTE at 115200 baud?

Thanks!

  • Hi Hakon,

    Yes, that is what I meant by shifting causing decoding issues...

    Q1 answer: Yes.  I start the logic analyzer capture, then start the code, capturing the entire sequence, then stop the logic analyzer and zoom into the UART transaction.   This is the first (only) transaction.   I substituted the normal control sequence that should be sent for a simple letter sequence to help see the results on the logic analyzer.

    Q2 answer: There is a receiver attached.  The UART is connected to a Sierra Wireless XA1110 GPS module.   The module is delivered preconfigured to run at 115200 baud, so communication must be at that speed to configure anything (including changing the baud rate).  The two connections (TX_UART and RX_UART) are point-to-point and shown in the following images.   They are both only about 35 mm in length.   (The rectangular pads near the center of the trace are for clip points to attach the logic analyzer.)  I thought that perhaps this was a "transmission line" issue, but if that was the case, I would expect all edges to be affected, not just the ones in the first couple of characters.   Here are highlights of the two nets:

    The Laird module is on the right side;  the XA1110 is at the bottom left.

    Thanks...

  • Hi,

     

    CktDesigner said:
    Q1 answer: Yes.  I start the logic analyzer capture, then start the code, capturing the entire sequence, then stop the logic analyzer and zoom into the UART transaction.   This is the first (only) transaction.   I substituted the normal control sequence that should be sent for a simple letter sequence to help see the results on the logic analyzer.

    Jitters during, and straight after reset is to be expected, as the line is undefined prior to the firmware setting it. You can add a pull-up resistor on the line if you'd like.

    CktDesigner said:
    Q2 answer: There is a receiver attached.  The UART is connected to a Sierra Wireless XA1110 GPS module.   The module is delivered preconfigured to run at 115200 baud, so communication must be at that speed to configure anything (including changing the baud rate).  The two connections (TX_UART and RX_UART) are point-to-point and shown in the following images.   They are both only about 35 mm in length.   (The rectangular pads near the center of the trace are for clip points to attach the logic analyzer.)  I thought that perhaps this was a "transmission line" issue, but if that was the case, I would expect all edges to be affected, not just the ones in the first couple of characters.   Here are highlights of the two nets:

    As you mention, if the issue is only in the startup sequence, the issue is not purely electrical in the sense that capacitance etc. is causing this. I believe it is related to the GPIO state when the nRF is in reset and starting up. Could you try to add a pull-up resistor on the line to see if this helps?

     

    Kind regards,

    Håkon

Related