[JN-AN-1218] Timer 0 Interrupt can not stop?

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

[JN-AN-1218] Timer 0 Interrupt can not stop?

Jump to solution
3,020 Views
alan5_lin
Contributor III

Dear Sirs,

Refer to https://community.nxp.com/message/1168364 , the timer0 interrupt is triggered continuously. The interrupt did not stopped no matter start by vAHI_TimerStartSingleShot function.

How to explain this situation?  please.

Thanks!

0 Kudos
Reply
1 Solution
2,704 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Alan,

I am sorry. Please look at the information below.

SPI Master

If enabled, a SPI interrupt is generated when each transfer has completed. There is no API function to clear down this interrupt and therefore a workaround is needed:

  • The relevant interrupt status bit can be read using the following function call (bit 0 is set if the interrupt is pending):
u32Data=u32REG_SpiRead(REG_SPIM_IS);
  • The bit can be written back using the following function call:
u32REG_SpiWrite(REG_SPIM_IS,u32Data); 

These register access functions are not described in the JN516x Integrated Peripherals API User Guide (JN-UG-3087) but are available in the header file PeripheralRegs.h, which is included in the SDK.

https://www.nxp.com/docs/en/user-guide/JN-UG-3075.pdf 

Regards,

Mario

View solution in original post

12 Replies
2,704 Views
alan5_lin
Contributor III

Hi Mario,

Just like my timer 0 interrupt can not be stopped.

Why is my SPI interrupt triggered non-stop?

0 Kudos
Reply
2,704 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Alan,

The interrupt will be generated depend if the device finished the transmit or received.

Please look at the 14.6 SPI Interrupts

Regards,

Mario

0 Kudos
Reply
2,704 Views
alan5_lin
Contributor III

Hi Mario,


Maybe I did not explain my problem clearly.

My SPI problem is the interrupt triggered infinitely.

The "vAHI_SpiStartTransfer8()" was run only one time, but the interrupt callback (vSpiIntCb) was triggered continuously.

Captured the debug logs as below lines.


vSpiIntCb(Id=0x00082541, Bitmap=0x00000004)u8Data=0xff
vSpiIntCb(Id=0x00082541, Bitmap=0x00000004)u8Data=0xff
vSpiIntCb(Id=0x00082541, Bitmap=0x00000004)u8Data=0xff
vSpiIntCb(Id=0x00082541, Bitmap=0x00000004)u8Data=0xff
vSpiIntCb(Id=0x00082541, Bitmap=0x00000004)u8Data=0xff
vSpiIntCb(Id=0x00082541, Bitmap=0x00000004)u8Data=0xff
vSpiIntCb(Id=0x00082541, Bitmap=0x00000004)u8Data=0xff
vSpiIntCb(Id=0x00082541, Bitmap=0x00000004)u8Data=0xff
vSpiIntCb(Id=0x00082541, Bitmap=0x00000004)u8Data=0xff
vSpiIntCb(Id=0x00082541, Bitmap=0x00000004)u8Data=0xff
vSpiIntCb(Id=0x00082541, Bitmap=0x00000004)u8Data=0xff
vSpiIntCb(Id=0x00082541, Bitmap=0x00000004)u8Data=0xff
vSpiIntCb(Id=0x00082541, Bitmap=0x00000004)u8Data=0xff
vSpiIntCb(Id=0x00082541, Bitmap=0x00000004)u8Data=0xff
vSpiIntCb(Id=0x00082541, Bitmap=0x00000004)u8Data=0xff


It seems the interrupt flag ("Bitmap") is not cleared and cause the interrupt happened continuous.

How to solve this kind of problem?

0 Kudos
Reply
2,704 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Alan,

I am not sure if your device is the Master or the Slave.

However, please look at the B. Interrupt Enumerations and Masks and the vAHI_SpiStartTransfer8 API that are described in the next link. https://www.nxp.com/docs/en/user-guide/JN-UG-3087.pdf 

Regards,

Mario

0 Kudos
Reply
2,704 Views
alan5_lin
Contributor III

Hi Mario,

My device is Master.

Once the "vAHI_SpiStartTransfer(7, 0x04)" was run,  the interrupt callback (vSpiIntCb) was triggered continuously.

Not only an interrupt was triggered, but also lots of interrupts were triggered by SPI.

How to fix this issue?

0 Kudos
Reply
2,704 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Alan,

Just to confirm, did you follow the 14.5.1 Performing a Data Transfer?

https://www.nxp.com/docs/en/user-guide/JN-UG-3087.pdf 

Do you have any other interrupts enabled? Are you seeing the SPI commands using a logic analyzer? 

Regards,

Mario

0 Kudos
Reply
2,704 Views
alan5_lin
Contributor III

Hi Mario,

Based on JN-AH-1218, I only add the SPI interrupt settings.

The firmware is load to run on Carrier Board (DR1174+DR1175).

I follow the 14.5.1 perform a data transfer. 

It works fine if interrupt is disabled. And, SPI flash can be read/write normally.

However, the interrupts are triggered continuously if interrupt is enabled.

Is there any API to clear the interrupt register/flag?

Thanks!

0 Kudos
Reply
2,705 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Alan,

I am sorry. Please look at the information below.

SPI Master

If enabled, a SPI interrupt is generated when each transfer has completed. There is no API function to clear down this interrupt and therefore a workaround is needed:

  • The relevant interrupt status bit can be read using the following function call (bit 0 is set if the interrupt is pending):
u32Data=u32REG_SpiRead(REG_SPIM_IS);
  • The bit can be written back using the following function call:
u32REG_SpiWrite(REG_SPIM_IS,u32Data); 

These register access functions are not described in the JN516x Integrated Peripherals API User Guide (JN-UG-3087) but are available in the header file PeripheralRegs.h, which is included in the SDK.

https://www.nxp.com/docs/en/user-guide/JN-UG-3075.pdf 

Regards,

Mario

2,704 Views
alan5_lin
Contributor III

Hi Mario,

To replace the "u32REG_SpiWrite" with "vREG_SpiWrite", it works.

Thanks a lot!

0 Kudos
Reply
2,704 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Alan,

Are you cleaning the flag?

 

The u8AHI_TimerFired API clears the interrupt flag.

      (void) u8AHI_TimerFired(E_AHI_TIMER_0);

Regards,

Mario

0 Kudos
Reply
2,704 Views
alan5_lin
Contributor III

Dear Mario,

Yes, it seems the interrupt stopped after cleaning the flag.

But, is it really true let application to clear the interrupt flag?

How to clear the other peripherals' (ex: UART, SPI and I2C) interrupt fllags? 

Thanks!

0 Kudos
Reply
2,704 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Dear,

In this case, the timer interrupt needs to be clear by the application.

The UART module an interrupt is normally automatically cleared before the callback function is invoked.

Please look at the JN516x Integrated Peripherals API User Guide for a better reference for the other modules.

Regards,

Mario

0 Kudos
Reply