Serial Comm 2 devices

Hi!
I’ve got 2 devices running on 2 separate boron’s that I’d like to install onto 1 boron, now that I’ve got the code working for each hardware. The trouble is there only appears to be 1 serial port on the boron. I’ve been trying to learn what would be the best way to combine this. Get some more external hardware and add another serial? Could I use the UART1_CTS and RTS pins here somehow? I’ll never need to read both devices at the same time. Is it possible to connect both devices to the RX and TX pins and then selecting which device to communicate with somehow? or will one device have to be powered off if their both connected to the TX and RX on the boron?
1 device is Adafruits GPS shield and the other is a Modbus distance sensor from APG that uses a MAX485 chip between the sensor and boron.
And this is the code I’m using on the sensor.
If someone could point me in the right direction, I’d certainly appreciate it!

Hi,
you can consider to use SC16IS740 as additional UART
and use @rickkas7 lib with it.
The library is also available in Web IDE

2 Likes

DreamER’s suggestion is the best idea, in my opinion.

There is only one hardware UART available on the Boron. The nRF52840 has two, but the other is connected to the cellular modem. The nRF52 does not work well with software-based serial because of interrupt latency and a lack of timer peripherals.

A serial multiplexer is a thing, however it would be a bad for for your application. When using a MUX you connect to one peripheral at a time. Any data sent by the other one is lost. Since the GPS is typically periodically transmitting, you’d lose NEMA messages doing it that way.

The SC16IS740/SC16IS750 connect by I2C or SPI, and have a 64-byte hardware buffer so you can handle multiple ports easily, at least at slower speeds like 9600 baud.

You can do a search for SC16IS750 on Amazon, eBay, AliExpress, etc. and you’ll fine a lot of inexpensive breakout boards that should work.

2 Likes

Ok!! Thanks for the help! I’ve got a SC16IS750 ordered to try out.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.