s32k312: Lpspi SyncTransmit with NULL Tx buffer

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

s32k312: Lpspi SyncTransmit with NULL Tx buffer

1,179件の閲覧回数
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.

タグ(1)
0 件の賞賛
返信
3 返答(返信)

1,150件の閲覧回数
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 件の賞賛
返信

1,144件の閲覧回数
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 件の賞賛
返信

1,127件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

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

BR, Petr

0 件の賞賛
返信