Timer interrupts on DSPS

5 posts / 0 new
Last post
Kostakis
Offline
Last seen:3 years 2 weeks ago
Joined:2015-01-20 16:15
Timer interrupts on DSPS

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?

Device:
gayan_gamage
Offline
Last seen:4 years 9 months ago
Joined:2016-04-28 21:23
timer_hnd app_easy_timer

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

MT_dialog
Offline
Last seen:2 months 1 week ago
Staff
Joined:2015-06-08 11:34
Hi kostakis,

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

apple Li
Offline
Last seen:2 years 2 months ago
Joined:2014-05-20 03:45
can timer2 interrupt? timer1

can timer2 interrupt? timer1 can regesiter callback,what aboat timer2?

MT_dialog
Offline
Last seen:2 months 1 week ago
Staff
Joined:2015-06-08 11:34
Hi apple Li,

Hi apple Li,

No, timer2 doesn't generate interrupts to the ARM processor, its only used for PWM generation.

Thanks MT_dialog

Topic locked