[DONE] STM32F30x advanced timer center aligned PWM

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [DONE] STM32F30x advanced timer center aligned PWM

Post by Giovanni »

Thanks, fixed the above as well (#474).

Giovanni
tecnologic
Posts: 124
Joined: Tue Jan 10, 2012 8:42 am
Has thanked: 21 times
Been thanked: 5 times

Re: [DONE] STM32F30x advanced timer center aligned PWM

Post by tecnologic »

Hi Giovanni,

do you have any idea how to read the register values of the F30x cause Embedded Register view does not support this cpu.

If not i have to read them to a copy of the structure from the ST header. what a pain in the ass.

Regards

Tec
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [DONE] STM32F30x advanced timer center aligned PWM

Post by Giovanni »

Hi,

The XXXDriver structure has usually a pointer to the peripheral registers block, you can use the Eclipse Expressions view and reach the peripheral through the pointer. Use PWMD1 as expression for example.

Giovanni
hkerner
Posts: 24
Joined: Tue Jul 22, 2014 12:05 am

Re: [DONE] STM32F30x advanced timer center aligned PWM

Post by hkerner »

Hi everyone,

I was wondering if there is a straightforward way now to set the bits in the CR1 register for TIM3 and TIM4 on STM32F4, or should I just do:

TIM4->CR1 |= ... ?

Also wondering what the defaults are for CR1. Thank you!!
tecnologic
Posts: 124
Joined: Tue Jan 10, 2012 8:42 am
Has thanked: 21 times
Been thanked: 5 times

Re: [DONE] STM32F30x advanced timer center aligned PWM

Post by tecnologic »

Hi for CR1 i do things like :

Code: Select all

 // Start timer
   pwmStart(pwmp, &pwmcfg);
   /*
    * Setup the timer in center aligned mode.
    * The interrupt flags for pwmpcb function call are
    * only set when up counting. With the duty at nearly 100%
    * we pre trigger the adc from this int by 100%-duty%
    */
   (pwmp)->tim->CR1 |= STM32_TIM_CR1_CMS(2);


may be an config value is needed to support settings like centeraligned PWM.

regards

Tec
Post Reply