AnsweredAssumed Answered

STM32F405: GPIO config cannot be changed without EXTI DeInit

Question asked by felix-w on Jun 12, 2015
Latest reply on Jun 17, 2015 by felix-w

i have PC9 (and some other pins) configured for PWM output and also use an external interrupt on that same pin to get an IRQ on every edge of the PWM. This all works perfectly fine, although in the reference manual RM0090 under point 8.3.8 one can read: "To use external interrupt lines, the port must be configured in input mode[...]".

Only when I try to change the GPIO configuration of this pin, I am running into very strange problems.
For example if I want to change the I/O type of PC9 in the MODER register from alternate function to input, this modification is not applied and I can also see that the register value is not altered when debugging. Instead the pin is now sitting on round about 1,6V (Vcc/2) with a rather large ripple on top.

After this failed reconfiguration I get stuck in an endless loop of ISRs from EXTI9_5 (the external interrupt for PC9), which seems to be caused by the voltage floating right around the threshold level.

This leads to a few questions:

1. What exactly can prevent the GPIO registers from getting changed?

2. How can I reconfigure the GPIO without fully disabling and afterwards re-enabling the external interrupt?

3. Why does PC9 put out about half the supply voltage, how is this even possible and how do I prevent this strange behaviour?

I would appreciate it, if anybody could help me out.

Thanks in advance!