Skip to content

GPIO pin state does not change #805

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jgromes opened this issue Nov 29, 2019 · 4 comments
Closed

GPIO pin state does not change #805

jgromes opened this issue Nov 29, 2019 · 4 comments
Assignees
Labels
bug 🐛 Something isn't working

Comments

@jgromes
Copy link
Contributor

jgromes commented Nov 29, 2019

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.

@fpistm
Copy link
Member

fpistm commented Nov 29, 2019

Hi @jgromes
Right, there is a typo issue in the variant.h:

#define PB0 48 // A3
#define PC1 19 // A4
#define PC0 50 // A5

should be 49

@fpistm fpistm added the bug 🐛 Something isn't working label Nov 29, 2019
@fpistm fpistm added this to the 1.8.0🎄 🎅 milestone Nov 29, 2019
@fpistm fpistm self-assigned this Nov 29, 2019
@fpistm fpistm closed this as completed in 119d793 Nov 29, 2019
@fpistm
Copy link
Member

fpistm commented Nov 29, 2019

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.

About that, this is normal as AF is not used for basic GPIO usage.

@jgromes
Copy link
Contributor Author

jgromes commented Nov 29, 2019

Can confirm this is working on the hardware now, thanks :)

About that, this is normal as AF is not used for basic GPIO usage.

Yep, I probably could have noticed PC1 pin number in variant.h doesn't exactly match the others.

@fpistm
Copy link
Member

fpistm commented Nov 29, 2019

No worry 😉 and welcome.
Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants