Skip to content

Commit 4e19e27

Browse files
committed
rp2040: fix SerialNINAPassthrough functionality
The USB stack loses bytes here and there, need to double check it fw update patch: replace single byte handling with +uint8_t buf[16]; +uint8_t i = 0; + while (Serial.available() && i < sizeof(buf)) { + buf[i++] = Serial.read(); + } + if (i > 0) { + SerialNina.write(buf, i); + i = 0; + } + while (SerialNina.available() && i < sizeof(buf)) { + buf[i++] = SerialNina.read(); + } + + if (i > 0) { + Serial.write(buf, i); + i = 0; + }
1 parent 9d957e0 commit 4e19e27

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

cores/arduino/USB/PluggableUSBSerial.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,10 @@ class USBSerial: public USBCDC, public ::mbed::Stream, public HardwareSerial {
277277
return _bits;
278278
}
279279
bool dtr() {
280-
return _dtr;
280+
return (_dtr != 0);
281281
}
282282
bool rts() {
283-
return _rts;
283+
return (_rts != 0);
284284
}
285285

286286
private:

variants/NANO_RP2040_CONNECT/pins_arduino.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,15 @@ static const uint8_t SCK = PIN_SPI_SCK;
5757
#define PIN_WIRE_SDA (18u)
5858
#define PIN_WIRE_SCL (19u)
5959

60-
#define SERIAL_HOWMANY 2
60+
#define SERIAL_HOWMANY 3
6161
#define SERIAL1_TX (digitalPinToPinName(PIN_SERIAL_TX))
6262
#define SERIAL1_RX (digitalPinToPinName(PIN_SERIAL_RX))
6363
#define SERIAL2_TX (digitalPinToPinName(25))
6464
#define SERIAL2_RX (digitalPinToPinName(26))
6565
#define SERIAL2_CTS (digitalPinToPinName(27))
6666
#define SERIAL2_RTS (digitalPinToPinName(28))
67+
#define SERIAL3_TX (digitalPinToPinName(25))
68+
#define SERIAL3_RX (digitalPinToPinName(26))
6769

6870
#define SERIAL_CDC 1
6971
#define HAS_UNIQUE_ISERIAL_DESCRIPTOR
@@ -84,11 +86,11 @@ void _ontouch1200bps_();
8486
#define SPI_SCK1 (digitalPinToPinName(29))
8587

8688
#define NINA_RESETN (24u)
87-
#define SerialNina Serial2
89+
#define SerialNina Serial3
8890
#define SerialHCI Serial2
8991

90-
#define NINA_GPIOIRQ (24u) // LEDG pin (GPIO26 on NINA)
91-
#define NINA_GPIO0 (11u) // real GPIO0 on NINA
92+
#define NINA_GPIOIRQ (21u) // LEDG pin (GPIO26 on NINA)
93+
#define NINA_GPIO0 (28u) // real GPIO0 on NINA
9294

9395
#define SPIWIFI_SS (26u)
9496
#define SPIWIFI_ACK (27u)

0 commit comments

Comments
 (0)