How to Use TIM1_CH1N using stm32duino core? #2287
-
Hi everyone, I'm using G474RE as a core of a FOC Driver. It's MOSFET Driver requires both high input and low input (half bridge). Originally it uses Timer 1 - Channel 1-3 as high inputs whileas CH1N-CH3N as low inputs, using HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_1). Is it possible to use this function under Arduino Framework just like in MDK? I couldn't find any TIM_HandleTypeDef objects :( |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
First did you read the wiki: If you want the handle you can use: Under the hood a pin is associated to a specific TIM channel, ex for TIM1_CH1: |
Beta Was this translation helpful? Give feedback.
Hi @China-Mr-Hou
I've tested with a Nucleo G474RE and the frequency is correct:
Same using the Generic target.
Don't know which board you use with a STM32G474RE, you probably use the generic G474RE variant and I guess you redefine the clock config? This can explain your issue as depending of your clock config the precision can be high or not.
By default the generic or the Nucleo variants are configured to the max freq 170MHz.
About having TIM1_CH1 and TIM1_CH1N together, this is not supported by the current HT implementation. I will provide a PR to allow this.
Here a workaround to be able to have it: