Question
UART reception fail on STM32F042KT with STPM3x IC
Hello community,
I'm facing a UART communication issue with my STM32F042K6T6 board and would appreciate any insights. Here are the details:
Hardware Setup:
- MCU: STM32F042K6T6
- Peripheral: STPM3x Energy Metering IC
- Connection: 9600 baud, 8N1, no flow control
- Voltage levels: 3.3V on both sides
The Problem:
- My STM32 fails to properly receive data from the STPM3x
- However, when I check with a logic analyzer, I can see the STPM3x is transmitting valid data packets
- The STM32 misses packets entirely even max delay provided.
- Tried interfacing ESP32 → STPM3x works very fine.
What I've Verified:
Signal Integrity:
- Clean waveforms visible on logic analyzer
- Proper baud rate (9600) confirmed
- Correct parity and stop bits
Basic Tests:
- Loopback test (TX→RX) also not working properly as only the first byte is received others omitted.
- Different baud rates yield same issue
- Tried multiple GPIO pins
NOTE : The stpm3x.h & stpm3x.c library is ported manually from CPP. I also attached the original CPP files for the reference.
