how to only output stm32 pwm CH1N and disable CH1, in "pwm generation CH1 CH1N" mode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-20 11:49 PM
the below code is not working for me
//HAL_TIM_PWM_Start(&htim15,TIM_CHANNEL_1);
HAL_TIMEx_PWMN_Start(&htim15,TIM_CHANNEL_1);
Solved! Go to Solution.
- Labels:
-
TIM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-22 12:54 AM
CH1N is controlled by the same channel as CH1, except that CH1N is inverted (we will leave out details such as the dead time required for half bridges for this consideration). If you want to control two DC motors separately, you also need two separate PWM channels, consequently 9 PWM channels for 9 DC motors.
Since we don't know yet which STM32 you want to use, we can't give a hint yet.
Regards
/Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-21 3:06 AM
Hello @Davi​ ,
You can use this code, it works fine:
HAL_TIM_PWM_Start(&htim15, TIM_CHANNEL_1);
HAL_TIMEx_PWMN_Start(&htim15, TIM_CHANNEL_1);
Foued
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
‎2023-03-21 3:18 AM
- Yes, when enable HAL_TIM_PWM_Start(&htim15, TIM_CHANNEL_1); and HAL_TIMEx_PWMN_Start(&htim15, TIM_CHANNEL_1); then PWMN channel is working,
- But I just want to enable CH1N or CH1 at one time, not enable both CH1N and CH1
- ​
​
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-21 3:59 AM
I think you should set PWM on CH1 and CH2N :
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_2);
Foued
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
‎2023-03-21 6:42 PM
The problem is I have 9 DC motor, all motors are need pwm,
so I want to use CH1 and CH1N seperatly to control 2 motor
can I do this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-22 12:54 AM
CH1N is controlled by the same channel as CH1, except that CH1N is inverted (we will leave out details such as the dead time required for half bridges for this consideration). If you want to control two DC motors separately, you also need two separate PWM channels, consequently 9 PWM channels for 9 DC motors.
Since we don't know yet which STM32 you want to use, we can't give a hint yet.
Regards
/Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-22 11:06 PM
Thank you, STM32G070RB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-22 11:52 PM
With the STM32G070RB you are able to control up to 10 PWM channels:
- TIM1, ch1...4
- TIM3, ch1...4
- TIM15, ch 1...2
Think that's enough for your 9 motors?
Regards
/Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-22 11:56 PM
yes, thank you very much​
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-23 12:46 AM
You're welcome!
When your question is answered, please mark this topic as answered by choosing Select as Best for the preferred answer, as also explained here. This will help other users find that answer faster.
Good luck!
/Peter
