Hi
I'm using AM3359 under linux (beaglebone black).
I have the following code, running in kernel mode (under timer interrupt, interrupts are disabled):
curr_guard_val = omap_dm_timer_read_counter(goard_timer_ptr); new_d_tick = US_TO_TICK(d_us) - (curr_guard_val - last_cap_val); /* set main timer */ omap_dm_timer_set_load(timer_ptr, 1, 0xFFFFFFFF - new_d_tick - US_TO_TICK(w_us) - 100); omap_dm_timer_set_match(timer_ptr,1, 0xFFFFFFFF - new_d_tick - 100); omap_dm_timer_write_counter(timer_ptr, 0xFFFFFFFF - new_d_tick); omap_dm_timer_set_pwm(timer_ptr, /*SCPWM*/ 0 , /*PT*/ 1, OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE); omap_dm_timer_start(timer_ptr); new_d_us = TICK_TO_US(new_d_tick); offset += TICK_TO_US(last_cap_val) - offset; end_handling = omap_dm_timer_read_counter(goard_timer_ptr);
The time for this simple code is 6-8 microsecond(very consistent), it was measured using (end_handling - curr_guard_val) and convert to microsecond. The CPU is working in 1Ghz and the relevant timers work with 24Mhz clock.
why does it take so long?
when the system is under-load(networking) the time for this code goes up to 12 microseconds. why?
Is it some how related to the post silicon errata titled "Delay Required to Read Some GP, WD, and Sync Timer Registers After Wake-Up" ?