Right. I'm looking at a scope image of my data but I'm not understanding.
To recap, I have modules communicating with each other via twisted pair UTP at 9600 baud. Each module output drives an optocoupler on the input of the next module. R6 (330R) is the pullup resistor on the output, R7 (2k7) is the pullup on the input.
UTP between adjacent cells is hand-twisted. UTP between front and rear battery boxes is cat-5 cable, looking exactly like the picture that Arber linked to.
The 'scope shows me that every packet is being transmitted from front to rear. The packets at this stage are small, having only visited one module (one byte per module, plus one byte each for command, CRC & terminator).
The packets go around the rear 36 modules without incident - the 'scope shows every packet leaving the last module and heading back towards the front of the vehicle. Packets get larger as they go, and they will be 40 bytes long at this stage. If there were any errors received by a module it would not pass that packet on. So the fact that I see regular packets at this point means that there have been no errors so far.
Phuzy photo of waveform showing data arriving into the front from the back, showing groups of 6 packets being sent from the last module in the back.
When I look at the output from the first module after the data comes back to the front, I see that very few of the packets are re-sent.
This photo shows the data that the next module transmits. So you can see that many of the packets were not transmitted, presumably due to the CRC check failing. My CRC is simple, and some errors still get through, so the Master is occasionally complaining about low cell voltages.
So, I had a close look at the waveform to see if I could find some noise:
This is a picture of a beautiful waveform coming from the unconnected end of the UTP at the receiving end. Note the peak-peak voltage of 3V.
This is what it looks like when connected to the Data In connector (i.e. the optocoupler) of the next module. The voltage is less, but the waveform looks clean to my untrained eye.
This photo is on the other side of the optocoupler. So this is what the microcontroller sees. This is the worst waveform I've seen, there is a bit of a slope on those vertical lines. But that can't be due to the long comms run can it? Sure enough, if I look at another module with only a short wire on the input, the waveform looks the same:
So is there a clue here for my problem? Everything looks fine to me, except that the data is not coming through.
I did try swapping modules around, and the problem stayed with whichever module was connected to that long return line. I also tried swapping the two pairs that I used, so the TX line became the RX line and vice-versa, with no effect. I have previously tried a completely different line, a hand-wound UTP.