- Adds functions to start and read ARM timer which runs at higher speeds (250 MHz) and gives finer timing resolution compared to system timer (runs at 1 MHz). However, its clock source can be dynamically change (ie low power mode etc), hence timing accuracy may change based on this behavior of the system.
- Suggested use for short busy waits (ie less than 5000 nsec). Based on experiments, ~180-200 nsec delays seem achievable, shorter delays seem not possible (see output of test program)
- Tested on, Raspberry Pi 1 Model B, Raspbian Buster, kernel 5.10.63.
#include "arm_timer.h"
in your code along with#include <bcm2835.h>
.- First
bcm2835_init()
then callbcm2835_arm_timer_init()
andbcm2835_arm_timer_enable()
. - See
test.c
for further detail. - After build, run with sudo.
- Reference work
- Based on bcm2835 library
- ARM peripheral details document
- Origin repo at github.com/eardali
Distributed under the terms of the MIT license.