2025-08-28 1:20 AM
Hi,
For my application I need to output the same signal on 2 different IO Pins.
I need to use a timer because the signal has to have extremely accurate timing.
As a first iteration, I allocated 1 GPIO pin to TIM CH2 and the other GPIO Pin to TIM CH3.
I then asked myself the question of why am I wasting a timer channel 3 (which I could desperately use for other things). If the 2 signals will always be the same, why not just take another GPIO pin and write set the alternate function regitsers also to TIM2 CH2, obviously that will then change the specific IO Pin. But that doesn't concern me at this stage of development.
I then did this, and it works. I outputted the waveform from Timer 2 Channel 2 on two IO Pins simultaneously. I used Register Access level code to do this.
For interest sake, I wanted to then change a IOC file in CubeIDE to do the same thing I mentioned above and it's impossible. CubeIDE prevents me from doing this using their IOC settings. I don't care because I don't use any external libraries in my software and my application doesn't rely on anything from the IOC file. But I am curious if someone has an explanation as to why this happens ?. Is it not supposed to be possible in the silicon ?.
Thanks.
Solved! Go to Solution.
2025-08-28 4:19 AM - edited 2025-08-28 4:20 AM
ST does not allow setting two or more pins to the same AF (and in some RMs there's a sentence which is forbidding this, even if its wording is cumbersome), presumably for them to allow flexibility in the implementation.
In other words, you may find it is working, but you shouldn't rely on it.
JW
2025-08-28 4:19 AM - edited 2025-08-28 4:20 AM
ST does not allow setting two or more pins to the same AF (and in some RMs there's a sentence which is forbidding this, even if its wording is cumbersome), presumably for them to allow flexibility in the implementation.
In other words, you may find it is working, but you shouldn't rely on it.
JW