Hi,
I'm using the UART with DMA by accessing the registers directly without using the driver from the sdk. Currently Im testing a RS485 communication at a baudrate of 230400. And there im getting 1 or 2 crc errors in a hour. On the oscilloscope it is all fine. No reason why the ESP32 should read something different. A screenshot is attached which shows the wrong byte. The ESP32 has read the byte 0x65 instead of 0x6D.
Analog Pin 2 is the RX pin on the ESP32. Analog Pin 3 the RS485 signal. Digital pin 3 is also the RX pin on the ESP32.
Do somebody knows the problem?
UART rarely reads wrong data
UART rarely reads wrong data
- Attachments
-
- UART-CRC-ERROR-BYTE.png (34.56 KiB) Viewed 5253 times
Re: UART rarely reads wrong data
That is only happening with WLAN or with Bluetooth. With WLAN there are 1 or 2 errors in a hour and with Bluetooth every 1-2 minutes.
If both WLAN and Bluetooth is turned off, it is running several days without any errors.
Why? And can I prevent this errors, with Bluetooth and WLAN turned on?
If both WLAN and Bluetooth is turned off, it is running several days without any errors.
Why? And can I prevent this errors, with Bluetooth and WLAN turned on?
Re: UART rarely reads wrong data
You should provide hardware details, idf commit, and an example code to reproduce the problem. You have scope trace at the exact time of the error or scope logs crc errors? Is it always a single bit error?
Re: UART rarely reads wrong data
Hardware: ESP32 Rev3
ESP-IDF: git tag v4.2
The example code that im using is a mix of "bluetooth/nimble/bleprph" and "peripherals/uart/uart_echo_rs485", which is in attachment. You can change the pins in the IDF menuconfig. There are no logs in the example code, because im using my own JTAG-Logging. But you can insert logs when an error occured. Im using an external device which sends RS485 to the ESP32 with a Baudrate of 115200 and Even-Parity and 2 Stop-Bits. You should keep the Parity (doesnt matter if even or odd, to detect errors in frame), but you can change Baudrate and Stop-Bits and it also doesnt matter if the communication is coming from RS485 or from normal UART.
After 5 minutes the stats are saying following (Bluetooth turned on):
Received bytes: 2970022
Errors: 4
Before I have run the same without enabling Bluetooth (ble_main() call) and I have zero errors in more than 30 minutes.
Before I have tested in my own environment and disabled the parity and checked the data via CRC. There I see that there are always Single-Bit-Errors.
The Scope represents the Byte on the Bus which is correct (0x6D), but the ESP32 reads in this moment 0x65.
And it need to be some sort of hardware errors, because Im using an own UART driver with DMA access and the same problem is also occuring with the esp-idf UART driver.
ESP-IDF: git tag v4.2
The example code that im using is a mix of "bluetooth/nimble/bleprph" and "peripherals/uart/uart_echo_rs485", which is in attachment. You can change the pins in the IDF menuconfig. There are no logs in the example code, because im using my own JTAG-Logging. But you can insert logs when an error occured. Im using an external device which sends RS485 to the ESP32 with a Baudrate of 115200 and Even-Parity and 2 Stop-Bits. You should keep the Parity (doesnt matter if even or odd, to detect errors in frame), but you can change Baudrate and Stop-Bits and it also doesnt matter if the communication is coming from RS485 or from normal UART.
After 5 minutes the stats are saying following (Bluetooth turned on):
Received bytes: 2970022
Errors: 4
Before I have run the same without enabling Bluetooth (ble_main() call) and I have zero errors in more than 30 minutes.
Before I have tested in my own environment and disabled the parity and checked the data via CRC. There I see that there are always Single-Bit-Errors.
The Scope represents the Byte on the Bus which is correct (0x6D), but the ESP32 reads in this moment 0x65.
And it need to be some sort of hardware errors, because Im using an own UART driver with DMA access and the same problem is also occuring with the esp-idf UART driver.
- Attachments
-
- uart_bluetooth.zip
- (31.62 KiB) Downloaded 352 times
Re: UART rarely reads wrong data
Problem fixed. Bluetooth Modem Sleep was the problem. Zero errors in several days, when I disabled it.
Re: UART rarely reads wrong data
Hello trawgz,
I am facing something similar where my bytes gets distorted. Can you explain what the Bluetooth Modem Sleep was doing that was affecting the bytes coming into ESP32 and how removing it solved?
Thanks,
Irfan.
Who is online
Users browsing this forum: No registered users and 110 guests