PWM Channel N

mikroC, mikroBasic and mikroPascal for PRO ARM® MCUs, supporting STM32, Tiva, Kinetis, & CEC devices
Post Reply
Author
Message
dquy05
Posts: 40
Joined: 20 Apr 2014 11:00

PWM Channel N

#1 Post by dquy05 » 01 Dec 2020 04:10

Hi !

I need to use PWM of STM32F4, mode Channel N,
ex : PWM_TIM1_Start(_PWM_CHANNEL1, &_GPIO_MODULE_TIM1_CH1N_PE8); // setup channel N
But Mikroc don't support !

Can you help me !
Thanks!

User avatar
filip.grujcic
Posts: 822
Joined: 14 May 2018 08:34

Re: PWM Channel N

#2 Post by filip.grujcic » 01 Dec 2020 15:43

Hello,

Which MCU are you using?

Regards,
Filip Grujcic

dquy05
Posts: 40
Joined: 20 Apr 2014 11:00

Re: PWM Channel N

#3 Post by dquy05 » 02 Dec 2020 02:08

filip.grujcic wrote:
01 Dec 2020 15:43
Hello,

Which MCU are you using?

Regards,
Hi !

I used STM32F407VGT6,
Mikroc can't creat a PWM channel N,
PWM_TIM1_Start(_PWM_CHANNEL1, &_GPIO_MODULE_TIM1_CH1N_PA7); // note CH1N

Thanks !

dquy05
Posts: 40
Joined: 20 Apr 2014 11:00

Re: PWM Channel N

#4 Post by dquy05 » 31 Jan 2021 04:28

Hi All !

Can anyone help me?

Thanks!

User avatar
filip.grujcic
Posts: 822
Joined: 14 May 2018 08:34

Re: PWM Channel N

#5 Post by filip.grujcic » 03 Feb 2021 15:20

Hello,
dquy05 wrote:
02 Dec 2020 02:08
I used STM32F407VGT6,
Mikroc can't creat a PWM channel N,
PWM_TIM1_Start(_PWM_CHANNEL1, &_GPIO_MODULE_TIM1_CH1N_PA7); // note CH1N

Thanks !
You have to enable the CCxNE bit in the TIMx_CCER register prior to calling the PWM_TIMx_Start() function.
In this case, add TIM1_CCER.B2 = 1; before your PWM_TIM1_Start(_PWM_CHANNEL1, &_GPIO_MODULE_TIM1_CH1N_PA7);

Also, I assume you added the _GPIO_MODULE_TIM1_CH1N_PA7 structure yourself? In case this doesn't work, please zip and attach your __Lib_GPIO_32F4xx_Defs.c file for inspection. It's located in:
C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for ARM\Uses\ST M4

Regards,
Filip Grujcic

dquy05
Posts: 40
Joined: 20 Apr 2014 11:00

Re: PWM Channel N

#6 Post by dquy05 » 04 Feb 2021 16:19

Thank you so much !

It works very well !

Regards !
filip.grujcic wrote:
03 Feb 2021 15:20
Hello,
dquy05 wrote:
02 Dec 2020 02:08
I used STM32F407VGT6,
Mikroc can't creat a PWM channel N,
PWM_TIM1_Start(_PWM_CHANNEL1, &_GPIO_MODULE_TIM1_CH1N_PA7); // note CH1N

Thanks !
You have to enable the CCxNE bit in the TIMx_CCER register prior to calling the PWM_TIMx_Start() function.
In this case, add TIM1_CCER.B2 = 1; before your PWM_TIM1_Start(_PWM_CHANNEL1, &_GPIO_MODULE_TIM1_CH1N_PA7);

Also, I assume you added the _GPIO_MODULE_TIM1_CH1N_PA7 structure yourself? In case this doesn't work, please zip and attach your __Lib_GPIO_32F4xx_Defs.c file for inspection. It's located in:
C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for ARM\Uses\ST M4

Regards,

Post Reply

Return to “ARM PRO Compilers”