This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

timer interrupt problem, hlep me

Hello. i useing keil v4, s110 softdevice, nrf51822 ek boards. I want to check my runtime. So i use under the app_timer

app_timer_create(&m_heart_rate_timer_id, APP_TIMER_MODE_SINGLE_SHOT, timeOut);   
app_timer_start(   m_heart_rate_timer_id, HEART_RATE_MEAS_INTERVAL, NULL);     
app_timer_cnt_get(&time1);

for(i=0; i<10000; i++){
LEA_Keyschedule(rndkeys, key);      
}

app_timer_cnt_get(&time2);  
app_timer_cnt_diff_compute(time2, time1,&time_diff);        
app_timer_stop_all();
app_timer_cnt_get(&time2);      
app_timer_cnt_diff_compute(time2, time1,&time_diff);        
app_timer_stop_all();

But if the under for loop 1000rounds,it has 1192us ( 12us each). And.. more than 10000rounds , it has 202738us( 20us each). More and more, it has more values each.

so i found it is interrupt problem.

app_timer_cnt_get(&time1);
__disable_irq();
{
function~~~~();
}
__enable_irq();

app_timer_cnt_get(&time2);	

it has same value.

but...... if i call the function repeat like:

app_timer_cnt_get(&time1);
__disable_irq();
{

for(int j=0;j<num;j++)
function~~~~();
}
__enable_irq();

app_timer_cnt_get(&time2);

but the num is bigger, the board doesn't work. maybe the power interrupt...etc

how can i check the function; I want to check more than 10000

Related