Bad data when reading GPIO levels and UART data in ISR ? Pin noise, 5V input, ?
Posted: Sat Nov 08, 2025 12:40 am
I'm connecting an ESP32 to an instrument via a 5V non standard synchronous serial protocol. Like SPI but not quite SPI.
When I decode the serial data on my oscilloscope, every message is perfect, all the data is good. There are no bad messages.
I've written 3 different ESP32 routines to decode these messages. 2 are bit bang ISRs and one uses the ESP32 SPI port. In every one of these routines I'm getting bad messages coming back from the instrument. Sometimes a bit is missing, sometimes a byte will be missing one bit, etc.
With the bit bang routines I've tried sampling the data bit on the rising edge, falling edge, etc. all to no avail. I've tried pull up and pull down configurations with the same outcome.
I'm pretty sure it isn't a software issue. I'm pretty sure I'm dealing with a hardware issue. The signal is pretty clean. I can drop the decoding threshold voltage on my oscilloscope below 0.5V and not get any message errors.
The digital output from the instrument is 5V. I'm connecting it directly to an ESP32 GPIO pin with no level shifting. Could this be causing the issue ? Are GPIO pins prone to pick up noise internally ? What else might cause a GPIO pin or the SPI port to incorrectly read a bit ?
Thanks
When I decode the serial data on my oscilloscope, every message is perfect, all the data is good. There are no bad messages.
I've written 3 different ESP32 routines to decode these messages. 2 are bit bang ISRs and one uses the ESP32 SPI port. In every one of these routines I'm getting bad messages coming back from the instrument. Sometimes a bit is missing, sometimes a byte will be missing one bit, etc.
With the bit bang routines I've tried sampling the data bit on the rising edge, falling edge, etc. all to no avail. I've tried pull up and pull down configurations with the same outcome.
I'm pretty sure it isn't a software issue. I'm pretty sure I'm dealing with a hardware issue. The signal is pretty clean. I can drop the decoding threshold voltage on my oscilloscope below 0.5V and not get any message errors.
The digital output from the instrument is 5V. I'm connecting it directly to an ESP32 GPIO pin with no level shifting. Could this be causing the issue ? Are GPIO pins prone to pick up noise internally ? What else might cause a GPIO pin or the SPI port to incorrectly read a bit ?
Thanks