How do I generate an Output Compare square wave on TIM8_CH2N using STM32CubeIDE?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-07 7:42 AM
I'm working with the STM32F407G-DISC1 development board and I would like to generate a square wave on PB14 (TIM8_CH2N). I'm able to successfully toggle PB14 using "bit-banging" and I'm able to successfully generate square waves PC6 (TIM8_CH1) and PC8 (TIM8_CH3). However, no matter what I do, I can't make TIM8 output anything on PB14 (TIM8_CH2N). Does anybody know what I'm doing wrong (please see attached screenshot)? Please note that I can't use any other timer/pin instead.
Solved! Go to Solution.
- Labels:
-
STM32F4 Series
-
TIM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-08 12:06 AM - edited ‎2024-05-08 12:18 AM
TIMx_BDT->MOE is being set in HAL_TIM_OC_Start. I solved it like this instead:
HAL_TIM_OC_Start(&htim8, TIM_CHANNEL_2);
TIM8->CCER |= TIM_CCER_CC2NE;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-07 8:13 AM
Hello @arnold_w,
Try enabling the main output of the timer, which is necessary for advanced-control timers like TIM8
using __HAL_TIM_MOE_ENABLE(&htim8) or by registers BDTR.MOE
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-08 12:06 AM - edited ‎2024-05-08 12:18 AM
TIMx_BDT->MOE is being set in HAL_TIM_OC_Start. I solved it like this instead:
HAL_TIM_OC_Start(&htim8, TIM_CHANNEL_2);
TIM8->CCER |= TIM_CCER_CC2NE;
