s32k312: Lpspi SyncTransmit with NULL Tx buffer

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

s32k312: Lpspi SyncTransmit with NULL Tx buffer

1,172 Views
PaoloRB
Contributor II

Hi, I'm using the lpspi driver (sdk5.0) to read the device ID from an external flash. Running Lpspi_Ip_SyncTransmit passing both Tx and Rx buffers works well, but we I try to first sent the Tx buffer and after the Rx buffer it does not work as expected.

WORK:

spiTxBuffer[0] = 0x9F;

lpspi_status = Lpspi_Ip_SyncTransmit(&MASTER_1, spiTxBuffer, spiRxBuffer, 4, TIMEOUT);

 

NOT WORKS:

spiTxBuffer[0] = 0x9F;

lpspi_status = Lpspi_Ip_SyncTransmit(&MASTER_1, spiTxBuffer, NULL, 1, TIMEOUT);

lpspi_status = Lpspi_Ip_SyncTransmit(&MASTER_1, NULL, spiRxBuffer, 3, TIMEOUT);

 

Is anything I'm missing?

 

Thanks in advance for any clarification.

Tags (1)
0 Kudos
Reply
3 Replies

1,143 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you can use HalfDuplex API or ignore received data and send dummy 0xFF for full duplex operation. See suggestion in https://community.nxp.com/t5/S32K/S32K314-SPI-flash-implementation/m-p/1618490/highlight/true#M21501

BR, Petr

0 Kudos
Reply

1,137 Views
PaoloRB
Contributor II

To make it works, I need to UpdateTransferParam (Full duplex).

 

spiTxBuffer[0] = 0x9F;

 

param.FirstCmd = TRUE;

param.KeepCs = TRUE;

Lpspi_Ip_UpdateTransferParam(&MASTER_1, &param);

 

lpspi_status = Lpspi_Ip_SyncTransmit(&MASTER_1, spiTxBuffer, NULL, 1, TIMEOUT);

 

param.FirstCmd = FALSE;

param.KeepCs = FALSE;

Lpspi_Ip_UpdateTransferParam(&MASTER_1, &param);

 

lpspi_status = Lpspi_Ip_SyncTransmit(&MASTER_1, NULL, spiRxBuffer, 3, TIMEOUT);

0 Kudos
Reply

1,120 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, this makes sense, as you need to keep CS asserted between.

BR, Petr

0 Kudos
Reply