The callback function of Timer always Keep Running(of JN5169)

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

The callback function of Timer always Keep Running(of JN5169)

Jump to solution
4,918 Views
1979717461
Contributor III

When I use the Timer mode ,I don't know why the callback function always running!  I use the Function vAHI_TimerEnable() to   configure the timer1 ,and use vAHI_TimerStartSingleShot() to start the timer .

Relative detail can be seen fowlling:

Thanks for your help!

Tags (3)
1 Solution
4,471 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi,

You need to clear the interrupt flag.

SwVectTable

.globl  PIC_SwVectTable
    .
    .
    .extern vISR_Timer0
    .

 

Also, you must include the u8AHI_TimerFired API to clear the interrupt flag.

      (void) u8AHI_TimerFired(E_AHI_TIMER_0);

Regards,

Mario

View solution in original post

11 Replies
4,472 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi,

You need to clear the interrupt flag.

SwVectTable

.globl  PIC_SwVectTable
    .
    .
    .extern vISR_Timer0
    .

 

Also, you must include the u8AHI_TimerFired API to clear the interrupt flag.

      (void) u8AHI_TimerFired(E_AHI_TIMER_0);

Regards,

Mario

4,471 Views
1979717461
Contributor III

Hi,Mario

I am a beginner, Can I ask a question? I will be very grateful.

That is, must I set the interrupt priority level with the function vAHI_InterruptSetPriority()?

Look forward to your reply!

hs

0 Kudos
Reply
4,471 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi,

Look at the irq_JN516x.S the PIC_ChannelPriorities and PIC_SwVectTable. You can define the priority there.

Regards,

Mario

0 Kudos
Reply
4,471 Views
1979717461
Contributor III

Hi, Mario

I have already set it up in the .S file (irq_JN516x.S), however,if there is no the function  vAHI_InterruptSetPriority(), it can not enter the callback function, can you tell me where is wrong? Thank you!

Regards,

hs

0 Kudos
Reply
4,471 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi,

Please see the code below. look at the Timer 0

PIC_ChannelPriorities:
    .byte 0                 # pwm1 priority
    .byte 0                 # pwm2 priority
    .byte 15                # system controller priority
    .byte 7                 # MAC priority
    .byte 0                 # AES priority
    .byte 0                 # PHY priority
    .byte 0                 # uart0 priority
    .byte 0                 # uart1 priority
    .byte 5                 # timer0 priority
    .byte 0                 # spi slave priority
    .byte 0                 # i2c maste/slave priority
    .byte 0                 # spi master priority
    .byte 13                # pwm4 priority
    .byte 0                 # analog peripherals priority
    .byte 14                # pwm3 priority
    .byte 12                # tick timer priority


.globl  PIC_SwVectTable
    .section .text,"ax"
    .extern zps_isrMAC
    .extern ISR_vTickTimer
    .extern vISR_Timer3
    .extern vISR_Timer4
    .extern vISR_SystemController
    .align 4
    .type   PIC_SwVectTable, @object
    .size   PIC_SwVectTable, 64
PIC_SwVectTable:
    .word vUnclaimedInterrupt               # 0
    .word vUnclaimedInterrupt               # 1
    .word vUnclaimedInterrupt               # 2
    .word vUnclaimedInterrupt               # 3
    .word vUnclaimedInterrupt               # 4
    .word APP_isrTimer0                  # 5
    .word vUnclaimedInterrupt               # 6
    .word zps_isrMAC                        # 7
    .word vUnclaimedInterrupt               # 8
    .word vUnclaimedInterrupt               # 9
    .word vUnclaimedInterrupt               # 10
    .word vUnclaimedInterrupt               # 11
    .word ISR_vTickTimer                    # 12
    .word vISR_Timer4                       # 13
    .word vISR_Timer3                       # 14
    .word vISR_SystemController             # 15

Regards,

Mario

0 Kudos
Reply
4,471 Views
1979717461
Contributor III

Hi,Mario

