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);
已解决! 转到解答。
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.
Thanks,
BR, Daniel
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.
Thanks,
BR, Daniel