Hi Dialog.
我成功添加了对需求方de timer0中断vice project. Every time the timer creates an interrupt, i read data from spi and then data are added into uart to ble buffer in order to send them via bluetooth. The timer interrupt handler is described below.
void SWTIM_Handler(void)
{
NVIC_DisableIRQ(SWTIM_IRQn);
readMcp3004();
my_timer_init(50000);
NVIC_EnableIRQ(SWTIM_IRQn);
}
void readMcp3004(void)
{
.....
app_uart_push((uint8_t*)&adcdata,2,rx_state_ptr);
app_ble_push((uint8_t*)&adcdata,2);
.....
}
My problem is that if i set the timer to create a relatively big number of interrupts (100 per second for example), my program stops working. In addition when i set the timer to create a smaller number of interrupts, my program works fine for some time (1-4mins) and then stops working. Could you please help me?
timer_hnd app_easy_timer(const uint16_t delay, void(*fn)(void)) ,
how to change the delay of the timer above with a variable. We will stop the timer before changing any settings. Is this possible through something like *(uint8_t *)&changeover_d . thoughts, the delay has to reflect on a user input
Hi kostakis,
Is your program in sleep mode or you have diabled sleep ? You mentioned that your program stops, where does it stop, can you see that your code is stack on a spi function ? on a sps
function ? the connection is kept alive, or there is a disconnection ? Perhaps the probelm is due to an spi failure to retrive data. Also you can try to use a kernel timer instead of a
normal timer, since normal timer are shut down when the 580 goes to sleep.
Hi gayan_gamage,
You can store the user input in a uint16_t variable and pass it to the timer function, like so, app_easy_timer(test, variable_timer_handler); seems that the compiler wont complain even
if the input is const.
Thanks MT_dialog
can timer2 interrupt? timer1 can regesiter callback,what aboat timer2?
Hi apple Li,
No, timer2 doesn't generate interrupts to the ARM processor, its only used for PWM generation.
Thanks MT_dialog