This is the .S file on my side, I have already followed the  settings you said.  But, It still can not enter the callback function if the  function  vAHI_InterruptSetPriority() is not used.  ( I based on JN-AN-1217-ZigBee 3.0-Base-Device)

.globl PIC_ChannelPriorities
.section .text,"ax"
.align 4
.type PIC_ChannelPriorities, @object
.size PIC_ChannelPriorities, 16
PIC_ChannelPriorities:
.byte 0 # pwm1 priority
.byte 0 # pwm2 priority
.byte 15 # system controller priority
.byte 7 # MAC priority
.byte 0 # AES priority
.byte 0 # PHY priority
.byte 0 # uart0 priority
.byte 0 # uart1 priority
.byte 5 # timer0 priority
.byte 0 # spi slave priority
.byte 0 # i2c maste/slave priority
.byte 0 # spi master priority
.byte 0 # pwm4 priority
.byte 0 # analog peripherals priority
.byte 0 # pwm3 priority
.byte 12 # tick timer priority


.globl PIC_SwVectTable
.section .text,"ax"
.extern zps_isrMAC
.extern ISR_vTickTimer
.extern vISR_Timer3
.extern vISR_Timer4
.extern vISR_SystemController

.align 4
.type PIC_SwVectTable, @object
.size PIC_SwVectTable, 64
PIC_SwVectTable:
.word vUnclaimedInterrupt # 0
.word vUnclaimedInterrupt # 1
.word vUnclaimedInterrupt # 2
.word vUnclaimedInterrupt # 3
.word vUnclaimedInterrupt # 4
.word Timer1_callback # 5
.word vUnclaimedInterrupt # 6
.word zps_isrMAC # 7
.word vUnclaimedInterrupt # 8
.word vUnclaimedInterrupt # 9
.word vUnclaimedInterrupt # 10
.word vUnclaimedInterrupt # 11
.word ISR_vTickTimer # 12
.word vUnclaimedInterrupt # 13
.word vUnclaimedInterrupt # 14
.word vISR_SystemController # 15

Thanks.

Regards,

hs

0 Kudos
Reply
4,471 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi,

Just to confirm, you want a timer and enter to the callback and make a routine. Am I correct?

Why are you trying to call vAHI_InterruptSetPriority API?

Regards,

Mario

0 Kudos
Reply
4,471 Views
1979717461
Contributor III

Hi,Mario

   Yes, Use timer timing and generate interrupts, If I do not use this function vAHI_InterruptSetPriority API, it will not be able to respond normally to the interrupt generated by the timer -- that is,  cannot enter the callback function. So,I just want to know, is this function vAHI_InterruptSetPriority necessary for interrupts? The manual is not very detailed, I am a bit confused. The  following is my code.

PUBLIC void Timer_Init()
{

vAHI_TimerEnable(E_AHI_TIMER_1,10,FALSE,TRUE,TRUE);//timer1,Low-2-High
vAHI_TimerConfigureOutputs(E_AHI_TIMER_1,FALSE,TRUE);

vAHI_TimerStartRepeat(E_AHI_TIMER_1,7813,15625);//1s //101
vAHI_Timer1RegisterCallback(Timer1_callback);
  //vAHI_InterruptSetPriority(MICRO_ISR_MASK_TMR1,5);
DBG_vPrintf(TRUE, "\n\nTimer_Init()... .\n");
}

PUBLIC void Timer1_callback(uint32 u32DeviceId,uint32 u32ItemBitmap)
{
(void)u8AHI_TimerFired(E_AHI_TIMER_1);//clear interrupt flag

DBG_vPrintf(TRUE, "\n.Timer1 Interrupt handling.... .\n");
}

Tanks!

Regards,

hs

0 Kudos
Reply
4,471 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi,

Could you please look at the next community post?

https://community.nxp.com/thread/506029 

Regards,

Mario

0 Kudos
Reply
4,471 Views
1979717461
Contributor III

Hi,Mario

I will do that,Thanks!

Regards,

hs

4,471 Views
1979717461
Contributor III

Hi,Mario

It works! Thank you very much!

0 Kudos
Reply