Which timer to use for microsecond timings in JN-AN-1218-Zigbee-3-0-Light-Bulb based project

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Which timer to use for microsecond timings in JN-AN-1218-Zigbee-3-0-Light-Bulb based project

Jump to solution
825 Views
jacco_bezemer
Contributor III

I'm converting a project based on JN-AN-1171 to a project based on JN-AN-1218.

The project that i'm converting uses OS_eStartSWTimer to start a task every 78 microseconds. What timer can i use in a Zigbee 3 project?

I tried vAHI_TickTimerConfigure but it messes with the Driver_bulb timings. I can't use ZTIMER because it uses milliseconds.

0 Kudos
1 Solution
811 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi @jacco_bezemer,

You could use the next timer, but I do not know the requirements that you have

vAHI_TimerEnable

Please look at the next setup

PUBLIC void TMR_vInit(void)
{

 /* Make sure no DIO claimed by timer */
 vAHI_TimerDIOControl(E_AHI_TIMER_0, FALSE);

 /*Enable the Timer0*/
 vAHI_TimerEnable( E_AHI_TIMER_0,
 8, //uint8 u8Prescale,
 TRUE, //enable interupt on rising edge
 TRUE, //enable interupt on falling edge
 FALSE); //bool_t bOutputEnable);

 // Registering the callback function
 vAHI_Timer0RegisterCallback(APP_isrTimer0);

 vAHI_TimerStartRepeat( E_AHI_TIMER_0, //uint8 u8Timer,
 312, //uint16 u16Lo,
 625); //uint16 u16HI
}

 

In this code, the timer 0 interrupt is generated but not call this function at every 10ms, and also in the callback must clear the interrupt flag.

(void) u8AHI_TimerFired(E_AHI_TIMER_0);

Please let me know if you have any other questions.

Regards,

Mario

View solution in original post

0 Kudos
3 Replies
804 Views
jacco_bezemer
Contributor III

Hi Mario, that makes sense.

I can see that the timer is running but no interrupt is generated. Should i change something else?

And i don't understand this sentence "the timer 0 interrupt is generated but not call this function at every 10ms"

Kind regards,

Jacco

800 Views
jacco_bezemer
Contributor III

Sorry, mixed up irq_JN516x.S. Corrected it and now it works.

Thanks again Mario.

812 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi @jacco_bezemer,

You could use the next timer, but I do not know the requirements that you have

vAHI_TimerEnable

Please look at the next setup

PUBLIC void TMR_vInit(void)
{

 /* Make sure no DIO claimed by timer */
 vAHI_TimerDIOControl(E_AHI_TIMER_0, FALSE);

 /*Enable the Timer0*/
 vAHI_TimerEnable( E_AHI_TIMER_0,
 8, //uint8 u8Prescale,
 TRUE, //enable interupt on rising edge
 TRUE, //enable interupt on falling edge
 FALSE); //bool_t bOutputEnable);

 // Registering the callback function
 vAHI_Timer0RegisterCallback(APP_isrTimer0);

 vAHI_TimerStartRepeat( E_AHI_TIMER_0, //uint8 u8Timer,
 312, //uint16 u16Lo,
 625); //uint16 u16HI
}

 

In this code, the timer 0 interrupt is generated but not call this function at every 10ms, and also in the callback must clear the interrupt flag.

(void) u8AHI_TimerFired(E_AHI_TIMER_0);

Please let me know if you have any other questions.

Regards,

Mario

0 Kudos