2022-07-25 05:34 PM
I 'v been driven creasy since some days, cause I did not find a way to switch off the PWMs at one channel of timer 1 ( CH1 an CH1N ie.) in order to use these pins controlled by normal GPIO commands on the fly,while the other channels shoud work again in PWM mode.
I thougt simple I could change the MODER register, select GPIO PP Mode program the Pins and it would work - but nothing works so. The PWM did not hide. They are always present at the pin and not the ODR content.
The PWM wont never stop at these pins even when I changed the MODER register and programmed out these two pins in the ODR Register the ODR signals will not leave the chip always the PWMs .
Who can help me ? What I did wrong ? the Lock Register ic completely cleared.
Thank you for answes.
Reinhard
2022-07-25 08:27 PM
What STM32 part are we talking about?
You should be able to disassociate AF connectivity on a pin-by-pin basis
2022-07-25 11:46 PM
If using stm32f103, the alternate function system on newer devices has made progress since then....
2022-07-26 01:47 AM
STM32F04
2022-07-26 01:49 AM
Yes I will try that, May be I have to switch it to AF0(System) to switch the port back to ODR.
2022-07-26 01:49 AM
Tkank you for your comment.
Reinhard
2022-07-26 02:11 AM
> STM32F04
What's that? STM32F042?
> May be I have to switch it to AF0(System) to switch the port back to ODR.
No, just switch given pin's GPIO_MODER setting from 0b10 (AF) to 0b01 (Out).
Read out and check/post content of relevant GPIO registers before and after the switch. You can do it in debugger, without writing any code.
JW
2022-07-28 09:37 AM
sorry wrong typed ST32F405.
Hello Jan, Thanks a lot for your answer, Yes you are right this works, I tried it and imediately it works, indepedent from changing other registers and alternete functions and so on. Thank you very much.
I tried this at the first of all but in this test i forgot to unplug the motor and all three PWM outputs were connected together by the motor coils of some mOhms. So I never saw the result of my activities. The visibility of the PWMs of the other phases made me believe it would not work.
When I remarked this, I plugged off the load and it worked. Somtimes it happens such a stupid failure.
Thanks for your help.
Reinhard
2022-07-28 01:18 PM
Thanks for coming back with the solution. It's sometimes not that easy to spot this kind of mistake.
JW