Hi all
Long time Arduino fan, first time poster ![]()
I am attempting to use a NANO RP2040 CONNECT instead of my usual NANO IOT 33 and have found a difference in behaviour when using hardware serial.
The code at the bottom of the post reproduces the problem. I am setting a R/W direction pin to HIGH, writing a sequence of bytes to the serial port and then setting the R/W direction pin to LOW.
On a NANO IOT 33 the digital trace loooks as expected, i.e. the direction pin (marked 1 on the trace image) goes low after all of the bytes have been written:
On a NANO RP2040 the digital trace loooks different, i.e. the direction pin (marked 1 on the trace image) goes low before all of the bytes have been written:
In all of the calls to test below the direction pin goes low two bytes before the end of the buffer. My guess would be an issue with the RP2040 target code, but wanted to see if I'm missing something obvious.
Any and all help gratefully received ![]()
Cheers,
Rich.
const uint8_t DIR_PIN = 2;
void setup()
{
Serial.begin(115200);
Serial1.begin(57600);
pinMode(DIR_PIN, OUTPUT);
}
void test(uint8_t* data, size_t length)
{
Serial.print("Outputting ");
Serial.print(length);
Serial.println(" byte(s)");
digitalWrite(DIR_PIN, HIGH);
Serial1.write(data, length);
Serial1.flush();
digitalWrite(DIR_PIN, LOW);
delay(10);
}
void loop()
{
uint8_t data[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
test(data, 10);
test(data, 12);
test(data, 14);
test(data, 16);
test(data, 18);
test(data, 20);
}

