I was able to get frequency this way inside a function that needs this to perform PID calculations:
now = chTimeNow();
sampleFreq = 1.0 / ((now-lastupdate) / (CH_FREQUENCY / 1.0));
lastupdate = now;
However my code is running so fast that I'm getting always 1000Hz or 500Hz(only 1 ...
Search found 6 matches
- Fri Jun 22, 2012 7:39 pm
- Forum: AVR Support
- Topic: Arduino's millis(), micros() equivalent in chibios
- Replies: 12
- Views: 22068
- Fri Jun 22, 2012 7:34 pm
- Forum: General Support
- Topic: PWM using decade counter
- Replies: 8
- Views: 7107
Re: PWM using decade counter
There is an example using DMA data to update TIM CCR from ST STM32F4 DSP lib. Maybe it could suit your requirement.
/**
@page TIM_DMA TIM DMA example
@verbatim
******************** (C) COPYRIGHT 2011 STMicroelectronics *******************
* @file TIM/DMA/readme.txt
* @author MCD ...
/**
@page TIM_DMA TIM DMA example
@verbatim
******************** (C) COPYRIGHT 2011 STMicroelectronics *******************
* @file TIM/DMA/readme.txt
* @author MCD ...
- Mon May 28, 2012 10:00 pm
- Forum: Development and Feedback
- Topic: Time measurement unit.
- Replies: 12
- Views: 12782
Re: Time measurement unit.
Wow ! It is simple as you said.
Thank you very much for your help.
Thank you very much for your help.
- Mon May 28, 2012 7:10 pm
- Forum: Development and Feedback
- Topic: Time measurement unit.
- Replies: 12
- Views: 12782
Re: Time measurement unit.
Hi,
Do you have any code snippets to show how to use this time measurement driver?
Thanks.
Do you have any code snippets to show how to use this time measurement driver?
Thanks.
- Fri May 25, 2012 9:44 am
- Forum: General Support
- Topic: Maximum PWM clock frequency on STM32F4
- Replies: 5
- Views: 10853
Re: Maximum PWM clock frequency on STM32F4
Thanks very much Giovanni.
I think I found my mistake. I set APB2 at 168MHz so I should use the frequency that makes the prescaler an integer.
Initially I thought that I could use any frequency that is less than APB2 and the prescaler calculation will take care of it. Obviously, if I use 20MHz, the ...
I think I found my mistake. I set APB2 at 168MHz so I should use the frequency that makes the prescaler an integer.
Initially I thought that I could use any frequency that is less than APB2 and the prescaler calculation will take care of it. Obviously, if I use 20MHz, the ...
- Thu May 24, 2012 10:50 pm
- Forum: General Support
- Topic: Maximum PWM clock frequency on STM32F4
- Replies: 5
- Views: 10853
Maximum PWM clock frequency on STM32F4
Hi,
I 'm not sure if you have come across this issue. It seems that I couldn't use more than 2 MHz for clock frequency when config the PWM.
I tried to create PWM signal of 10kHz frequency with complementary output + dead time so I config PWM as below (using 20MHz pwm clock frequency). But it ...
I 'm not sure if you have come across this issue. It seems that I couldn't use more than 2 MHz for clock frequency when config the PWM.
I tried to create PWM signal of 10kHz frequency with complementary output + dead time so I config PWM as below (using 20MHz pwm clock frequency). But it ...