/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / PWM duty cycle

Username:     
Password:     
             

Forum

# 1   2007-12-21 13:54:40 PWM duty cycle

Daniel Wee
New member
Registered: 2007-11-04
Posts: 7

PWM duty cycle

Is it possible to write directly to TIMx_CCRy to change the PWM duty cycle? Or is there some other way using the API. Right now, it looks like I have to use TIM_OCInit for each change to the duty cycle. Is there a better way of doing this? Thanks.

Daniel

Offline

 

# 2   2007-12-21 14:19:51 PWM duty cycle

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: PWM duty cycle

Yes, you may change whatever you wish. For the specific case of the backlight (TIM4), there is dedicated function (LCD_SetBackLight) in CircleOS.

HOWEVER:
The only important rule consists in restoring the initial state when exiting from any application (we have to keep in mind the multi-application concept of the CircleOS). Indeed, if you don't restore properly the context of the peripherals, you should ceate some problems for the next applications that will be launched.
By default, the function MENU_Quit() restores the main settings of the Primer, but it does not reset all the internal peripherals. This task is attached to each application and must be done when exiting the application.

Offline

 

# 3   2007-12-21 15:02:57 PWM duty cycle

Daniel Wee
New member
Registered: 2007-11-04
Posts: 7

Re: PWM duty cycle

Thanks Francis. It appears that the LCD routine is doing what I am already doing, that is using the TIM_OC functions. I was wondering if it would be a bad idea to skip the hardware abstraction in the API and write directly to the CCR register. Additionally, are these register addresses pre-defined anywhere?

Daniel

Offline

 

# 4   2007-12-21 15:17:39 PWM duty cycle

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: PWM duty cycle

In CircleOS, we use the STM32 library to address the hardware registers. If you prefer to address directly the registers, look at the STM32 library (located at Program Files\Raisonance\Ride\Lib\ARM\STM32F10x_LIB\).
Francis

Offline

 

Board footer