I have a Photon that needs to be connected to two serial sensors. As the Photon only has one serial port (actually two but the other is used by the LED), I have used in the past the SoftSerial library which worked well.
However, I have a serial sensor that is giving wrong results with the SoftSerial library.
What could the reason be? (Sensor is using 115200 baud but can use a lower speed).
Is there an easy way to add more UARTs to the Photon?
I prefer the SC16IS740. The MAX3107 is virtually useless for async serial without flow control. While it has a 128-byte FIFO, you can’t read from the FIFO while serial data is being received! You have to use flow control or happen to know that no data is being received, or the data can be silently corrupted with a repeated byte.
The RHR is the bottom of the receive FIFO and is the register used for reading data out of the receive FIFO. It contains the oldest (first received) character in the receive FIFO. RHR[0] is the first data bit of the serial-data word received by the receiver at the RX pin. Note that the data read out of RHR can be in error. This occurs when the UART receiver is receiving a character at the same time as a value is being read out of RHR and the FIFO level counter is being updated. In the event of this error condition, the result is that a character is read out twice from the RHR. To avoid this, the receiver should not be receiving data while the RHR is being read out. This can be achieved via flow control, or prior knowledge of the amount of data that is expected to be received.
The port expander is a different sort of thing, it splits a single serial port into multiple ports, allowing you to select which one you read and write to, one at a time.
As far as I know, no one has ported a driver for a SC16IS7x0 to Particle. I have the hardware and have been meaning to write one from scratch, optimized for Particle, but I haven’t done so yet. Thus it’s only theoretically possible to use one at this time.
I am planning to evolve to the new Mesh devices, and thus replace the Electron for the Boron, however, since the Boron has only one UART, I would definetly need to implement the additional UARTs.
So I’d like to ask you, did you get to write the library for the expander? If not, what hardware would you recommend for this? I like TI’s TL16C752C since it has two UARTs
The UARTs are meant to interface with the Adafruit Thermal Printers and a Modbus RTU chip.
My SC16IS740 library works on the mesh devices. You can attach 4 to the I2C bus or as many as you want to SPI (limited by available GPIO for the CS lines).