Skip to content

Incorrect information re: SoftwareSerial RX pins #291

Open
@per1234

Description

@per1234

Describe the problem

Information about which pins can be used as RX is provided in a comment in the "SoftwareSerial" library's example sketch:

// Note any pin can be used for TX, but only the following pins
// can be used for RX:
// D0, D1, D2, D3, D8, D14, D15, A1, A2, A3, A4, A5

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

  1. Jumper pin 1 to pin 12 on the board.
  2. Open Serial Monitor.
  3. Upload the following sketch:
    #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());
      }
    }
    🐛 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.
  4. Move the jumper to pin 13.
  5. Change line 2 of the sketch to:
    byte RxPin = 13;
  6. 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.
  7. Move the jumper to pin A0 (14).
  8. Change line 2 of the sketch to:
    byte RxPin = 14;
  9. 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

  1. Jumper pin 1 to pin 6 on the board.
  2. Open Serial Monitor.
  3. Upload the following sketch:
    #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());
      }
    }
    🐛 The message "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.
  4. Move the jumper to pin 11.
  5. Change line 2 of the sketch to:
    byte RxPin = 11;
  6. 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.
  7. 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.
  8. Move the jumper to pin A0 (14).
  9. Change line 2 of the sketch to:
    byte RxPin = 14;
  10. 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

b5a3b9d

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.

Additional reports

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: documentationRelated to documentation for the projecttype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions