LPSPI FRAMESZ and Receive Data Register

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

LPSPI FRAMESZ and Receive Data Register

ソリューションへジャンプ
2,731件の閲覧回数
vusal
Contributor III

Hello,

I'm interfacing S32K3xx with an external flash memory. This chip requires different size command and data combinations. For example, to read the status register one needs to send 1 byte command and wait for 1 byte of data to appear on the MISO line. Frame size can range from 8 bits to several bytes. Is there a way to interface this chip without needing changing FRAMESZ each time?

In the above example, I couldn't just send 1 byte of command. I had to send an extra dummy byte to allow for the memory chip to respond. So, my frame size had to be 16 bits long. I have other use cases where I am sending 1 byte of command + 3 bytes of address + 10 bytes of data (just an example). It seem like each time my data changes I have to modify the FRAMESZ.

Another question: It seem like to get correct data in the SPI data register I have to read that register each time I send out a frame. Is this how the SPI set up?

LPSPI1_transmit_16bits(tx_16bits); /* Transmit half word (16 bits) on LPSPI1 */
LPSPI1_16bits_read = LPSPI1_receive_16bits(); /* Receive half word on LSPI1 */

Thank you very much for your help!

Vusal

0 件の賞賛
返信
1 解決策
2,712件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Vusal,

I understand you need to keep CS asserted throughout the whole 14-byte transfer (using the example, 1 byte of command + 3 bytes of address + 10 bytes of data).

For that, the LPSPI Continous mode can be used (TCR[CONT = 1]).

FRAMESZ can be set to 8bit frames.

The LPSPI will keep CS asserted until a new command with TCR[CONT = 0].

 

RTD LPSPI_IP driver

danielmartynek_0-1718355095205.png

Call the function below with Length = 14.

danielmartynek_1-1718355278613.png

 

Regards,

Daniel

 

元の投稿で解決策を見る

4 返答(返信)
2,713件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Vusal,

I understand you need to keep CS asserted throughout the whole 14-byte transfer (using the example, 1 byte of command + 3 bytes of address + 10 bytes of data).

For that, the LPSPI Continous mode can be used (TCR[CONT = 1]).

FRAMESZ can be set to 8bit frames.

The LPSPI will keep CS asserted until a new command with TCR[CONT = 0].

 

RTD LPSPI_IP driver

danielmartynek_0-1718355095205.png

Call the function below with Length = 14.

danielmartynek_1-1718355278613.png

 

Regards,

Daniel

 

2,688件の閲覧回数
vusal
Contributor III

Hi Daniel,

Thank you for your message. This fixed the issue.

One more quick question: It seem like to get correct data in the SPI data register I have to read that register each time I send out a frame. Is this how the SPI set up?

LPSPI1_transmit_16bits(tx_16bits); /* Transmit half word (16 bits) on LPSPI1 */
LPSPI1_16bits_read = LPSPI1_receive_16bits(); /* Receive half word on LSPI1 */


Thank you!

Best,
Vusal

0 件の賞賛
返信
2,662件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

There is 4x32b RX FIFO disabled by default.

danielmartynek_0-1718707863682.png

danielmartynek_1-1718707956067.png

 

BR, Daniel

 

 

2,650件の閲覧回数
vusal
Contributor III
Thank you!
0 件の賞賛
返信
%3CLINGO-SUB%20id%3D%22lingo-sub-1887242%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ELPSPI%20FRAMESZ%20%E3%81%A8%E5%8F%97%E4%BF%A1%E3%83%87%E3%83%BC%E3%82%BF%20%E3%83%AC%E3%82%B8%E3%82%B9%E3%82%BF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1887242%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF%3CBR%20%2F%3E%3CBR%20%2F%3ES32K3xx%20%E3%82%92%E5%A4%96%E9%83%A8%E3%83%95%E3%83%A9%E3%83%83%E3%82%B7%E3%83%A5%20%E3%83%A1%E3%83%A2%E3%83%AA%E3%81%A8%E6%8E%A5%E7%B6%9A%E3%81%97%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%E3%80%82%E3%81%93%E3%81%AE%E3%83%81%E3%83%83%E3%83%97%E3%81%AB%E3%81%AF%E3%80%81%E3%81%95%E3%81%BE%E3%81%96%E3%81%BE%E3%81%AA%E3%82%B5%E3%82%A4%E3%82%BA%E3%81%AE%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%81%A8%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AE%E7%B5%84%E3%81%BF%E5%90%88%E3%82%8F%E3%81%9B%E3%81%8C%E5%BF%85%E8%A6%81%E3%81%A7%E3%81%99%E3%80%82%E3%81%9F%E3%81%A8%E3%81%88%E3%81%B0%E3%80%81%E3%82%B9%E3%83%86%E3%83%BC%E3%82%BF%E3%82%B9%E3%83%AC%E3%82%B8%E3%82%B9%E3%82%BF%E3%82%92%E8%AA%AD%E3%81%BF%E5%8F%96%E3%82%8B%E3%81%AB%E3%81%AF%E3%80%811%E3%83%90%E3%82%A4%E3%83%88%E3%81%AE%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%82%92%E9%80%81%E4%BF%A1%E3%81%97%E3%80%811%E3%83%90%E3%82%A4%E3%83%88%E3%81%AE%E3%83%87%E3%83%BC%E3%82%BF%E3%81%8CMISO%E3%83%A9%E3%82%A4%E3%83%B3%E3%81%AB%E8%A1%A8%E7%A4%BA%E3%81%95%E3%82%8C%E3%82%8B%E3%81%AE%E3%82%92%E5%BE%85%E3%81%A4%E5%BF%85%E8%A6%81%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82%E3%83%95%E3%83%AC%E3%83%BC%E3%83%A0%20%E3%82%B5%E3%82%A4%E3%82%BA%E3%81%AE%E7%AF%84%E5%9B%B2%E3%81%AF%208%20%E3%83%93%E3%83%83%E3%83%88%E3%81%8B%E3%82%89%E6%95%B0%E3%83%90%E3%82%A4%E3%83%88%E3%81%A7%E3%81%99%E3%80%82%E6%AF%8E%E5%9B%9EFRAMESZ%E3%82%92%E5%A4%89%E6%9B%B4%E3%81%99%E3%82%8B%E3%81%93%E3%81%A8%E3%81%AA%E3%81%8F%E3%80%81%E3%81%93%E3%81%AE%E3%83%81%E3%83%83%E3%83%97%E3%82%92%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%BC%E3%83%95%E3%82%A7%E3%83%BC%E3%82%B9%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95%E3%81%AF%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%81%8B%3F%3CBR%20%2F%3E%3CBR%20%2F%3E%E4%B8%8A%E8%A8%98%E3%81%AE%E4%BE%8B%E3%81%A7%E3%81%AF%E3%80%811%E3%83%90%E3%82%A4%E3%83%88%E3%81%AE%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%82%92%E9%80%81%E3%82%8B%E3%81%93%E3%81%A8%E3%81%AF%E3%81%A7%E3%81%8D%E3%81%BE%E3%81%9B%E3%82%93%E3%81%A7%E3%81%97%E3%81%9F%E3%80%82%E3%83%A1%E3%83%A2%E3%83%AA%E3%83%81%E3%83%83%E3%83%97%E3%81%8C%E5%BF%9C%E7%AD%94%E3%81%A7%E3%81%8D%E3%82%8B%E3%82%88%E3%81%86%E3%81%AB%E3%80%81%E8%BF%BD%E5%8A%A0%E3%81%AE%E3%83%80%E3%83%9F%E3%83%BC%E3%83%90%E3%82%A4%E3%83%88%E3%82%92%E9%80%81%E4%BF%A1%E3%81%99%E3%82%8B%E5%BF%85%E8%A6%81%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%97%E3%81%9F%E3%80%82%E3%81%9D%E3%81%AE%E3%81%9F%E3%82%81%E3%80%81%E3%83%95%E3%83%AC%E3%83%BC%E3%83%A0%20%E3%82%B5%E3%82%A4%E3%82%BA%E3%81%AF%2016%20%E3%83%93%E3%83%83%E3%83%88%E9%95%B7%E3%81%AB%E3%81%99%E3%82%8B%E5%BF%85%E8%A6%81%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%97%E3%81%9F%E3%80%82%E7%A7%81%E3%81%AF%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%81%AE1%E3%83%90%E3%82%A4%E3%83%88%2B%20%E3%82%A2%E3%83%89%E3%83%AC%E3%82%B9%E3%81%AE3%E3%83%90%E3%82%A4%E3%83%88%2B%2010%E3%83%90%E3%82%A4%E3%83%88%E3%81%AE%E3%83%87%E3%83%BC%E3%82%BF(%E5%8D%98%E3%81%AA%E3%82%8B%E4%BE%8B)%E3%82%92%E9%80%81%E4%BF%A1%E3%81%97%E3%81%A6%E3%81%84%E3%82%8B%E4%BB%96%E3%81%AE%E3%83%A6%E3%83%BC%E3%82%B9%E3%82%B1%E3%83%BC%E3%82%B9%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82%E3%83%87%E3%83%BC%E3%82%BF%E3%81%8C%E5%A4%89%E6%9B%B4%E3%81%95%E3%82%8C%E3%82%8B%E3%81%9F%E3%81%B3%E3%81%AB%E3%80%81FRAMESZ%E3%82%92%E5%A4%89%E6%9B%B4%E3%81%99%E3%82%8B%E5%BF%85%E8%A6%81%E3%81%8C%E3%81%82%E3%82%8B%E3%82%88%E3%81%86%E3%81%A7%E3%81%99%E3%80%82%3CBR%20%2F%3E%3CBR%20%2F%3E%E5%88%A5%E3%81%AE%E8%B3%AA%E5%95%8F%3ASPI%E3%83%87%E3%83%BC%E3%82%BF%E3%83%AC%E3%82%B8%E3%82%B9%E3%82%BF%E3%81%A7%E6%AD%A3%E3%81%97%E3%81%84%E3%83%87%E3%83%BC%E3%82%BF%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%E3%80%81%E3%83%95%E3%83%AC%E3%83%BC%E3%83%A0%E3%82%92%E9%80%81%E4%BF%A1%E3%81%99%E3%82%8B%E3%81%9F%E3%81%B3%E3%81%AB%E3%81%9D%E3%81%AE%E3%83%AC%E3%82%B8%E3%82%B9%E3%82%BF%E3%82%92%E8%AA%AD%E3%81%BF%E5%8F%96%E3%82%8B%E5%BF%85%E8%A6%81%E3%81%8C%E3%81%82%E3%82%8B%E3%82%88%E3%81%86%E3%81%A7%E3%81%99%E3%80%82SPI%E3%81%AF%E3%81%93%E3%81%AE%E3%82%88%E3%81%86%E3%81%AB%E8%A8%AD%E5%AE%9A%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%E3%81%8B%3F%3CBR%20%2F%3E%3CBR%20%2F%3ELPSPI1_transmit_16bits(tx_16bits)%3B%2F*%20LPSPI1%E3%81%A7%E3%83%8F%E3%83%BC%E3%83%95%E3%83%AF%E3%83%BC%E3%83%89(16%E3%83%93%E3%83%83%E3%83%88)%E3%82%92%E9%80%81%E4%BF%A1%20*%2F%3CBR%20%2F%3ELPSPI1_16bits_read%20%3D%20LPSPI1_receive_16bits()%3B%2F*%20LSPI1%20%E3%81%A7%E3%83%8F%E3%83%BC%E3%83%95%E3%83%AF%E3%83%BC%E3%83%89%E3%82%92%E5%8F%97%E3%81%91%E5%8F%96%E3%82%8B%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%E3%81%94%E5%8D%94%E5%8A%9B%E3%81%84%E3%81%9F%E3%81%A0%E3%81%8D%E3%80%81%E8%AA%A0%E3%81%AB%E3%81%82%E3%82%8A%E3%81%8C%E3%81%A8%E3%81%86%E3%81%94%E3%81%96%E3%81%84%E3%81%BE%E3%81%99!%3CBR%20%2F%3E%3CBR%20%2F%3EVusal(%E3%83%96%E3%83%BC%E3%82%B5%E3%83%AB)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1889503%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E6%97%A5%E6%99%82%3ALPSPI%20FRAMESZ%E3%81%8A%E3%82%88%E3%81%B3%E5%8F%97%E4%BF%A1%E3%83%87%E3%83%BC%E3%82%BF%E3%83%AC%E3%82%B8%E3%82%B9%E3%82%BF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1889503%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E3%81%94%E5%9B%9E%E7%AD%94%E3%82%92%E3%82%88%E3%82%8D%E3%81%97%E3%81%8F%E3%81%8A%E9%A1%98%E3%81%84%E7%94%B3%E3%81%97%E4%B8%8A%E3%81%92%E3%81%BE%E3%81%99%E3%80%82%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1888870%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E6%97%A5%E6%99%82%3ALPSPI%20FRAMESZ%E3%81%8A%E3%82%88%E3%81%B3%E5%8F%97%E4%BF%A1%E3%83%87%E3%83%BC%E3%82%BF%E3%83%AC%E3%82%B8%E3%82%B9%E3%82%BF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1888870%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF%E3%83%80%E3%83%8B%E3%82%A8%E3%83%AB%E3%80%81%3CBR%20%2F%3E%3CBR%20%2F%3E%E3%83%A1%E3%83%83%E3%82%BB%E3%83%BC%E3%82%B8%E3%81%82%E3%82%8A%E3%81%8C%E3%81%A8%E3%81%86%E3%81%94%E3%81%96%E3%81%84%E3%81%BE%E3%81%99%E3%80%82%E3%81%93%E3%82%8C%E3%81%A7%E5%95%8F%E9%A1%8C%E3%81%AF%E4%BF%AE%E6%AD%A3%E3%81%95%E3%82%8C%E3%81%BE%E3%81%97%E3%81%9F%E3%80%82%3CBR%20%2F%3E%3CBR%20%2F%3E%E3%82%82%E3%81%861%E3%81%A4%E3%81%AE%E7%B0%A1%E5%8D%98%E3%81%AA%E8%B3%AA%E5%95%8F%3A%3CSPAN%3ESPI%E3%83%87%E3%83%BC%E3%82%BF%E3%83%AC%E3%82%B8%E3%82%B9%E3%82%BF%E3%81%A7%E6%AD%A3%E3%81%97%E3%81%84%E3%83%87%E3%83%BC%E3%82%BF%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%E3%80%81%E3%83%95%E3%83%AC%E3%83%BC%E3%83%A0%E3%82%92%E9%80%81%E4%BF%A1%E3%81%99%E3%82%8B%E3%81%9F%E3%81%B3%E3%81%AB%E3%81%9D%E3%81%AE%E3%83%AC%E3%82%B8%E3%82%B9%E3%82%BF%E3%82%92%E8%AA%AD%E3%81%BF%E5%8F%96%E3%82%8B%E5%BF%85%E8%A6%81%E3%81%8C%E3%81%82%E3%82%8B%E3%82%88%E3%81%86%E3%81%A7%E3%81%99%E3%80%82SPI%E3%81%AF%E3%81%93%E3%81%AE%E3%82%88%E3%81%86%E3%81%AB%E8%A8%AD%E5%AE%9A%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%E3%81%8B%3F%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3ELPSPI1_transmit_16bits(tx_16bits)%3B%2F*%20LPSPI1%E3%81%A7%E3%83%8F%E3%83%BC%E3%83%95%E3%83%AF%E3%83%BC%E3%83%89(16%E3%83%93%E3%83%83%E3%83%88)%E3%82%92%E9%80%81%E4%BF%A1%20*%2F%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3ELPSPI1_16bits_read%20%3D%20LPSPI1_receive_16bits()%3B%2F*%20LSPI1%20%E3%81%A7%E3%83%8F%E3%83%BC%E3%83%95%E3%83%AF%E3%83%BC%E3%83%89%E3%82%92%E5%8F%97%E3%81%91%E5%8F%96%E3%82%8B%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%E3%81%82%E3%82%8A%E3%81%8C%E3%81%A8%E3%81%86%E3%81%94%E3%81%96%E3%81%84%E3%81%BE%E3%81%99%EF%BC%81%3CBR%20%2F%3E%3CBR%20%2F%3E%E6%9C%80%E8%89%AF%3CBR%20%2F%3EVusal(%E3%83%96%E3%83%BC%E3%82%B5%E3%83%AB)%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E