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

Fixes inconsistencies and adds extended HardwareSerial examples #7412

Merged
merged 26 commits into from
Dec 21, 2022

Conversation

SuGlider
Copy link
Collaborator

@SuGlider SuGlider commented Oct 31, 2022

Description of Change

This PR adds some examples that use API extensions to HardwareSerial, implemented to better controls UART communication using ESP32 Arduino.

HardwareSerial changes:

UART FIFO Full will depend on the baud rate.
For lower or equal to 57600 baud, it will force to emulate byte-by-byte reading on UART ISR.
For higher baud rate, it will keep IDF default of 120 bytes for FIFO FULL Interrupt.
The FIFO Full parameter can also be changed by the application at any time using HardwareSerial::setRxFIFOFull(uint8_t fifoBytes)

It also fixes some inconsistencies found when using the examples.

  • When Rx timeout is Zero (disabled), there is only one possible option which is execute the callback when FIFO reaches 120 bytes
  • In case that onReceive() shall work only with RX Timeout, FIFO shall be high. This is a work around for an IDF issue with events and low FIFO Full value (< 3)

Tests scenarios

The examples have been tested using ESP32, ESP32S2, ESP32S3 and ESP32C3.

Related links

#6921
#6689
#6849

@SuGlider SuGlider added Area: Peripherals API Relates to peripheral's APIs. Type: Example Issue is related to specific example. labels Oct 31, 2022
@SuGlider SuGlider added this to the 2.0.6 milestone Oct 31, 2022
@SuGlider SuGlider self-assigned this Oct 31, 2022
@SuGlider SuGlider marked this pull request as draft November 1, 2022 13:58
@SuGlider SuGlider marked this pull request as ready for review November 20, 2022 14:03
@Jason2866
Copy link
Collaborator

The headline is missleading. It is not just adding examples.

@SuGlider SuGlider changed the title Adds extended HardwareSerial examples Fixes inconsistencies and adds extended HardwareSerial examples Dec 7, 2022
Changed the "1-by-1" Serial only when baud rate is 57600 or lower.
@SuGlider
Copy link
Collaborator Author

@me-no-dev @P-R-O-C-H-Y
This PR is ready for your review. Thanks!

@VojtechBartoska VojtechBartoska removed the request for review from PilnyTomas December 20, 2022 10:19
@me-no-dev me-no-dev merged commit 5dff15c into espressif:master Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Peripherals API Relates to peripheral's APIs. Peripheral: UART Type: Example Issue is related to specific example.
Projects
Development

Successfully merging this pull request may close these issues.

5 participants