USING INTERRUPT TIMER IN EXAMPLE JN-AN-1218-Zigbee-Light-Bulb - 2

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

USING INTERRUPT TIMER IN EXAMPLE JN-AN-1218-Zigbee-Light-Bulb - 2

1,564 Views
minhtan_uet
Contributor III

Relate to : 

https://community.nxp.com/message/943998
https://community.nxp.com/message/1138312
For test timer, I have added function App_vInitTimer0();


pastedImage_1.png

pastedImage_2.png

pastedImage_4.png
Add the service interrupt in theIn the irq_JN516x.S:
   .byte 5 # timer0 priority
   .word vTimer0ISR # 5

It does not call callback function.

anything wrong? Please let me know!
Thanks

Labels (5)
0 Kudos
5 Replies

1,186 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Tran,

Could you please try the code below?

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

vAHI_Timer0RegisterCallback(APP_isrTimer0);

vAHI_TimerEnable(E_AHI_TIMER_0, 8, TRUE, TRUE, FALSE);

vAHI_TimerConfigureOutputs(E_AHI_TIMER_0,FALSE,TRUE);‍‍‍‍‍‍‍‍

vAHI_TimerStartRepeat(E_AHI_TIMER_0, 350,700);

Hope it helps,

Regards,

Mario

0 Kudos

1,186 Views
minhtan_uet
Contributor III

Thanks for reply
It is my mistake when config timer0 in irq_JN516x.S
It work well :smileygrin:

0 Kudos

1,186 Views
minhtan_uet
Contributor III

Dear Mario Ignacio Castaneda Lopez Employé
How to caculate timer to call irsTimer?
as i know: time delay = 700 * 16us = 4.2 ms.

for ex: I want delay 1s , 10s , 1h
Thanks

0 Kudos

1,186 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Tran,

For example, if you want 10 ms for the interrupt, 

Timer clock frequency = Source clock frequency / 2u8Prescale

The clock is 16MHz so the time period is 0.0625micro seconds
Pre-escaler= 8
Clock by 2^8 = 256 hence multiplying the time period by 256
Timer clock will be 0.0625 * 256 = 16us

Time High =(10ms/16us)=625


vAHI_TimerStartRepeat(E_AHI_TIMER_0, 312,625);

pastedImage_3.png

For a better reference, please look at the JN516x Integrated Peripherals API User Guide

Regards,
Mario

0 Kudos

1,186 Views
minhtan_uet
Contributor III

Many thanks!
It help a lot. Have nice day :smileygrin:

0 Kudos