-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Hardware serial 2 does not work #665
Comments
Have you tried with native UART2 pins 16 RXD & 17 TXD, the highest pins only can be used as inputs. Best regards |
I was just about to post an issue on this myself. I've been working with the Adafruit Feather ESP32 and an Adafruit GPS Featherwing. With the Adafruit GPS_HardwareSerial_Parsing example sketch, I find that the combination of Serial at 115200 and UART 2 at 9600 does not work. the available function hangs, the read function hangs, and the delay function hangs. Reducing the Serial baud rate to 57600 or lower allows the UART 2 functions to work, but it typically takes several processor resets before the sketch will come up working. Otherwise, it continues to hang. Lowering the Serial baud rate further below 57600 has no effect on the problem. https://github.com/adafruit/Adafruit_GPS I can also demonstrate the problem with a simple loopback jumper between the uart 2 pins. I will post demo code this afternoon. |
@jestebanes: I have been using pins 16 and 17. The problem occurs with these pins. I haven't tested UART1, but I suspect the problem also occurs there. Regarding the loopback jumper, there is no problem if the jumper is not connected. That is, uart 2 does not exhibit any problems if there is no input connected. |
I have the same problem and I use pins 16 RXD & 17 TXD Best regards |
Good to hear that it is not my fault at least. |
Another thing, have you tried not to use Best regards |
Nothing changed. |
Pull up resistor in RXD pin? |
same Problem with Pull up resistor 10k on both PIN's |
In my case Serial 0 works partially too, so I'm sure it is a software problem. |
I am running out of options void loop(){ |
nope :/ |
I give up, I am going to wait to the experts UART2 works for me most of the time with the current release, but I have some performance issues related to the HardwareSerial driver that I have posted in the past, waiting for a solution. Best regards |
As far I know, @me-no-dev will replace the current Serial driver by the IDF one (next week maybe), so it intends to fix a lot of bugs like this one.... |
Some more observations on the Adafruit Feather. The attached code will work sometimes, using 115200 for Serial and 9600 for uart 2. Different baudrates on Serial make no difference. Jumper RX to TX. Run the code and be ready to keep hitting reset until it works. Once it's working, it will most likely fail after the next reset.
|
I hope that the driver change will fix that. After all, serial connection is a core functionality |
i kinda really want to know what is causing this. serial is nothing spectacular and nothing major changed in idf, or at least i patched what i saw was changed. the fact that sometimes works is way more disturbing than if it did not work at all... @igrr @Spritetm @projectgus you have any thoughts on this? Peripherals are enabled in dport |
I have the same problem as described and even the same issue with Feather MO and Feather nRF52 Bluefruit LE. Anybody that has found a feather that works with GPS feather wing on Serial2? |
The Feather nRF52 will work with the GPS, but you won't be able to program it with the GPS attached. What you have to do is to cut the RX and TX traces on the bottom of the GPS, and then jumper RX and TX to some different pins. Use SoftwareSerial to communicate with the GPS. The Feather M0 works fine. Make sure you're using Serial1, not Serial2. |
@me-no-dev just to add, i verified with a Feather ESP32 and even this basic sketch crashes (it didnt used to). i re-installed the IDF a few days ago, im on git commit 1407654 (from 9/21)
|
I have the very similar issue going on with a ESP32 DOIT board. I want to share things I encounter with the hope that it helps to those who are involved with the development process. I do coding both in Arduino IDE and Sloeber Eclipse in parallel. My Arduino IDE ESP32 development environment was setup quite some time ago (say 4-5 months) and not updated since. My Sloeber environment on the contrary, is just a few days old, setup with the most recent ESP32-IDF (with 21 Sep Update). Regarding the Serial.available() function, the code uploaded to the board via Arduino IDE functions without any problems. BUT the very same code uploaded stops responding IF I send something to the serial. As a side note I would mention that I run two communication processes as two separate tasks. A TCP communication the main loop and a Serial communication in a task. After initial boot I can send and receive on the TCP com BUT once I try to send something to the Serial every thing halts. I guess what ever the problem is it is a global issue affecting both cores on the ESP32. These are my experiences regarding this issue. I hope it helps and I am looking for a firm diagnostic and solution we all benefit. Thanx for the effort guys |
Please pull the latest changes and report :) Thanks! |
Board: ESPRESSIF ESP32-DEVKITC based on ESP-WROOM-32 @me-no-dev Thank you very much for solving the problem !! |
YEAH! :D I'm looking forward closing this :) |
Now Arduino JSON library stopped working :/
line 1160:
|
line numbers are not correct in stack traces. And this is a whole other issue ;) Maybe show more of your code ;) and I suggest to open another issue, as this is not at all connected to Serial. |
yep it is fixed! |
I fixed that bug with JSON too. Serial works <3 |
closing! :) |
Great job :) huge relief :) thanks for the effort |
I know that this is an old thread / closed issue, so I also raised a new bug ( #2519). I am currently having this exact problem with my Mega 2560. Serial0 works fine 100% of the time for communication with a Raspberry Pi using CmdMessenger / PyCmdMessenger at 9600 baud, but when I also communicate with a TFMini Lidar unit on Serial1 at 115200, the Serial0 connection to the Pi intermittently gets screwed up - it works for a few transfers, then crashes the Python code on the Raspberry Pi. I believe my IDE and environment is up to date, but can someone be specific about what was updated back in Sept 2017 to fix this. I have confirmed that my Serial0 and Python code work fine when I comment out the Serial1 reads, and just set t2 & t4 to integer values (ie t1 = 5; t4 = 10;) The entire code is quite long, but the declarations and offending function is below: ================ Declarations ================ #include <NewPing.h> #define CENTER_TRIGGER_PIN 10 NewPing centerSonar(CENTER_TRIGGER_PIN, CENTER_ECHO_PIN, MAX_DISTANCE); const int leftForward = 2; int tiltpos = 90; // variable to store the servo position int t1; // byte 3 from lidar enum { /* Initialize CmdMessenger -- this should match PyCmdMessenger instance */ void setup(){ attach_callbacks(); void attach_callbacks(void) { ===================== Offending Function ========================= void on_lidar_read() // wait for 9 new bytes - ie one full message // read message & return to Raspberry Pi
} Thanks. |
Sorry to resume a so old topic. I am using an Heltec WiFi Kit 32 (ESP32) in Arduino 1.8.3. My sketch takes input from Bluetooth Device and tries to send to Serial2 HardwareSerial (on pins 16 and 17). This is for sending MIDI upon receiving a BT flooarboard press. As soon as I do Serial.write on the HardwareSerial2, the sketch crashed and ESP32 restarts. This happens also with HWSerial1 (on the same two pins). I have tried several fixes read here and there, but not able to get the sketch not crashing. I also tried to reduce Serial to 9600, or to remove it completely (for Serial.prints)... Can someone give me an help ? Thanks |
Did you try change pins? |
Two things helped:
|
Works about 40% of the times. Even if it does, I can only retreive data and sometimes it halts on bt.available() when I write something to the serial. Printing never worked. The module works perfectly on uno with software serial. That is a issue also with the default
Serial
object, but in this case I can only print.The text was updated successfully, but these errors were encountered: