Hello everyone,
I'm experiencing an issue with UART communication between my PC and an LPC55S28 microcontroller.
When I first connect the USB cable (Debug Link P6) to power up the LPC55S28 dev board, the initial UART communication is corrupted. I have a python script running on my development computer that sends a 6 byte header to the uC. On the first attempt, immediately after powering the board via the debug USB cable, my UART interface (on the uC) does not receive the desired data. If I start a new debug run immediately afterwards without interrupting the power supply, the correct data is received. The result is that the first run after each power up is faulty.
Here's what I'm observing:
1. On the PC side (Python script):
- I'm sending a header: [Destination: 1, Type: 1, Seq: 0, Length: 108]
- This is packed as struct.pack('<BBHH', 1, 1, 0, 108)
2. On the LPC55S28 side:
- Instead of receiving the correct header, it receives: [0, 61, 511, 1]
- Followed by another incorrect header: [108, 0, 1, 7]
3. On the LPC55S28 side on the second debug run:
- It received the correct header [1,1,0,108]
The project is based on the SDK example.
This only happens on the initial connection after plugging in the USB cable.
The issue resolves itself on subsequent attempts without disconnecting the power.
I'm using the default UART configuration provided by the SDK.
It looks as if data is getting into the UART buffer that does not originate from my development computer. Is there a way to flush the buffer after the initialization function?
Hello, my name is Pavel, and I will be supporting your case, could you let me know the name of the example that are you using? the buffer that you are using is initialize with 0? maybe you could use memset to set the buffer to 0's.
Best regards,
Pavel
Hello, and what was your result?
Best regards,
Pavel