Are there any known issues with timer configuration in CubeMX for the STM32F407VG?

@Middleware & OS I'm developing a low-level PID controller for motor speed control on an STM32F407VG microcontroller. I'm using the STM32CubeMX tool to generate the initial project setup. However, I'm encountering issues during timer initialization for the motor speed measurement. When I try to configure Timer 2 in CubeMX for capture mode, I get an error message stating
TIMx_CR1: Unable to configure Update Event source (URS) as it depends on the One Pulse Mode (OPM) bit.
TIMx_CR1: Unable to configure Update Event source (URS) as it depends on the One Pulse Mode (OPM) bit.
I've reviewed the STM32F4 reference manual and ensured the OPM bit is set to 0 (disabled) in the TIMx_CR1 register. However, the error persists. I'm using STM32CubeMX version 6.1.0. Can anyone advise on how to resolve this specific error and configure Timer 2 for capture mode for motor speed measurement on the STM32F407VG? Are there any known issues with timer configuration in CubeMX for this specific microcontroller? Here's a relevant snippet of my CubeMX timer configuration: Clock Source: Internal Clock (APB1 clock) Prescaler: 0 Auto-reload: 65535 (maximum count) One Pulse Mode (OPM): Disabled (cleared in TIMx_CR1) Update Event Source (URS): Update generation on counter overflow/underflow (selected in CubeMX)
Solution:
@UC GEE the issue with using the HAL is that its super easy to get started, however, when one does eventually get stuck its quite hard to get unstuck, since you need to debug the HAL and your code.
Jump to solution
9 Replies
ZacckOsiemo
ZacckOsiemo5mo ago
I have some code for input capture I however don't use the HAL
ZacckOsiemo
ZacckOsiemo5mo ago
GitHub
Implement Input Capture example · zacck/general_timers@023de2a
- Add Timer 2 in input capture mode - Try to expose LSE but its missing - Expose HSI to MC01 for testing input capture
Solution
ZacckOsiemo
ZacckOsiemo5mo ago
@UC GEE the issue with using the HAL is that its super easy to get started, however, when one does eventually get stuck its quite hard to get unstuck, since you need to debug the HAL and your code.
UC GEE
UC GEE5mo ago
Ok.. Thanks @ZacckOsiemo
UC GEE
UC GEE5mo ago
Please @ZacckOsiemo What modifications are required for HAL, assuming one is left with "HAL" as the only option for the coding?
ZacckOsiemo
ZacckOsiemo5mo ago
Thats a hard place to be in, I mean you could still implement it baremetal but just not use the HAL for this particular feature. Or you could debug the HAL
Marvee Amasi
Marvee Amasi5mo ago
Yh true
UC GEE
UC GEE5mo ago
Ok @ZacckOsiemo 👍
ZacckOsiemo
ZacckOsiemo5mo ago
Try and implement it outside of the HAL, you should have CMSIS and it is less than 20 lines of code
Want results from more Discord servers?
Add your server