定时器0stops working as soon as connection happens

6 posts / 0 new
Last post
mohit3112
Offline
Last seen:8 months 1 week ago
Expert
加入:2014-08-04 13:45
定时器0stops working as soon as connection happens

定时器0interrupts stops on connection

i am using sdk 3.0.10.1

Device:
MT_dialog
Offline
Last seen:1 month 5 days ago
工作人员
加入:2015-06-08 11:34
Hi mohit3112,

Hi mohit3112,

Could you give me your setup ? Are you using sleep ? When using sleep the peripheral including the timers 0 and 2 are disabled, so i suppose that you dont use sleep and you have a ticking timer that interrupts in a predefined period, and when your device gets connected the interrupt never occurs, is that correct ?

Thanks MT_dialog

mohit3112
Offline
Last seen:8 months 1 week ago
Expert
加入:2014-08-04 13:45
yes after connection

yes after connection interrupt never occurs
here is my setup

static void init_timer_scheduler(void)
{
set_tmr_enable(CLK_PER_REG_TMR_ENABLED);
set_tmr_div(CLK_PER_REG_TMR_DIV_8);
timer0_set_pwm_high_counter(0);
timer0_set_pwm_low_counter(0);
timer0_init(TIM0_CLK_FAST, PWM_MODE_ONE, TIM0_CLK_DIV_BY_10);
timer0_set_pwm_on_counter(4000);
timer0_register_callback(scheduler);
timer0_enable_irq();
}

app_init_func(void){
struct flip_main_fsm_msg *msg = KE_MSG_ALLOC(FLIP_MAIN_FSM_MSG ,
TASK_APP, TASK_APP,
flip_main_fsm_msg );
msg->type = 0;
ke_msg_send(msg);
}

int flip_main_fsm_msg_handler(ke_msg_id_t const msgid,
const struct flip_main_fsm_msg *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
if(param->type ==0)
{
init_ppg_sensor();
init_timer_scheduler();
timer0_start();
}
else if(param->type == 1)
{
timer0_disable_irq();
timer0_stop ();
}
return (KE_MSG_CONSUMED);
}

I am not using any sleep modes

MT_dialog
Offline
Last seen:1 month 5 days ago
工作人员
加入:2015-06-08 11:34
Hi mohit3112,

Hi mohit3112,

I dont see anykind of behaviour like this, when advertising and connected the interrupts a occur as they should (i ve implemented your code in the custom profile example), the problem should be in the message handling of the start/stop of the timer, perhaps you send a stop message when the device is connected?

Thanks MT_dialog

mohit3112
Offline
Last seen:8 months 1 week ago
Expert
加入:2014-08-04 13:45
no i am not sending any

no i am not sending any messages to stop timer on connection of the device, I am sending a gapc_param_update request in app_connection function , but why this will stop the timer interrupts?

Aslo i am using sdk-3.0.10.1 and nexus 5 running android marshmallow

MT_dialog
Offline
Last seen:1 month 5 days ago
工作人员
加入:2015-06-08 11:34
Hi mohit3112,

Hi mohit3112,

No this shouldn't interfiere with the interrupts either, you cant run a simple test by activating the timer in the peripheral setup section and as soon as the 580 starts to operate start the timer and toggle a led, issue a connection and check if the timer keeps on toggling the led. Can you please check if the timer stops after connection with the setup i mentioned?

Thanks MT_dialog