S32K146 LPSPI Example problem

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

S32K146 LPSPI Example problem

ソリューションへジャンプ
1,647件の閲覧回数
f_gaudon
Contributor II

Hi,

I've got some problems with the LSPSI example.

Before sending a SPI trame my TX and RX fifo counter are 0 . 

f_gaudon_0-1651741411403.png

 

After executing the ligne : LPSPI1->TDR = send; the RX counter has incremented to 1 but not the TX fifo counter ? Can someone explain me why ?

f_gaudon_0-1651741704521.png

 

Besides that, I do not understand the ligne : LPSPI1->SR |= LPSPI_SR_TDF_MASK; /* Clear TDF flag */

Because in the RM, this bit seems not writable.

f_gaudon_1-1651741552995.png

Thanks for your time and answers,

Florian

 

 

 

 

タグ(5)
0 件の賞賛
返信
1 解決策
1,587件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Florian,

  • The 16bit frame written to the TX FIFO goes to the TX shift register and is sent out. Meanwhile, an RX frame is received. That's why you see the frame in the RX FIFO but not in the TX FIFO.

 

  • If you don't want to read the RX data, you can set the RXMSK bit in the command (TCR)

 

  • Regarding the RDF, TDF clearing process, you are right, the example is not correct. The flags cannot be cleared by w1c.They get cleared automatically depending on the number of frames in the FIFOs and RXWATER / TXWATER thresholds.

 

BR, Daniel

 

 

 

 

 

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,616件の閲覧回数
f_gaudon
Contributor II

I'm sending a SPI frame every second, the first start correctly but after few seconds, the RX fifo is full (nothing is connected on the SDIN pin) and the CS stay low after sending the last frame.

In the example, the flags cleared are in Read only mode, I still don't get it. 

0 件の賞賛
返信
1,588件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Florian,

  • The 16bit frame written to the TX FIFO goes to the TX shift register and is sent out. Meanwhile, an RX frame is received. That's why you see the frame in the RX FIFO but not in the TX FIFO.

 

  • If you don't want to read the RX data, you can set the RXMSK bit in the command (TCR)

 

  • Regarding the RDF, TDF clearing process, you are right, the example is not correct. The flags cannot be cleared by w1c.They get cleared automatically depending on the number of frames in the FIFOs and RXWATER / TXWATER thresholds.

 

BR, Daniel

 

 

 

 

 

0 件の賞賛
返信
1,562件の閲覧回数
f_gaudon
Contributor II

Hi Daniel,

Thanks for your answer, I understood I was receiving some frames on RX so I was reading them just to clear the RXFIFO. But the RXMSK bit you suggested seems to be a better option !

Thanks again

Florian

0 件の賞賛
返信