8 posts / 0 new
Last post
rraducu
Offline
Last seen:6 years 9 months ago
加入:2014-02-10 22:18
Timer0信息

Hello Dialog,

I am developing firmware on the DA14580-00 (SDK v2) and would like to know the following:

1) Is it possible to read the current value of Timer0?
2) Is there any sample code on how to setup an interrupt on Timer0?
3) Is it possible to run Timer0 on 32KHz AND divide the clock by 8 (i.e. run it at 4KHz) ?
4) Is it possible to run SDK v3 on DA14580-00?

Any help would be greatly appreciated.

Thank you,
Rares

WT_Dialog (not verified)
Hi Rares,

Hi Rares,
Please see my answer below:
1) Is it possible to read the current value of Timer0?
Yes. You can read TIMER0_ON_REG register to get the counter value.
2) Is there any sample code on how to setup an interrupt on Timer0?
Please refer to peripheral_example project in the SDK for timer interrupt. There are also documents available for this project.
The peripheral driver document could also help.
3) Is it possible to run Timer0 on 32KHz AND divide the clock by 8 (i.e. run it at 4KHz) ?
Timer0 is switched off in deep sleep and extended sleep mode.
4) Is it possible to run SDK v3 on DA14580-00?
Unfortunately not. Please run SDKV3 on DA14580-01.

Any help would be greatly appreciated.

mengzhongren
Offline
Last seen:6 years 11 months ago
加入:2014-04-30 17:16
Timer0 and timer2

Hi ,
Could I use timer0 and timer2 as counters? I want to count input signals. How to configure registers?

There is a 16MHz crystal oscillators in the system. If clock control registers could be use to improve system clock higher than 16MHz such as PLL?

WT_Dialog (not verified)
Hi,

Hi,
Do you mean you would like to generate an interrupt based on the number of input events?
If that is the case, WKUP_COMPARE_REG can be used. But this is not part of timer0 or 1. It is a different peripheral block, namely wake up timer.

Do you mean you would like to use a higher than 16mHZ clock frequency for the ARM core? Unfortunately this is not an option.
The max speed of ARM core is set to 16Mhz for power efficiency reasons.

mengzhongren
Offline
Last seen:6 years 11 months ago
加入:2014-04-30 17:16
Hi,

Hi,
I want to get the frequency of a square wave about 4~5 MHz, or generate an interrupt base on the number of this input pulse. Can DA14580 do it? Do you have some suggestion? Thanks!

WT_Dialog (not verified)
Hi,

Hi,
1. I want to get the frequency of a square wave about 4~5 MHz
Yes. Timer 0 and timer 1 can help you to do that. Please check the peripheral example, there is a PWM generator example that can surely help you to understand how to generate a square wave. As I mentioned in the previous answer, timer 0 and timer 1 cannot be used in extended/deep sleep mode.
2. generate an interrupt base on the number of this input pulse.
Yes. Please check the wake up timer peripheral unit. WKUP_COMPARE_REG can set the number of events up to which the interrupt is generated.

mengzhongren
Offline
Last seen:6 years 11 months ago
加入:2014-04-30 17:16
Hi,

Hi,
I don't want to generate a square wave. The square wave is an external input signal . I want to Measure the frequency of the input signal which frequency is about 4~5 MHz.
Or, in other way, could I count number of the input pulse with 4~5 MHz frequency and general an interrupt?

WT_Dialog (not verified)
Hi,

Hi,
I see.
ARM core runs at 16Mhz. 4~5Mhz is frequency detection could be tricky.
I would recommend to try WKUP_COMPARE_REG and set the number of events upto which an interrupt can be generated.
Other than that, pulling GPIO voltage could be the only option. But even with a while loop, to detect 4~5Mhz frequency, a while loop could be too slow for that. I do not see a solid software solution to your question.