Does someone have example code (in C) for setting up a 1ms timer that will compile and work in "bare-metal" (ie no OS) mode?
Thanks in advance!
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Does someone have example code (in C) for setting up a 1ms timer that will compile and work in "bare-metal" (ie no OS) mode?
Thanks in advance!
Hello Dean,
As you have not mentioned the platform I am assuming AM335x. StarterWare provides a bare metal environment for operating this SOC. More information and code can be obtained from
http://processors.wiki.ti.com/index.php/StarterWare
Currently there are no examples which describe the use of 1ms timer but there is an example which uses other timers (0 to 7 except 1 -which is the 1ms timer)
Please refer to the count down timer example provided. This example uses timer 2 to implement a count down timer. Dmtimer 0 to 7 and Dmtimer_1ms have a similar register set with few additional registers for Dmtimer_1ms( for generating an exact 1ms interrupt from a 32Khz clock) . Hence the dal files (dmtimer.c and dmtimer.h ) can be modified to be used with Dmtimer_1ms. AM335x TRM would list down the necessary changes.
In case your requirement is not stringent in terms of precision, you can modify the count down timer example to serve your purpose.
Vineeth:
Thanks for your reply.
However, I am working on a DM3730 (Beagleboard xM). Unfortunately there isn't any "Starterware" available for that CPU.
Is the "Dmtimer_1ms" available on the DM3730? This would probably do exactly as I need but I didn't see it in the tech. manual.
Thanks again!
Dean
Hello Dean,
I do not have much knowledge about the DM37xx platform but from the look of it the GPtimer register interface looks very similar to that of the AM335x . Hence you can refer StarterWare DAL file.
No I do not think a 1 ms timer exists on DM37xx you would need to use the GP timer.
Hi Dean,
I recommend you to use general purpose timer because its resolution is appropriate for interval of this magnitude. You can obtain more detailed description about GP timers of DM3730 from the TRM section 16.2 General-Purpose Timers at the link:
http://www.ti.com/lit/ug/sprugn4r/sprugn4r.pdf
BR
Tsvetolin Shulev