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)?
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.
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.