Help me with Hardware Serial #26
Replies: 16 comments
-
Hi @carminelau On some boards, like the ESP32 MiniKit, those pins are conected to the flash and using them might crash your board. Other option is that your RX/TX lines are swapped. You need to connect them like this:
Hope this helps |
Beta Was this translation helpful? Give feedback.
-
My board is ESP32 WROVER-B can you help me ? |
Beta Was this translation helpful? Give feedback.
-
This is my esp32, i used the GPIO 9 and GPIO10 but my esp crash always |
Beta Was this translation helpful? Give feedback.
-
Your problem might be related to this issue:
Originally posted by @me-no-dev in espressif/arduino-esp32#148 (comment) Is this crash related from the use of this library? |
Beta Was this translation helpful? Give feedback.
-
Always crash when using Serial1, Serial2 or istanziate with RX and Tx |
Beta Was this translation helpful? Give feedback.
-
I use this code for testing... #include <PMserial.h>
SerialPM pms(PMSA003, Serial1); // PMSx003, UART RX GPIO9 TX GPIO10
void setup() {
Serial.begin(9600);
pms.init(); // config serial port
}
void loop() {
pms.read(); // read the PM sensor
Serial.print(F("PM1.0 "));Serial.print(pms.pm01);Serial.print(F(", "));
Serial.print(F("PM2.5 "));Serial.print(pms.pm25);Serial.print(F(", "));
Serial.print(F("PM10 ")) ;Serial.print(pms.pm10);Serial.println(F(" [ug/m3]"));
delay(10000); // wait for 10 seconds
} can you help me ? i'm really tired. |
Beta Was this translation helpful? Give feedback.
-
Just to be sure, you have tied with #include <PMserial.h>
SerialPM pms(PMSA003, Serial2); // PMSx003, UART RX GPI16 TX GPIO17
... |
Beta Was this translation helpful? Give feedback.
-
No, I honestly don't know how to enable Serial2. |
Beta Was this translation helpful? Give feedback.
-
just change the line as I showed on my previous message and connect the sensor the GPIO 16 and 17 |
Beta Was this translation helpful? Give feedback.
-
if I want to use the pins I said GPIO9 and GPIO10 how should I do? |
Beta Was this translation helpful? Give feedback.
-
You first need to check that the pins are usable. void setup() {
Serial.begin(9600);
Serial1.begin(9600);
Serial.println("hello from Serial");
}
void loop() {
if Serial.available() {
Serial1.write(Serial.read());
}
if Serial1.available() {
Serial.write(Serial1.read());
}
} and connect GPIO9 and GPIO10 with a jumper wire. You should get the message |
Beta Was this translation helpful? Give feedback.
-
To use different pins for Serial1, you should initialize it as below: Serial1.begin(9600, SERIAL_8N1, rxPin, txPin); |
Beta Was this translation helpful? Give feedback.
-
If you linking Serial object directly, you must make manual configure this object.
See more: https://github.com/avaldebe/PMserial/tree/master/examples/SoftwareSerial#esp32-minikit |
Beta Was this translation helpful? Give feedback.
-
did you get the sensor working on Serial1? |
Beta Was this translation helpful? Give feedback.
-
No, the serial1 it is not usable in my esp32 |
Beta Was this translation helpful? Give feedback.
-
Did you try to use different pins, as @me-no-dev and @heX16 suggested? |
Beta Was this translation helpful? Give feedback.
-
Hi I have an esp32 and I connected a PMS A003 to the serial hardware (IO10, IO9) but it doesn't work, I always get "Sensor read timeout".
I used the HardwareSerial.ino sample code
Beta Was this translation helpful? Give feedback.
All reactions