Skip to content

GPIO pin state does not change #805

Closed
@jgromes

Description

@jgromes

Hi,

I came across a strange issue. On STM32L452RE, the following code should toggle PC1 high and low:

#define PIN    PC1

void setup() {
  pinMode(PIN, OUTPUT);
}

void loop() {
  digitalWrite(PIN, LOW);
  delayMicroseconds(5);
  digitalWrite(PIN, HIGH);
  delayMicroseconds(5);
}

When checking the hardware with a scope however, PC1 state does not change (it's constantly high due to external pullup). PC1 is the only pin showing this behavior - all others work fine. I ran a similar sketch that toggles all pins (apart from those used for SWD and crystal), but still, PC1 seems to be completely inaccessible.

When not using Arduino core and only HAL libraries (compiled in Atollic TrueStudio), this does not happen, PC1 works exactly as expected, so it's most likely not a hardware issue or blown pin.

Any pointers to what could be the cause would be greatly appreciated. I tried removing all alternate functions from PC1 in PeripheralPins.c, but this seems to have had no effect.

Metadata

Metadata

Assignees

Labels

bug 🐛Something isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions