Where to find SPI interrupt flag ?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Where to find SPI interrupt flag ?

1,626 次查看
mkdomenico
Contributor II

Hello there,

 

I am quite new to embedded development, thus, I am sorry if my question may seem trivial. I am currently working with a S32K144 demo board (revision X1) with the IAR IDE.

 

I am configuring the low-power SPI module. I have set the LPSPI0_IRQHandler interrupt to fire on reception of a least one word (IER register RDIE bit set to 1 with RX Water = 0). This interruption starts fine, but I cannot find the corresponding interruption-flag to lower, thus once the interrupt has fired, it runs permanently.

 

Can you please help me fix this issue?

Thanks,

 

Regards,

Domenico

标签 (1)
0 项奖励
3 回复数

1,275 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

have you read all the data from FIFO? The interrupt is triggered if RDF in status register is set. And "The Receive Data Flag is set whenever the number of words in the receive FIFO is greater than RXWATER."

So, try to read all the data from FIFO. You can check RXCOUNT in FSR register.

Regards,

Lukas

0 项奖励

1,275 次查看
mkdomenico
Contributor II

Hi,

Thanks for the fast reply. I have read all data from RX FIFO. RXCOUNT in FSR is 0. (I made the interrupt display the content of the register)

My output looks like this: (a line starting with an exclamation mark is a line written by the interrupt)

  FSR  : 00000000000000000000000000000000
! SR   : 00000000000000000000011100000011
! FSR  : 00000000000000010000000000000000
! Reading data: 0x8000
! FSR  : 00000000000000000000000000000000
! SR   : 00000000000000000000011100000001
! FSR  : 00000000000000000000000000000000
! Reading data: 0x0
! FSR  : 00000000000000000000000000000000
! SR   : 00000000000000000000011100000001
! FSR  : 00000000000000000000000000000000
! Reading data: 0x0
! FSR  : 00000000000000000000000000000000
...

The interrupt writes out the FSR register, reads the FIFO data and writes the FSR again. As you can see, even when the FIFO is empty, the interrupt keeps getting triggered. Even the RDF in the SR is back at 0 after reading.

Regards,

Domenico

0 项奖励

1,275 次查看
mkdomenico
Contributor II

Hi again,

In the end, I am not going to use that interrupt and I will use some workaround. Thanks for your help.

Regards,

Domenico

0 项奖励