The timer is a peripheral that allows the user to measure real-time as a number of clock cycles. A user loads the timer with the number of clock cycles they'd like to wait, and then polls the "Timeout" bit or optionally enables an interrupt to indicate to the processor that the period has elapsed.
Device | Timer | |||||||||||||||
Configuration | 32-bit mapped registers | |||||||||||||||
Input/Output | Both | |||||||||||||||
Address Base | 0xxFFFEC600 | |||||||||||||||
Address Map |
| |||||||||||||||
Initialization | None (though a period must be written before running the timer, or it will immediately timeout) | |||||||||||||||
Interrupts |
| |||||||||||||||
Hardware Setup | None | |||||||||||||||
Reference |
The timer counts downwards on a 200MHz clock, and runs in terms of clock cycles (a period of 500000000 will cause the timer to timeout in 1 second).
When a timeout occurs, the Timeout bit in the Control Register will stay as 1 until the user writes 1 to the status register.
When a timeout occurs, the timer's counter is reset to the pre determined period. The A bit determines whether the timer will then wait until 1 is written to the F bit or continue running immediately.
ldr r0, =0xFFFEC600 // r0 contains the base address for the timer mov r1, #2000 str r1, [r0] // Set the period to be 2000 clock cycles mov r1, #3 str r1, [r0, #8] // Start the timer continuing no interrupts