Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why do i get a warning when i got a break on UART? #9551

Closed
1 task done
hitecSmartHome opened this issue Apr 23, 2024 · 10 comments · Fixed by #9563
Closed
1 task done

Why do i get a warning when i got a break on UART? #9551

hitecSmartHome opened this issue Apr 23, 2024 · 10 comments · Fixed by #9563
Assignees
Labels
Milestone

Comments

@hitecSmartHome
Copy link

Board

ESP32-Wrover

Device Description

Hardware Configuration

Version

v2.0.14

IDE Name

PlatformIO

Operating System

Windows10

Flash frequency

80

PSRAM enabled

yes

Upload speed

115200

Description

I wrote a custom modbus implementation which uses the HardwareSerial.
I'm exchanging modbus messages over uart with 115200 baud.
If I set the debug level to 5, i got an UART1 RX break warning on serial constantly.

The communication is in a tight loop because I want to exchange messages as fast as i can.
I'm expecting a break, thats why I know that I got a packet. It is not a problem at all.

Sketch

Serial1.begin(MBUS_BAUD, SERIAL_8N1, MBUS_RX, MBUS_TX);
Serial1.setPins(-1, -1, -1, MBUS_RTS);
Serial1.setMode(MODE_RS485_HALF_DUPLEX);
Serial1.setTxBufferSize(RESPONSE_BUFFER_SIZE);
Serial1.setRxBufferSize(RESPONSE_BUFFER_SIZE);
Serial1.setRxTimeout(RX_TIMEOUT);
Serial1.onReceive([this](void) { handleRawPacket(); },true);
Serial1.onReceiveError([this](hardwareSerial_error_t error) { handlePacketError(error); });

Debug Message

[189919][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[189923][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[189928][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[189935][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[189945][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[189953][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[189961][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[189969][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[189973][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[189983][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[189990][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[189997][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[190004][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[190011][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[190015][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[190019][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[190023][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[190027][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[190032][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

[190040][W][HardwareSerial.cpp:313] _uartEventTask(): UART1 RX break.

....

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@VojtechBartoska
Copy link
Collaborator

possibly related to #9500?

@hitecSmartHome
Copy link
Author

hitecSmartHome commented Apr 23, 2024

possibly related to #9500?

I'm on 2.0.14 Arduino as a component of IDF using platformIO.

  • framework-arduinoespressif32 @ 3.20014.231204 (2.0.14)
  • framework-espidf @ 3.40406.240122 (4.4.6)

@hitecSmartHome
Copy link
Author

Really frustrating because my serial is flooded with these warning messages and I can't debug other part of my code.

@hitecSmartHome
Copy link
Author

I'M specifiing pins by default.

#define MBUS_BAUD 115200
#define MBUS_RX 35
#define MBUS_TX 32
#define MBUS_RTS 33

// RX_TIMEOUT / (MBUS_BAUD / 10) = millisec
// 4 / (115200 / 10) = 3.4 ms
#define RX_TIMEOUT 5
#define WAIT_TIMEOUT_MS 100

@SuGlider
Copy link
Collaborator

In order to get rid of this message, you may change the HardwareSerial.cpp code from the Arduino Core folder.
Just comment out the log_w("UART%d RX break.", uart->_uart_nr); line

case UART_BREAK:
log_w("UART%d RX break.", uart->_uart_nr);
currentErr = UART_BREAK_ERROR;
break;

@SuGlider
Copy link
Collaborator

Another way to get rid of this messages would be to set the log level to Error only.
Not sure if any of those possible workarounds would fit your need.

Please let me know.

@SuGlider
Copy link
Collaborator

From our end, it would make more sense to change these log messages to Verbose instead of Warning Level.

@SuGlider SuGlider added this to the 3.0.0-RC2 milestone Apr 24, 2024
@hitecSmartHome
Copy link
Author

Thank you for the suggestions. Isnt rx break a normal behavior? How else should we determine a packet?

@SuGlider
Copy link
Collaborator

Thank you for the suggestions. Isnt rx break a normal behavior? How else should we determine a packet?

Yes, but it depends on the protocol. In the case of MODBUS or some RS485 protocols, it may be common.
Some other protocols use a data structure with specific field values to communicate end of transmission, ACK, NACK, and so on.

SuGlider added a commit that referenced this issue Apr 24, 2024
UART events like BREAK or errors are now Verbose instead of Warning Level.

Backporting change from Issue #9551
@hitecSmartHome
Copy link
Author

Okay, i just commented the line out. Thank you very much for the help!

me-no-dev pushed a commit that referenced this issue Apr 29, 2024
* feat (uart): uses the same IDF 32bits size for TX/RX buffers

Uses the same IDF 32bits size for TX/RX buffers.

Changed header files to use the same IDF buffer limits.
* this is a backport from PR #9554

* feat (uart): change UART events logs to Verbose 

UART events like BREAK or errors are now Verbose instead of Warning Level.

Backporting change from Issue #9551

* feat (uart): uses the same IDF 32bits size for TX/RX buffers.

Uses the same IDF 32bits size for TX/RX buffers.

Changed header files to use the same IDF buffer limits.
* this is a backport from PR #9554

* feat (uart): keep overflow log as warning

Keeps Overflow /  Buffer Full log messages in Warning Level.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

3 participants