Boron Serial1 problems

TL;DR -> I’m using a 3rd party serial device on Photon and Boron. Photon works great, Boron does not under the exact same configuration.

Here’s the tale of woe:

I’m having serial communication issues with an app we’ve programmed. It connects to a proprietary RF communication adapter at 115200 baud and reads data through Serial1. Data is received by sending hex commands to the device and reading the response. The device works perfectly on the photon without issues.

On Boron it does not work, and I have extensively investigated the issues. I attached an Arduino Mega to spy on the data being written. The Boron and Photon write identical data to the device TX lines with nothing attached, and I confirmed this using the Arduino. Loopback works as expected on both devices as well. Once I attach the serial RF device Boron stops writing data correctly. Photon is fine. Readable hex data keeps being written, but as soon as the Boron is connected to the device the hex data changes to the wrong values. I have all the ground, power, and data lines connected correctly, and there’s plenty of current available.

Here’s an example of what I am seeing:

Data that should be written, and is written by the Photon, and read by the device and Arduino:

[C5, 7, 0, 21] (startup command, consistent every write)

But on Boron, what I read with Arduino when the RF device is connected:
[FE, 8, 0, 23]

and another:

[FE, 8, 23, 3]

and again:

[FE, FE, 8, 23]

as soon as I disconnect the device TX line from the Boron, the data returns to normal. I have not yet hooked up my o-scope to look at the waveform, but I’m not sure what I’ll find there. Also, I’m unfortunately stuck with 115200 baud so if it’s a baud rate / data corruption issue I’m stuck there. Help!?!

There is one big differerence between the Boron and the Photon.
While the Photon can accept 5V on the RX line the Boron can’t since the nRF52840 has not 5V tolerant pins while the STM32 used on the Photon has very few non-5V-tolerant pins.

So make sure you are not exceeding the limit on the Boron.

Also, what device OS version are you running?
There was this issue with older versions

Thank you very much for the response. I’m familiar with the 3.3V vs. 5V, the voltages are 3.3V, I’ve made sure of that, and it’s not the RX I’m having trouble with, it’s TX.

Regarding the OS version, It’s running the 1.1.0 device OS. Should I try one of the release candidates?

Yes, the issue I linked above was closed on May 16th via a fix (that should address other serial issues too) slated for 1.2.0-rc.1 but it’s always best to try the latest as it may include even more fixes.

I think I’ve found the issue. Using the buffered serial write seemed to clear it all up:

Serial1.write(buf, len);

I was using a for loop to write to the device, worked fine on photon, but for whatever reason the serial on boron is much more reliable using the buffered serial write. What a frustrating problem, but glad to find a solution!

1 Like

I’m having similar issues on the same devices.

Any changes on your end with this or did you juat leave it?