Freaky bug with serial


I’ve been developing electron to be part of our product and been banging my head to the wall for the last few days with very frustrating bug. Still no idea what it is actually but got it fixed… Sort of.

So I have a mother board where electron is attached via headers. This motherboard has amongst other things multiplexer so that I can have 8 different devices connected to electrons Serial1 pins.

It’s supposed to work so that I have A1, A2 and A3 pins which choose which port is connected to the serial pins depending which of those is high/low. So as a basic test script I’ve built function which chooses each port one after another which worked great. Only one port can be selected at once. I have another device which I can easily connect to any of these 8 ports and it outputs word “test” every 500ms and the main device changes port every 1000ms and echos anything it receives from selected port. So in perfect world I connect one device to one port and I get response from only one of the ports.

However lately 4 ports stopped functioning and when I connect the test device to one of the other 4 ports, electron thinks I have in fact 2 devices connected on different ports. Tested it with scope and electron RX/TX pins are only receiving data when the right port is selected so that second response is some kind of “ghost” reponse.

However when I use other electrons I have and flash the excatly same program things work as they are supposed to which I can’t understand.

Now the test unit I was using is from the original electron beta batch and the ones that are working are ordered few months ago and from the first production batch. However when I sent the binaries to my HW designer he was able to replicate the excatly same error but with normal production batch electrons…

So I’m completely at a loss as to what on earth could cause something like this and where to look next?