Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I am trying to use a hardware timer to change the pulse rate of the pwm every 32 microseconds.

I tried something out but I can't get it working.Can somebody post an example of the hardware timer usage or is there an app that already uses it?

Inside create() function,

 

devlpm_registerForLowPowerQueries(ws_upgrade_uart_device_lpm_queriable, 0);//callback returns 0

//register callback when pwm time expires

hw_timer_register_timer_expired_callback((HW_TIMER_EXPIRED_CALLBACK_FN)pwm_callback);//register callback

pwm_setReset(1 << PWM3, 0);

pwm_start(PWM3, PMU_CLK,pwm_init,pwm_toggle);// Enable Output of the PWM

gpio_configurePin((GPIO_PIN_P13) / 16, (GPIO_PIN_P13) % 16, PWM3_OUTPUT_ENABLE_P13, 0);

hw_timer_start(35);     //start timer

void pwm_callback(void){

  if(pwm_toggle==0x3FF)

       pwm_toggle=0x3BF;

  else

       pwm_toggle++;

  pwm_start(PWM3, PMU_CLK,pwm_init,pwm_toggle); change the pwm pulse rate

  hw_timer_start(35);

}

}}

Can anyone verify if I am doing something wrong here?

Any help is appreciated.

Thanks.

0 Likes
1 Solution
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

Is this related to the dialog you also have created here: BCM20737S Timer Module

If I recall correctly, you also had a question related to the need to to change the PWM parameters every ~30uS and our developers indicated that any timers set to below ~3.5mS are not guaranteed to work and that using the timer in this manner will likely trip the watch dog. It seems that what you ultimately want to accomplish is not possible.

View solution in original post

0 Likes
2 Replies