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

HardwareSerial::end() won't detach RX/TX from IO MUX when it is executed isolated #8573

Closed
SuGlider opened this issue Aug 28, 2023 · 3 comments · Fixed by #8719
Closed

HardwareSerial::end() won't detach RX/TX from IO MUX when it is executed isolated #8573

SuGlider opened this issue Aug 28, 2023 · 3 comments · Fixed by #8719
Assignees
Labels
Peripheral: UART Status: Review needed Issue or PR is awaiting review
Milestone

Comments

@SuGlider
Copy link
Collaborator

Using, for instance, ESP32S3 GPIO 43 and/or GPIO44 for OneWire:

GPIOs 43 and 44 are default UART pins.
The issue seems related to being able to detach the GIPOs 43 and 44 from IO Mux and UART.
The execution of Serial0.end() shall do it, but I read the code again and realized that because, it has never been initialized, it also doesn't run the code to detach the IO MUX.

Therefore, @teastainGit, please try you code in this way:

void setup() {
  // Serial0 is the UART0 when the S3 CDC is enabled
  Serial0.begin(115200); // this will initialize the UART with GPIOs 43 and 44, marking those pins to be detached
  Serial0.end(); // this will detach GPIOs 43 and 44
  
  // code as usual...
  Serial.begin();
  delay(200);
  Serial.println(" setup ");
  delay(200);
  sensors.begin();
}

Originally posted by @SuGlider in #8324 (comment)

@SuGlider SuGlider self-assigned this Aug 28, 2023
@VojtechBartoska VojtechBartoska added this to the 2.0.12 milestone Aug 28, 2023
@VojtechBartoska VojtechBartoska moved this to Under investigation in Arduino ESP32 Core Project Roadmap Aug 28, 2023
@VojtechBartoska VojtechBartoska added Peripheral: UART Status: Needs investigation We need to do some research before taking next steps on this issue labels Aug 28, 2023
@VojtechBartoska VojtechBartoska modified the milestones: 2.0.12, 3.0.0 Aug 28, 2023
@VojtechBartoska VojtechBartoska moved this from Under investigation to Todo in Arduino ESP32 Core Project Roadmap Aug 28, 2023
@VojtechBartoska
Copy link
Contributor

Task update:

  • should be handled also by Peripheral Manager

@teastainGit
Copy link

So, thanks guys for all your support, but it still does not 'work' !
Shown below is my LilyGO LilyGO T-Display S3 breadboard test setup, with the DS18B20 'onewire'.
3454F715-1FE9-4B18-A998-7C6D346738F2_1_102_o
I uploaded your sample code and as before it did not return the temperature:
I get 13:56:36.242 -> -127.00ºC
When I use pin1 in the sketch and move it over to the test position to the right with the coloured wires I get:
(pin1 is yellow in both examples)
14:10:31.317 -> 24.62ºC
Both a TMP102 I2C temp sensor and a I2C SHTx sensor work on both positions!
[observation] when uploading your suggested sketch the tiny LED on the DS18B20 flickers, in a way that looks like the visual representation of serial info.
Neither 43 or 44 work with the onewire device.
I hope this extra info is helpful.
-Terry

@teastainGit
Copy link

teastainGit commented Oct 7, 2023

The final solution was to edit the helper header file in OneWire library and change to <33 pin number limit maximum to any number. (Suggested by someone in this repository !)

GPIO 43 and 44 now work with the dallas semiconductor temperature sensor!

I notified the authors of OneWire with An Issue and offered to make a PR, but no response.

thanks for all of your help, it is resolved.
-Terry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment