I have a sensor which every 1 second spits out a 32-character serial stream at 9600 baud. I hooked it up to the mini-UART pins on the GPIO connector. What I saw was bad data.

After staring at the received data (and looking at the actual data on an oscilloscope) for a while it became clear that it was "losing synchronization" with the data. i.e. even though it was supposed to start capturing data at the falling edge after a stop bit, it was obviously capturing bits at other times, leading to garbled characters.

Now here was the confusing part: I also had a different sensor from another company that was working PERFECTLY on the original mini-UART. So why would one sensor work fine and the other not, with the same RPi configuration?

The sensor with the bad readings also uses the parity bit. It was set to provide even parity, so the parity bit could be high or low depending in the data in the previous 8 bit slots.

As another experiment, I used the various switches in config.txt (disable-bt for example) to use the AMA0 UART instead of the S0 UART, and everything worked fine!!! So the problem is obviously with the S0 UART and not the AMA0 UART.

  • Comments are not for extended discussion; this conversation has been moved to chat.
    – goldilocks
    Mar 4 '20 at 15:31

This site is temporarily in read only mode and not accepting new answers.

Browse other questions tagged .