0

UART Forwarding/Passthrough

blueshifting gravatar image

asked 2018-01-12 20:33:01 +0100

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?

edit retag flag offensive close delete report spam

Comments

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 ( 2018-01-12 20:53:49 +0100 )editconvert to answer

@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.

blueshifting ( 2018-01-12 21:10:16 +0100 )editconvert to answer

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 ( 2018-01-12 23:15:29 +0100 )editconvert to answer

@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.

blueshifting ( 2018-01-12 23:22:50 +0100 )editconvert to answer

Then you need just Tx and Rx to copy on one side of the chip what comes on the other, GPIOTE and PPI are ideal for this! The problem might be if at certain moment you will need to start listening to Tx in your main FW because host will stop sending commands to GPS but it will be targeting nRF FW. But if you are free to choose the protocol then you can do something like "First UART wired to nRF UART and commands are processed in BLE FW => once certain command arrives it will say how long the pass-through should be available now => nRF de-inits the UART and wires the PINs with GPIOTE and PPI => starts the counter => now PC talks to GPS => timer expires on nRF side so it will again cancels GPIOTE and PPI and reinits UART => scenario can repeat as many times as necessary".

See ...(more)

endnode ( 2018-01-12 23:38:00 +0100 )editconvert to answer

The nrf52_1 in the PC <-- uart --> nrf52_1 <-- ble --> {your nrf52832} <-- uart --> {your GPS} can be a cheap nRF52 breakout board (< USD$9.00) and that's the setup I have used to "configure" my nRF52 board which is hooked up to a Telit module through the uart.

I also like the GPIOTE/PPI solution proposed by endnode; elegant and simple :)

Matt ( 2018-01-13 00:26:25 +0100 )editconvert to answer

As @Matt mentions, you can also look at the nRF52840. Not only does it have built in USB that you can use as a COM port, but it also has two UARTs, a feature that was requested by a lot of customers. It is also possible to do UART over BLE emulation as you suggest. It is probably one of our most used examples: BLE over UART emulation example.

Martin Børs-Lind ( 2018-01-15 17:15:17 +0100 )editconvert to answer

If you're using a Segger debugger you could also try RTT, although it's not a direct UART-> UART bridge it should be able to emulate the functionality you want.

Simen August Tinderholt ( 2018-01-17 16:15:14 +0100 )editconvert to answer

The GPS is from U-Blox and I wanted to attempt using their diagnostic software which requires a serial connection on the PC. I'd have to find a way to either emulate that from BLE or RTT.

blueshifting ( 2018-01-17 18:01:32 +0100 )editconvert to answer

Is the PC <-- uart --> uBlox (I'm also testing with a uBlox product... wifi/bt combo, not GPS!) required for development only or for the final production? If it is for development purpose you can get away with two RS232 connectors and the uBlox can connect to either the nRF or the PC.

Matt ( 2018-01-17 21:43:50 +0100 )editconvert to answer

1 answer

Sort by » oldest newest most voted
0
endnode gravatar image

answered 2018-01-12 23:14:05 +0100

blueshifting gravatar image

updated 2018-01-17 18:00:17 +0100

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).

edit flag offensive delete publish link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

User menu

    or sign up

Recent questions

Question Tools

2 followers

Stats

Asked: 2018-01-12 20:33:01 +0100

Seen: 48 times

Last updated: jan. 12