arduino / arduino/ArduinoCore-renesas

After reset pin 13 is configured as an output

Open
#57 3 comments 0 reactions 0 assignees View on GitHub
topic: code type: imperfection
Dominant language
C
Stars
193
Forks
112
PR merge metrics
No merged PRs in 30d

Description

On the Uno R4 Minima and Uno R4 WiFi, pin 13 is made an output after reset, so if you do:
```
void setup() {
Serial.begin(9600);
delay(5000);
}

void loop () {
Serial.println(digitalRead(13));
delay(1000);
}
```
and apply 5V to the pin (via a resistor for safety), you still get 0.

The usual Arduino convention is that all digital pins are inputs after reset, and to make a pin an output you have to call `pinMode(13, OUTPUT)`, for example. As far as I know no other Arduino board does this.

The way it is currently working is undesirable, because you might have pin 13 connected to a voltage input; an accidental reset could then cause excessive dissipation in the output driver.

Note: Originally posted on the Early Access Program forum, but still an issue.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the Uno R4 Minima and Uno R4 WiFi reset initialization, and trace how pin 13 is configured before setup() runs. Compare that path with the expected digitalRead(13) behavior after reset; done when pin 13 remains an input until pinMode(13, OUTPUT) is called.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.