I working on JN-AN-1218-Zigbee_Light-Bulb application. I want to use interrupt timer (e.g Timer 0). My configuration is below.
/*Initiate timer */
// clock is 16MHz so the time period is 0.0625micro seconds
// we are using pre-scaler value of 8 so it will divide the
// clock by 2^8 = 256 hence multiplying the time period by 256
// so the timer clock will be 0.0625 * 256 = 16 ,micro sec
vAHI_TimerEnable(E_AHI_TIMER_0, 8, FALSE, TRUE, FALSE);
vAHI_TimerClockSelect(E_AHI_TIMER_0, FALSE, FALSE);
// Registering the callback function
vAHI_Timer0RegisterCallback(vTimer0ISR);
// Starting the timer for single shot
vAHI_TimerStartSingleShot(E_AHI_TIMER_0, 500, 500); // 16us *500 = 8000 us (8ms)
My callback function:
PUBLIC void vTimer0ISR(uint32 u32DeviceId, uint32 u32ItemBitmap) {
DBG_vPrintf(TRUE, "\n callback ISR ");
//rest code
}
It don't call callback function.
anything wrong?
For this configuration, if I run it on simple project (without OS and ZPS), it is OK.
解決済! 解決策の投稿を見る。
Hi Giau,
Did you add the interrupt service routine in the irq_JN516X.s?
Enabled the interrupt channel priority and the vector table. For example
.byte 5 # timer0 priority
.word vTimer0ISR #5
Regards,
Mario
Hi Giau,
Did you add the interrupt service routine in the irq_JN516X.s?
Enabled the interrupt channel priority and the vector table. For example
.byte 5 # timer0 priority
.word vTimer0ISR #5
Regards,
Mario
I got it. Thanks Mario.
By the way, how do I use PWM on JN5169? Can u give me an example using PWM?
Hi Giau,
Please look at the LightingBoard.c file.
C:\NXP\bstudio_nxp\sdk\JN-SW-4170\Platform\DK4\Source
#define WHITE_LED_TIMER E_AHI_TIMER_3
vAHI_TimerEnable(WHITE_LED_TIMER, WHITE_LED_TIMER_PRESCALE, FALSE, FALSE, TRUE);
vAHI_TimerConfigureOutputs(WHITE_LED_TIMER, FALSE, TRUE);
vAHI_TimerClockSelect(WHITE_LED_TIMER, FALSE, TRUE);
//Set the level
vAHI_TimerStartRepeat(WHITE_LED_TIMER, gu16PwmLastValue , PWM_COUNT );
You will find the PWM set up for the light bulb.
Regards,
Mario
Hi Mario,
In JN-AN-1218-Zigbee-Light-Bulb Application, Timer4 also was decleared.
.byte 13 # pwm4 priority
.extern vISR_Timer4
.word vISR_Timer4 # 13
I don't see anywhere using timer4.
Correct me if I wrong?
Great Mario,
Thank you so much!