LPSPI0 for S32K344 only sends and only receives

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

LPSPI0 for S32K344 only sends and only receives

Jump to solution
128 Views
jiafeimao
Contributor II

My S32K344 device is connected to a ferroelectric memory via LPSPI0.

1. When writing storage data, I send "write command", "write address", and finally send several data to be written through LPSPI0.

2. When reading data, I send a "read command" and "read data address" through LPSPI0, and then perform several byte data reads.

In the above two processes, The sending and receiving of LPSPI0 are done separately. During process 1, LPSPI0 only needs to send, during process 2, LPSPI0 sends "read command", "read data address", and finally only needs to receive. How to achieve this.


The following seems to be an incorrect approach:

1.

Lpspi_Ip_AsyncTransmitHalfDuplex(&Lpspi_Ip_DeviceAttributes_SpiExternalDevice_0_Instance_0, WRITE, 1, LPSPI_IP_HALF_DUPLEX_TRANSMIT, NULL);

Lpspi_Ip_AsyncTransmitHalfDuplex(&Lpspi_Ip_DeviceAttributes_SpiExternalDevice_0_Instance_0, ADDRESS, 2, LPSPI_IP_HALF_DUPLEX_TRANSMIT, NULL);

Lpspi_Ip_AsyncTransmitHalfDuplex(&Lpspi_Ip_DeviceAttributes_SpiExternalDevice_0_Instance_0, TX_BUFFER, Length LPSPI_IP_HALF_DUPLEX_TRANSMIT, NULL);

2.

Lpspi_Ip_AsyncTransmitHalfDuplex(&Lpspi_Ip_DeviceAttributes_SpiExternalDevice_0_Instance_0, READ, 1, LPSPI_IP_HALF_DUPLEX_RECEIVE, NULL);

Lpspi_Ip_AsyncTransmitHalfDuplex(&Lpspi_Ip_DeviceAttributes_SpiExternalDevice_0_Instance_0, ADDRESS, 2, LPSPI_IP_HALF_DUPLEX_RECEIVE, NULL);

Lpspi_Ip_AsyncTransmitHalfDuplex(&Lpspi_Ip_DeviceAttributes_SpiExternalDevice_0_Instance_0, RX_BUFFER, Length, LPSPI_IP_HALF_DUPLEX_RECEIVE, NULL);

0 Kudos
1 Solution
104 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @jiafeimao,

In the Async mode, do you call the Flexio_Spi_Ip_GetStatus() for each of the transfers until each of them is completed?

You need to specify either SIN or SOUT for the half-duplex transfer, and then configure the pin in the SIUL2 driver.

Please scope the bus.

danielmartynek_0-1716977104141.png

 

 

Thanks,

BR, Daniel

View solution in original post

0 Kudos
2 Replies
105 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @jiafeimao,

In the Async mode, do you call the Flexio_Spi_Ip_GetStatus() for each of the transfers until each of them is completed?

You need to specify either SIN or SOUT for the half-duplex transfer, and then configure the pin in the SIUL2 driver.

Please scope the bus.

danielmartynek_0-1716977104141.png

 

 

Thanks,

BR, Daniel

0 Kudos
91 Views
jiafeimao
Contributor II

通过这两天的调试,我大致了解了344的LPSPI没有单独的发送(忽略接收)和接收(忽略发送)功能接口。LPSPI0 不能在前一刻使用单独的发送(忽略接收),然后在下一刻使用单独的接收(忽略发送)。我将使用 Lpspi_Ip_SyncTransmit() 函数并忽略任何不必要的数据。感谢您的回复。

0 Kudos