I'm using Serial and Serial1 with my NANO RP2040 CONNECT, and need more serial ports. Is it possible?
One software serial should be possible,
and there are also UART expansions, that can be addressed via SPI/I2C.
SC16IS752 IIC I2C/SPI Bus Interface Dual UART
https://de.aliexpress.com/item/1005004556856100.html
1 Like
I bought a Portenta H7 and the associated Portenta Breakout Board. I am very pleased. I have four UARTs running at 1M baud. That's seperate from the programming port I have running at 2M baud.
I modified code from some excellent work found at:
Portenta Serial UART - four easy ports separate from the programming port
My Portenta UART test Sketch:
/* Portenta Serial UART
* Code modified from:
Thank you, Jeremy Ellis!
https://github.com/hpssjellis/portenta-pro-community-solutions/blob/main/examples/dot1-portentaH7-examples/dot19-cores-uart-serial-com/dot198-uart-serialtransfer/dot198-uart-serialtransfer.ino
* Code modified from:
Thank you, Jeremy Ellis!
//This, go there... ---> https://github.com/hpssjellis/portenta-pro-community-solutions
* ================================================================================
* For this program
*
* 1 way
* Connect (sender) myUART6 pin D5 TX to (receiver) myUART8 pin D6 RX
*
*
* If you wanted to do 2 way
* Connect Serial1 pin D14 TX to myUART6 pin D4 RX
* Connect Serial1 pin D13 RX to myUART6 pin D5 TX
*
*
* Then load serial monitor, change delay to speed up
*
* ================================================================================
*
* * UART Information for the PortentaH7
*
* UART myUART0(PA_0, PI_9, NC, NC); // TX, RX, RTS, CTC NOTE: NC means not connected
* UART myUART1(PA_9, PA_10, NC, NC); // pin D14 TX, pin D13 RX same as pre-defined Serial1
* UART myUART2(PG_14, PG_9, NC, NC);
* UART myUART3(PJ_8, PJ_9, NC, NC);
* UART myUART6(PC_6, PC_7, NC, NC); // pin D5 TX, pin D4 RX
* UART myUART8(NC, PA_8, NC, NC); // pin D6 RX only can receive
*
*/
//#include <Arduino.h>
//#include <Arduino_PortentaBreakout.h>
//#include "SerialTransfer.h"
//////////////////// Start All Core M7 Programing /////////////////////
#ifdef CORE_CM7
//--------------------------------------------- NOTE ------------------------------------------------------
// I used the Portenta Breakout Board and soldred some jumpers on the four UART breakouts.
// Everything worked.
//
// UART Test1 is a bidirectional test of UART0 and UART1
// UART Test2 is a bidirectional test of UART2 and UART3
//--assign Serial UART
//https://github.com/hpssjellis/portenta-pro-community-solutions <--- Most excellent URL
//Thank you, Jeremy Ellis!
//UART myUART0(PA_0, PI_9, NC, NC); // put this back to test with with myUART1 on M4 Test1 - worked 20230218
UART myUART2(PG_14, PG_9, NC, NC); // put this back to test with with myUART3 on M4 Test2 - worked 20230218
int i=65; //(char)"A";
void setup() {
pinMode(LEDR, OUTPUT); // LEDB = blue, LEDG or LED_BUILTIN = green, LEDR = red
bootM4();
Serial.begin(2000000);
//myUART0.begin(1000000);
//myUART0.setTimeout(10);
myUART2.begin(1000000);
myUART2.setTimeout(10);
}
void loop() {
if (i > 90){i = 65;} // ascii 65 = letter A, ascii 90 = letter Z
//myUART0.write((char)i++); // ascii code for numbers A to Z
myUART2.write((char)i++); // ascii code for numbers A to Z
//if (myUART0.available()) {
if (myUART2.available()) {
digitalWrite(LEDR, !digitalRead(LEDR)); // switch on / off
do { // Read all to clear buffer
//Serial.write(myUART0.read()); // Read it and send it out Serial (USB)
Serial.write(myUART2.read()); // Read it and send it out Serial (USB)
//} while (myUART0.available());
} while (myUART2.available());
}
Serial.write("\n"); // Read it and send it out Serial (USB)
delay(500);
}
#endif
//////////////////// End All Core M7 Programing /////////////////////
//////////////////// Start All Core M4 Programing /////////////////////
#ifdef CORE_CM4
int myCount=48; //48 = ascii 0, 58 ascii 9
char c;
//--assign Serial UART
//https://github.com/hpssjellis/portenta-pro-community-solutions <--- Most excellent URL
//Thank you, Jeremy Ellis!
//UART myUART1(PA_9, PA_10, NC, NC); // put this back to test with with myUART0 on M7 Test1 - worked 20230218
UART myUART3(PJ_8, PJ_9, NC, NC); // put this back to test with with myUART2 on M7 Test2 - worked 20230218
void setup() {
pinMode(LEDB, OUTPUT); // LEDB = blue, LEDG or LED_BUILTIN = green, LEDR = red
// Serial.begin(115200); // no serial monitor on M4 core without RPC
//Most excellent URL ---> https://github.com/hpssjellis/portenta-pro-community-solutions
//myUART1.begin(1000000);
//myUART1.setTimeout(10);
myUART3.begin(1000000);
myUART3.setTimeout(10);
}
void loop() {
if (myCount >= 58){myCount = 48;} // ascii 48 = number 0, ascii 58 = number 9
char x = (char)myCount++;
//myUART1.write(x);
//myUART1.write(c);
myUART3.write(x);
myUART3.write(c);
//if (myUART1.available()) {
if (myUART3.available()) {
digitalWrite(LEDB, !digitalRead(LEDB)); // switch on / off
do { // Read all to clear buffer
//c = myUART1.read(); // c
c = myUART3.read(); // c
//} while (myUART1.available());
} while (myUART3.available());
}
delay(500);
}
#endif
//////////////////// End All Core M4 Programing /////////////////////
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.