-
-
Notifications
You must be signed in to change notification settings - Fork 212
Raspberry pi pico unable to use 2 hardware serial ports (Serial1&2) #210
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
Comments
I've tested this using a standard Raspberry Pi Pico board and I was able to get the Pico to use a 2nd serial port (as well as still use USB/CDC Virtual Serial), but it requires modifying ArduinoCore-mbed code. However, I think that this mod requires plenty of testing as on my first few tests it appears unstable. When I reset my board using my own reset button I get an mbed error on the Serial1 port only. But then this error clears on 2nd reset and my test sketch works. The error only happens with a manual reset otherwise my mod appears to work.
So what did I do... Then for my Serial pins I used the following (I believe you are quite limited on choice of pins to prevent clashing with SPI/I2C):
Then you add in some new additions. First increase SERIAL_HOWMANY to 2 and then add in SERIAL2 TX/RX
And that is all I did. I was not sure about this code though and what it was doing internally:
Then for my Arduino sketch, I simply modified the existing SerialPassthrough sketch as follows:
|
Hi @MNS26 and @Gerriko ,
I tested it on a Pico and couldn't reproduce the crash that @Gerriko is reporting. Could you test if the issue is reproducible after the PR is applied? Thx |
@facchinm after i edited the pins_arduino.h file and tried to use your example i cant get it to compile, everytime i try to do it i get this
and the code i used
|
@MNS26 you say " i edited the pins_arduino.h file " When looking through the error log it tells you "warning: "PIN_SERIAL_TX" redefined" and "warning: "PIN_SERIAL_RX" redefined". That suggests to me that Serial2 and Serial1 and trying to use the same PIN_SERIAL_TX and PIN_SERIAL_RX. Maybe check your pins_arduino.h file again. |
@Gerriko I have pin GP4 and pin GP5 for serial 1 (GPS) and plan on using GP12 and GP13 for serial 0 (RC receiver).
serialX definition
i used GP0 and GP1 for a I2C sensor (mpu6050 with auxiliary I2C enabled for compass). EDIT:
But when i remove the line |
Is there anything else i can try to get it to work? Should i see this project as a lost cause and "drop it"? or is there still a light somewhere at the end of the tunnel. |
The proposed code did not compile as it was shown there.
I got the following error:
What worked for me was:
Full code:
|
@resolvethis Did you also edit the pins_arduino.h file? When i try and use your code (and adding the () to loop) i still get a error.
but when i set |
@facchinm has there been any news on this issue? I have yet to find a way to use multiple serial ports at once. |
Many thanks to those above, especially facchinm: #include <TinyGPSPlus.h> TinyGPSPlus gps; // The serial connection to the GPS device void setup() void loop() delay(500); if (millis() > 5000 && gps.charsProcessed() < 10) void displayInfo() Serial.print(F(" Date/Time: ")); Serial.print(F(" ")); Serial.println(); |
I was redirected here form platfromIO to open an issue about it.
( platformio/platform-raspberrypi#3 )
I've been trying it read my gps module for a project and decided to use the pi pico for it, however even though it "sees" the connection (no check wire connection message) it receives no data.
i used the default "FullExampel" file from the TinyGPS library
i removed SoftwareSerial because there is no interrup.h file and replaced it with Serial1 (RP pi pico should be able to have 2 hardware serial connections)
GPS lock is established (red led)

data from serial console

The text was updated successfully, but these errors were encountered: