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

How to simulate UART with GPIO?

NRF52810 has only one UART, so How to simulate more UARTs with GPIO?

  • Google "bit banging" and "soft UART".

    Also search this forum for previous discussions.

    However, I think a soft UART on an nRF52 could well be tricky due to the timing constraints of the BLE stack...

    Have you considered (an) external UART(s) with SPI or I2C link to the nRF ... ?

    nRF52840 has two UARTs

  • Hi,

    We have a library which uses the ADC to simulate UART RX and PWM to simulate UART TX.
    If possible in your case it is probably preferable to use those peripherals over GPIO as they can utilise EasyDMA to reduce the real time constraints and CPU requirements of doing transmission and continuous sampling.

    The library will work at baudrates up to 56 000 (1M if using only TX) and does not implement flow control / parity. The code has only been tested with nRF52832 and nRF52840 (using the nRF52 DKs). I believe the peripherals are similar on the nRF52810, but the code may require some modifications. The included examples only work out of the box with nRF52832 and nRF52840.

    Will this work for you?

    4213.nrf_vt-0.2.2.zip


    See the added zip file which contains the library code and versions of the ble_app_uart example from the 15.2.0 and 15.0.0 nRF5 SDKs which have been modified to work with the library (unfortunately the examples haven't been updated for SDK 15.3.0). It also includes a README with detailed information.

Related