Description
Describe the problem
Information about which pins can be used as RX is provided in a comment in the "SoftwareSerial" library's example sketch:
From experimentation with the UNO R4 Minima and WiFi boards, I found some of this information to be incorrect.
UNO R4 Minima
🐛 Pins 12
and 13
can be used, yet these are not mentioned.
🐛 The claim is made that pin 14
can be used, yet this pin does not work as RX.
UNO R4 WiFi
🐛 Pins 6
, 11
, and 12
can be used, yet these are not mentioned.
🐛 The claim is made that pin 14
can be used, yet this pin does not work as RX.
General
🐛 Pin 15
is mentioned explicitly. This is the same pin as A1
, which is also mentioned explicitly. Although not incorrect, this is inconsistent (and therefore confusing to the user) since the same redundant approach is not done for pins 16
(A2
)-19
(A5
).
To reproduce
UNO R4 Minima
- Jumper pin 1 to pin 12 on the board.
- Open Serial Monitor.
- Upload the following sketch:
🐛 The message "
#include <SoftwareSerial.h> byte RxPin = 12; SoftwareSerial SoftSerial(RxPin, 2); void setup() { Serial.begin(9600); Serial1.begin(9600); SoftSerial.begin(9600); Serial1.print("Hello to RX pin "); Serial1.println(RxPin); while (!Serial) {} } void loop() { if (SoftSerial.available()) { Serial.write(SoftSerial.read()); } }
Hello to RX pin 12
" is printed in Serial Monitor, indicating that pin can be used as RX even though the comment in the example says otherwise. - Move the jumper to pin 13.
- Change line 2 of the sketch to:
byte RxPin = 13;
- Upload the sketch.
🐛 The message "Hello to RX pin 12
" is printed in Serial Monitor, indicating that pin can be used as RX even though the comment in the example says otherwise. - Move the jumper to pin A0 (
14
). - Change line 2 of the sketch to:
byte RxPin = 14;
- Upload the sketch.
🐛 The message "Hello to RX pin 14
" is not printed in Serial Monitor, indicating that pin can not be used as RX even though the comment in the example says otherwise.
UNO R4 WiFi
- Jumper pin 1 to pin 6 on the board.
- Open Serial Monitor.
- Upload the following sketch:
🐛 The message "
#include <SoftwareSerial.h> byte RxPin = 6; SoftwareSerial SoftSerial(RxPin, 2); void setup() { Serial.begin(9600); Serial1.begin(9600); SoftSerial.begin(9600); Serial1.print("Hello to RX pin "); Serial1.println(RxPin); delay(1000); // Give time for Serial to initialize. } void loop() { if (SoftSerial.available()) { Serial.write(SoftSerial.read()); } }
Hello to RX pin 6
" is printed in Serial Monitor, indicating that pin can be used as RX even though the comment in the example says otherwise. - Move the jumper to pin 11.
- Change line 2 of the sketch to:
byte RxPin = 11;
- Upload the sketch.
🐛 The message "Hello to RX pin 11
" is printed in Serial Monitor, indicating that pin can be used as RX even though the comment in the example says otherwise. - Repeat the process with pin 12.
🐛 The message "Hello to RX pin 12
" is printed in Serial Monitor, indicating that pin can be used as RX even though the comment in the example says otherwise. - Move the jumper to pin A0 (
14
). - Change line 2 of the sketch to:
byte RxPin = 14;
- Upload the sketch.
🐛 The message "Hello to RX pin 14
" is not printed in Serial Monitor, indicating that pin can not be used as RX even though the comment in the example says otherwise.
Expected behavior
Information in example sketch comments is correct.
Since it is likely not feasible for Arduino to maintain multiple copies of this documentation, I would recommend replacing the information in the example with a link to the documentation for the SoftwareSerial library:
https://docs.arduino.cc/learn/built-in-libraries/software-serial/
(I am working to add this information to that documentation: arduino/docs-content#1884)
"Arduino Renesas fsp Boards" version
Additional context
I did not investigate the situation with Portenta C33 due to not having access to that hardware, but from the results of the other boards I suspect that the information is also incorrect for this board.