UART Forwarding/Passthrough

I have a GPS over UART to a nrf5283. For debugging the GPS, I'd like to passthrough UART from my PC to the GPS. I know the nrf5283 only has one UART. Is there a simple way to do this without creating a second UART in software?

  • You may need a nRF52840 since it has uart and also a usb. But if you want to stick with the nRF52832 you need to use the uart-ble bridge: PC <-- uart --> nrf52_1 <-- ble --> {your nrf52832} <-- uart --> {your GPS}. The nrf52_1 can be a cheap nRF52 breakout board that runs a simple program to connect to your nrf52 unit through BLE, and then all your subsequent commands from the PC will be "relayed" to your GPS unit.

  • @Matt do you know if I can emulate a serial port over BLE on my PC (Mac actually in this case)? Then I could avoid needing the second board.

  • If you don't need to filter that UART but you would know when and for how long it should be pass-through then you can connect UART PINs as GPIOTE with PPI and simply let the mechanism to make the PINs high/low as they come into the device. That should have no timing penalty (runs outside main CPU) and doesn't consume even the UART peripheral on nRF5x side so you can reuse it for another real UART link to the chip at that time. However the whole thing might be problematic if you don't have enough GPIOTE and PPI channels (depends on the chip, if you use UART with flow control etc.)

    Other solution indeed is bitbanging GPIO ports in SW but that would work only if SD has no scheduled operation (or if your UART activity fits into some time-slot).

  • In every case it's very likely that no one went this rout before you (or at least unlikely you will find such code lying with free license on GitHub or elsewhere) meaning that you have some serious work ahead (unless you will change your requirements). Good luck!

  • @endnode Thanks for your comments. Indeed I am very close deciding this isn't worth the effort. I do not need to do any filtering or modification on UART. My goal would be to emulate plugging directly into the GPS UART. Also, there is no HW flow control.