Author Topic: STM32 advanced Timer  (Read 6332 times)

0 Members and 1 Guest are viewing this topic.

Offline hamdi.tnTopic starter

  • Frequent Contributor
  • **
  • Posts: 623
  • Country: tn
STM32 advanced Timer
« on: February 05, 2016, 11:15:52 pm »
Hi, i recently used a microchip 16F chip to control a H-bridge using PWM Enhanced Mode capability. basically what it do, it will enable one output with a fixed level, and switch with a fixed duty cycle the complementary side on the other half bridge, with a single bit you can change the outputs configuration to change direction without touching any thing else.
example : fix B pulse C and then fix D and pulse A .am using this in as a pure Sin inventer and it works fine.
what i like the most is that am totally capable of switching direction by simply writing 1 bit.

what am trying to find is an equivalent capability in the STM32 family chips. i used F3,F1 and  F0 and i don't think i can figure out any timer configuration that will do the same thing with the same algorithm. what i did with the st chips that i have to manually stop one channel and switch to the other one, i took at least 4 instructions, while it's not fatal i had some bizarre wave slipping. it's like the period is not the same.

anyone know about a stm32 chips with timers that may work as described ?
« Last Edit: February 05, 2016, 11:40:26 pm by hamdi.tn »
 

Offline Sal Ammoniac

  • Super Contributor
  • ***
  • Posts: 1670
  • Country: us
« Last Edit: February 05, 2016, 11:37:03 pm by Sal Ammoniac »
Complexity is the number-one enemy of high-quality code.
 

Offline ve7xen

  • Super Contributor
  • ***
  • Posts: 1193
  • Country: ca
    • VE7XEN Blog
Re: STM32 advanced Timer
« Reply #2 on: February 06, 2016, 12:33:43 am »
Most of STM32F10x series has available 'Advanced-control' timers with complimentary output functionality. You can individually enable or disable timer control of either of the outputs in the same register, so I think this can accomplish exactly what you're looking for, using a single instruction to swap outputs.
73 de VE7XEN
He/Him
 

Offline hamdi.tnTopic starter

  • Frequent Contributor
  • **
  • Posts: 623
  • Country: tn
Re: STM32 advanced Timer
« Reply #3 on: February 06, 2016, 11:10:17 pm »
The Infineon XMC4400 series has timers that are well-suited for use with H-bridges. Just a thought in case the STM32 doesn't do what you want.

http://www.infineon.com/cms/en/product/microcontroller/32-bit-industrial-microcontroller-based-on-arm-registered-cortex-registered-m/32-bit-xmc4000-industrial-microcontroller-arm-registered-cortex-registered-m4/XMC4400-F100K512+AB/productType.html?productType=db3a30443784920501380a41329b6c87

thanks  :D i saw that and there is alot of documentation about using this chip with motor control.
while i will stick to my design for the inverter , i will certainly put this one on the list for a new project that involve motor control with H-bridge  :-+
 

Offline hamdi.tnTopic starter

  • Frequent Contributor
  • **
  • Posts: 623
  • Country: tn
Re: STM32 advanced Timer
« Reply #4 on: February 06, 2016, 11:14:52 pm »
Most of STM32F10x series has available 'Advanced-control' timers with complimentary output functionality. You can individually enable or disable timer control of either of the outputs in the same register, so I think this can accomplish exactly what you're looking for, using a single instruction to swap outputs.

yes they do, but it's not exactly what am looking for , complementary output will make both output give a PWM signal. and since it's a full bridge, 2 channels are needed, and as far as i tried you can't just pass one to an other just by a single instruction.
i could be wrong though just why am asking

i did use this stm32 timers capability (complimentary output with deadtime ) with push-pull step up transformer and worked perfectly, but it's not the same for the H-bridge
 

Offline hamdi.tnTopic starter

  • Frequent Contributor
  • **
  • Posts: 623
  • Country: tn
Re: STM32 advanced Timer
« Reply #5 on: February 06, 2016, 11:17:14 pm »
for reference this is the kind of signal am expecting
 

Offline TassiloH

  • Regular Contributor
  • *
  • Posts: 106
  • Country: de
Re: STM32 advanced Timer
« Reply #6 on: February 07, 2016, 12:00:27 am »
Look at the TIM1->CCER register (or also TIM8 on STM32F4xx devices). These timers have 4 output compare units and complimentary outputs for 3 of the output compare signals, so in total 7 outputs.

In the CCER register are bits to enable/disable each of these 7 outputs (enabled means the output state depends on the compare result, deadtime etc., disabled means the output goes to the inactive state). Furthermore there are bits to define the output polarity of each of the 7 outputs.

Thus by one write to the CCER register it should be possible to accomplish what you describe: Set some outputs to a fixed level by disabling them and set the polarity so that they have the desired level in the inactive state, and have the other (enabled) outputs switch as determined by the timer compare.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf