STM32F7 - Switch from alternate function to normal pushpull

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
elagil
Posts: 94
Joined: Tue Sep 19, 2017 7:38 am
Has thanked: 8 times
Been thanked: 7 times

STM32F7 - Switch from alternate function to normal pushpull

Post by elagil »

Hello!

I have a problem when switching pin modes. First, a pin is used as normal output (push/pull) and I can switch it without problems.

Then, the pin is reused as a PWM output, so it has to be changed to an alternate function pin like this:

Code: Select all

palSetLineMode(LINE_FPGA_INOUT0, PAL_MODE_ALTERNATE(2));


I get PWM output as expected. However, if I want to use the pin as normal push/pull output again, after using

Code: Select all

palSetLineMode(LINE_FPGA_INOUT0, PAL_MODE_OUTPUT_PUSHPULL);


I cannot switch the pin manually anymore. Am I missing something? Why can it not be switched back to a normal push/pull pin again?

Thanks in advance,
Adrian
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F7 - Switch from alternate function to normal pushpull

Post by Giovanni »

Hi,

It should be possible to switch back, could you inspect the content of the related GPIO registers and see if the settings are those you would expect?

Giovanni
Post Reply