AnsweredAssumed Answered

s32k spi send message

Question asked by lei liu on Feb 12, 2019
Latest reply on Feb 14, 2019 by thomson zhou

I want to send a message, but the oscilloscope can only see CS pull low and CLK waveform, SIN and SOUT have no waveform.

uint8_t OLA_SDK_LPSPI_WirteRead(LPSPI_Type * base,uint8_t Send_Value)
{
uint8_t DataValue = 0;

while(!(LPSPI_GetStatusFlag(base,LPSPI_TX_DATA_FLAG))); /* Wait for Tx FIFO available */
LPSPI_WriteData(base,Send_Value); /* Transmit data */
LPSPI_ClearStatusFlag(base,LPSPI_TX_DATA_FLAG); /* Clear TDF flag -- LPSPI1->SR |= LPSPI_SR_TDF_MASK; */

while(!(LPSPI_GetStatusFlag(base,LPSPI_RX_DATA_FLAG))); /* Wait at least one RxFIFO entry */
DataValue= LPSPI_ReadData(base); /* Read received data */
LPSPI_ClearStatusFlag(base,LPSPI_WORD_COMPLETE); /* Clear RDF flag */
LPSPI_ClearStatusFlag(base,LPSPI_RX_DATA_FLAG); /* Clear RDF flag */
return DataValue;
}

See the attached code.

Outcomes