Timer interrupt callback not being called

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

Timer interrupt callback not being called

758 Views
weifoong_lim
Contributor I

I am using JN5168, JN-AN-1218-Zigbee-3-0-Light-Bulb as a baseline code for a lighting control application.

In my code, I have implemented a PWM using Timer 1 with interrupt. However, when I tried to run the code, the interrupt callback function is not being called. Here's my code for the PWM initialization:

PRIVATE void DriverBulb_vInit(void) {
    // Enable period interrupt generation and PWM output
    vAHI_TimerEnable(E_AHI_TIMER_1, 0, FALSE, TRUE, TRUE);

    // Register interrupt callback
    vAHI_Timer1RegisterCallback(vISR_DriverBulbTimer);

    // Start Timer1 as single-shot mode
    vAHI_TimerStartSingleShot(E_AHI_TIMER_1, 11, 10);
}

void vISR_DriverBulbTimer(uint32 u32DeviceId, uint32 u32ItemBitmap) {
    if ((u32DeviceId == E_AHI_DEVICE_TIMER1) && (u32ItemBitmap & 0x01)) {
        DBG_vPrintf(TRUE, "ISR Called\n");
    }
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

May I ask if there's anything else needs to be configured in order for the timer (or pwm) to work? Also, is there a need to edit the ISR file irq_JN516x.S?

Thank you in advance for your help!

Labels (1)
Tags (3)
0 Kudos
1 Reply

512 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi,

May I ask if there's anything else needs to be configured in order for the timer (or PWM) to work? Also, is there a need to edit the ISR file irq_JN516x.S?

Yes you need to set up the priority to the timer that you are using


.byte 0 # timer1 priority

.word vISR_Timer1                      # 13

Regards,

Mario

0 Kudos