cancel
Showing results for 
Search instead for 
Did you mean: 

Hi All. What will happen if try to toggle pin with alternate function. Controller will ignore this command?

VAvag.1
Associate II
 
1 ACCEPTED SOLUTION

Accepted Solutions

If the pin is in SPI mode, trying to toggle it will not affect SPI communication. But if it's initialized as GPIO last, then clearly SPI mode won't work.

Unclear what "code written earlier" means exactly. Surely you can edit code to do what you want instead of what it did before. The order in which code is executed is going to affect things.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

7 REPLIES 7

GPIO->ODR​ or BSRR ain't going to work if that's their question. The AF mux will determine who owns control

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TDK
Guru

If a pin is in AF mode, the peripheral controls the pin state (input vs output) as well as its output state. ODR/BSRR is ignored in this case.

If you feel a post has answered your question, please click "Accept as Solution".
VAvag.1
Associate II

Thank You for response. I have activated SPI1 in f401re(nucleo board), but in code written earlier SCK was common GPIO, connected with LED, and this part of code wasn't commented. May it affect SPI functionality?

VAvag.1
Associate II

Thank You for answers.

If the pin is in SPI mode, trying to toggle it will not affect SPI communication. But if it's initialized as GPIO last, then clearly SPI mode won't work.

Unclear what "code written earlier" means exactly. Surely you can edit code to do what you want instead of what it did before. The order in which code is executed is going to affect things.

If you feel a post has answered your question, please click "Accept as Solution".
MM..1
Chief II

If your code control LED ODR/BSRR no , but if you activate other AF as PWM then SPI AF will ovrride...

Thank You!