2020-12-29 05:15 AM
I have been following along with https://www.youtube.com/watch?v=-AFCcfzK9xc
and I can see that each change made in CubeMX produces changes in my generated code in main.c
However, I cannot find any generated code which links the Timer Output Channel 1 to my GPIO Pin PA5. Is it being saved somewhere else, or is it being saved in some obscure way that I've missed?
Solved! Go to Solution.
2020-12-29 05:40 AM
The whole Cube/CubeMX combo is obscure.
Normally, this "assignment" is through setting value corresponding to given peripheral (see table in Datasheet) into the field appropriate for given pin in respective GPIOx_AFR register (see GPIO chapter in RM).
So, this is GPIO-setup related.
I don't Cube, but AFAIK they like to put these things into a "MSP" callback, to be called from the timer initialization function, probably in a separate .c file (stm32XXXxx_hal_msp.c ?)
JW
PS. You've surely familiar with the Cube/CubeMX documentation:
2020-12-29 05:40 AM
The whole Cube/CubeMX combo is obscure.
Normally, this "assignment" is through setting value corresponding to given peripheral (see table in Datasheet) into the field appropriate for given pin in respective GPIOx_AFR register (see GPIO chapter in RM).
So, this is GPIO-setup related.
I don't Cube, but AFAIK they like to put these things into a "MSP" callback, to be called from the timer initialization function, probably in a separate .c file (stm32XXXxx_hal_msp.c ?)
JW
PS. You've surely familiar with the Cube/CubeMX documentation:
2020-12-29 06:23 AM
Excellent. You were correct, it is set up in stm32f4xx_hal_msp.c
I find it a little odd that most of the user defined setup is in main.c, and some bits in the _hal_msp file.
However, I am only just starting out with this, so I can't be critical!
Also, thanks for the reference to the HAL drivers documentation, I need to refer to it more!