Topic

FAQ
Login Register
There is a problem with timer irq of
Apr 14, 2023 09:21

/

A

/A

The figure below is a problem when using timers in the same way as "light_switch" in "telink mesh sdk".


I have to export IR output from "light_switch", so I send GPIO output using timer1. As shown in the picture below, there is a delay in the middle, so there is no proper output.

I set the pin to toggle constantly every 560us, but there is a delay in the middle as shown in the figure.




By any chance, have you ever been briefed on these symptoms?

Is there a solution?




There is no problem with the timer in "825x_BLE_SDK".

I m guessing there s a problem with the code in "telink mesh sdk", but it won t work even if you handle all the code in the main loop so it doesn t run.


There is no arbitrarily modified part of the sample code provided, but we just set the toggle pin on timer1.

However, sleep mode is disabled because sleep mode is not required.


The code used is as follows.



void light_hw_timer1_config(void){
    //enable timer1 interrupt
    reg_irq_mask |= FLD_IRQ_TMR1_EN;
    reg_tmr1_tick = 0;
    reg_tmr1_capt = CLOCK_MCU_RUN_CODE_1US * 560;
    reg_tmr_ctrl |= FLD_TMR1_EN;
}
void irq_timer1(void)
{

    static u8 a_irq_timer1;
    a_irq_timer1++;
    if(p_vendor_irq_timer1){
        p_vendor_irq_timer1();
        //return;
    }

    gpio_toggle(GPIO_PA1);

    // if(irq_timer1_cb_time && clock_time_exceed(irq_timer1_cb_time, cmd_left_delay_ms*1000)){
    //  cmd_left_delay_ms = 0;

    //  #if (PRINT_DEBUG_INFO)
    //  mini_printf("irq_timer1 ");
    //  #endif
       
    //  rf_link_data_callback((u8*)(&cmd_delay));
    //  cmd_delay_ms = irq_timer1_cb_time = 0;
    // }
}




1 replies
TL_Soyo Apr 14, 2023 13:26
0
/A

hi,

  why you use timer to control the GPIO,rather than the pwm, it delay may caused by some other higher interrupt .