StarterWare DMTimer BBB

Hi everyone,

I know that this forum is more for questions with linux, but I´ve found some solutions in this forum to bare metal questions, so I am sure that you could help me.

I am using the ti-starterware with the BBB, I ran the example ti\AM335X_StarterWare_02_00_01_01\examples\beaglebone\dmtimer, but I have a question on, how could I modify the time interval?

I understand that the defines are the key, but what’s the equation to get the counter value for a specific time (near to 200 us)?

#define TIMER_INITIAL_COUNT (0xFF000000u)
#define TIMER_RLD_COUNT (0xFF000000u)

I was trying to get the documentation but all I found was links to the wiki page (which is off line). I will appreciate any help.


When the timer wraps round it will get loaded with the reload value and continue counting.

If counting up, it is going the wrap around after 16777215 clocks with that reload value. I assume the timers are 32 bits given those values.

What period that is, will depend on the frequency of the timer clock. If you want a shorter period increase both of those #defines (assumes timer counts up)

To calculate an accurate value, you will need to know what the input clock is.
There will almost certainly be some sort of prescaler in there to reduce the main clock. Ideally you want to clock the timer at nice value such as 1Mhz, where a count of 1 will equaly 1us, or maybe 10Mhz for 0.1us resolution.

If generating PWM’s there will be a match register in there also with a value between the reload value and the end of count value.

Hi @benedict.hewson ,

You are right, that is a 32 bits timer and the input clock is 32.768KHz, I finally found in TI documentation that the resolution is 31.25us

With the information that you provided to me, I could get the counters. I will use a 125 us period, so I must increase the defines until 0xFFFFFFFB to get the interruption that I want.

Thaks a lot