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

Esp32-S3 Baud Rate Detection missing #7718

Closed
1 task done
imwhocodes opened this issue Jan 16, 2023 · 8 comments · Fixed by #7838
Closed
1 task done

Esp32-S3 Baud Rate Detection missing #7718

imwhocodes opened this issue Jan 16, 2023 · 8 comments · Fixed by #7838
Assignees
Labels
Status: Needs investigation We need to do some research before taking next steps on this issue Type: Question Only question

Comments

@imwhocodes
Copy link

Related area

UART Baud Rate Detection

Hardware specification

Esp32-S3

Is your feature request related to a problem?

Auto Baud Rate feature is not supported/wrapped in arduino-esp32 for the esp32-S3
Hardware implementation / register are slightly different from previous esp32 revisions but it don't seem nothing drastic

(And there is no log-error advising user or the programmer that feature is not ready yet)

Describe the solution you'd like

Same behaviour as previous esp32 revisions

Describe alternatives you've considered

No response

Additional context

I tried to implement it by myself but I'm unable to compute the correct value, while reading the reference this line is not clear to me: UART_HIGHPULSE_MIN_CNT stores minimum high-pulse width
I'm unable to find what is the unit of measurement used for this value

I have checked existing list of Feature requests and the Contribution Guide

  • I confirm I have checked existing list of Feature requests and Contribution Guide.
@imwhocodes imwhocodes added the Type: Feature request Feature request for Arduino ESP32 label Jan 16, 2023
@VojtechBartoska VojtechBartoska added the Status: Awaiting triage Issue is waiting for triage label Jan 16, 2023
@SuGlider
Copy link
Collaborator

@imwhocodes -
It looks like you are using the ESP32 reference manual with the ESP32-S3.
Is it correct?

There is a code for it in
https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/HardwareSerial.cpp#L380-L400
https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-uart.c#L690-L747

Last time I tried it with ESP32-S3, it worked fine.

You can try this Arduino code:

   // this will start UART in 9600 baud and then it will try to adjuts itself to the transmiter baud rate
   // if it can't detect the transmiter baudrate, it will issue a log error message. Turn on Log to Error Level in the IDE.
   Serial.begin(0);  

@SuGlider SuGlider added Type: Question Only question and removed Type: Feature request Feature request for Arduino ESP32 Status: Awaiting triage Issue is waiting for triage labels Jan 26, 2023
@imwhocodes
Copy link
Author

Sorry I linked the wrong revision/model manual

I'm gonna try again, but what I did is using the same code that was correctly detecting the baud rate on ESP32 and tested on ESP32-S3 without any positive result (it always used default baudrate)

The thing that seem strange is that here nothing is enabled for the ESP32-S3
https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-uart.c#L681-L687

And here enabling is skipped too:
https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-uart.c#L716-L722

As I said i tried to fix it by myself, updating the struct name of the various parameter (they have different name in the ESP32-S3 HAL), it compile, return me a value but it is not correct

@SuGlider
Copy link
Collaborator

Thanks @imwhocodes - I'll try to make it work here as well.
Maybe there is some missing code as you pointed out.
Let's keep investigating the issue.

@VojtechBartoska VojtechBartoska added this to the 2.0.7 milestone Jan 30, 2023
@VojtechBartoska VojtechBartoska added the Status: Needs investigation We need to do some research before taking next steps on this issue label Jan 30, 2023
@imwhocodes
Copy link
Author

Hi @SuGlider I submitted a PR #7782 addressing this issue

Everything is explained there

For the moment I'm leaving issue open until completion

@SuGlider
Copy link
Collaborator

SuGlider commented Feb 1, 2023

Thanks a lot @imwhocodes!

@SuGlider
Copy link
Collaborator

@imwhocodes - After testing the PR and trying hard to make it work, I have come into the conclusion that ESP32-S3 doesn't detect any baud rate.
It seems that there is some failure on this feature in the chip.

@imwhocodes
Copy link
Author

@SuGlider I have this code literally running on production, and it work seamless with both 115200 and 460800 (both heavily tested )

Can you explain the problem that your are having?

(And sorry for the delay, tomorrow night i should be able to create the pull request with resolved CLA)

@SuGlider
Copy link
Collaborator

@SuGlider I have this code literally running on production, and it work seamless with both 115200 and 460800 (both heavily tested )

Can you explain the problem that your are having?

The problem is that S3 doesn't detect the baud rate correctly.
The sketch that I provided in #7782 (review) shall work always for any baud rate. It doesn't for the S3.

It works correctly only for the ESP32 and ESP32-S2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs investigation We need to do some research before taking next steps on this issue Type: Question Only question
Projects
4 participants