- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I understand that your developers indicated that setting the timers below 3.5 mS is not a good idea but since the code inside the interrupt is extremely small and just changes the PWM , I thought I would give that a try.
You already have the library for it in place so I decided to give that a go and see if it works well with my application.
All I need is your help with an example code to set the hardware interrupt timer and execute some code when the timer expires.
I tested the above piece of code but that didn't work as expected.I would appreciate if there was a working example of the hardware timer as you have for other libraries.