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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

ソリューションへジャンプ
2,136件の閲覧回数
nguyenanhgiau10
Contributor IV

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.

ラベル(2)
タグ(2)
0 件の賞賛
返信
1 解決策
1,785件の閲覧回数
mario_castaneda
NXP TechSupport
NXP TechSupport

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

元の投稿で解決策を見る

0 件の賞賛
返信
5 返答(返信)
1,786件の閲覧回数
mario_castaneda
NXP TechSupport
NXP TechSupport

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

0 件の賞賛
返信
1,785件の閲覧回数
nguyenanhgiau10
Contributor IV

I got it. Thanks Mario.

By the way, how do I use PWM on JN5169? Can u give me an example using PWM?

0 件の賞賛
返信
1,785件の閲覧回数
mario_castaneda
NXP TechSupport
NXP TechSupport

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

0 件の賞賛
返信
1,785件の閲覧回数
nguyenanhgiau10
Contributor IV

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?

0 件の賞賛
返信
1,785件の閲覧回数
nguyenanhgiau10
Contributor IV

Great Mario,

Thank you so much!

0 件の賞賛
返信