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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
940 次查看
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 项奖励
回复
1 解答
926 次查看
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 项奖励
回复
3 回复数
919 次查看
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

915 次查看
jacco_bezemer
Contributor III

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

Thanks again Mario.

927 次查看
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 项奖励
回复