2023-02-07 04:10 PM
Hi,
I've just tried to set up TIM2 on an STM32G0B1RE in CubeMX like this:
The exact purpose shouldn't matter for this question, but the timer is supposed to generate an interrupt when a LOW pulse of a given minimum length is detected on an external signal, entirely in hardware. I already have a plan for how to do that.
The problem is that with this configuration, the ETR pin (for the gate input signal) actually seems to become an output! After some head scratching, I found that this only happens if I use specifically Channel 1 for Output Compare. I assume that's because ETR1 and CH1 are somehow connected internally and can't be freely used at the same time. It just surprises me that this matters even in "No Output" mode, and CubeMX did not stop me from configuring it this way. It DOES stop me from using "Output Compare CH1", the tooltip of which is so far the only indication that ETR1 and CH1 might be related that I could find. Admittedly I just skimmed the reference manual, but couldn't really find anything about this.
It's not really a problem for me, as I can just as easily use CH2 instead. I'm just curious: Am I right in thinking that CH1 and ETR1 are kind of "mutually exclusive"? And if so, is there a reason that CubeMX still allows you to configure it this way, or is it just an oversight?
Thanks!
Solved! Go to Solution.
2023-02-07 11:32 PM
CubeMX is not an authoritative information source, RM and DS are.
Yes, merging ETR and CH1 pins is frustrating and this combination best to be avoided. It may be that outside Cube/CubeMX what you want could be achieved, but if you can use CH2, use that and done.
JW
2023-02-07 11:32 PM
CubeMX is not an authoritative information source, RM and DS are.
Yes, merging ETR and CH1 pins is frustrating and this combination best to be avoided. It may be that outside Cube/CubeMX what you want could be achieved, but if you can use CH2, use that and done.
JW
2023-02-11 02:45 PM
Thanks! I didn't actually think about checking the AF table, that would have made it more obvious. I'll just use another channel then, no problem.