UART RX idle logic 0

Hello,

We are working on a project that uses a UART->RS485 bridge, but the data coming from the bridge IC is idling low. In other words, the UART data we are receiving is "upside-down". At all times, the line is low until data starts to appear on the line, where the data raises the logic level to high repeatedly. This is a problem because the stock nRF52840 UART drivers expect UART to come in idling high. Is there any way we can flip the UART in software or do we have to add an inverter in hardware?

Thanks,

Nathan

  • Hi Nathan

    I will have to ask internally as I don't know of any way to do it. 

    I did come across a post made by a colleague regarding a workaround, however as the post is from some years back I have asked internally. 

    There is no way to invert the output in the UARTE or UART peripheral directly unfortunately, hidden or otherwise. 

    A method which isn't mentioned in the old case is to invert the signal by passing it through the GPIOTE peripheral, setting up one GPIOTE IN channel that automatically triggers a toggle on a separate GPIOTE OUT channel whenever there is activity on the TX pin. 

    This method should be less complicated from a software point of view, but will increase current draw somewhat, and will require an additional GPIO (one for the real TX signal, and one for the inverted one). 

    Best regards
    Torbjørn

    Regards

    Runar

  • Might not help, but if all the near-end Rx idle and active bits are upside down a simple trick is to swap the differential RS485 lines over. If using a RS422 hardware chip to create RS485 by pairing Tx and Rx lines this is trivial, just swap the +- receive line pins and leave the +- transmit line pins alone. If using a RS485 hardware chip (or no interface chip) the downside of this trick is that the near-end Tx is also inverted. Depending on the application such a near-end Tx inversion may or may not be a problem, and sometimes the inversion on the far-end Rx (which is now inverted) is easier to handle. Worst case the near-end Tx can be performed by PWM (I posted an example recently), and the near-end Rx by the UART with the swapped lines.

Related