AnsweredAssumed Answered

SPI transfer with a KL03

Question asked by javierhernandezdeniz on Nov 26, 2019
Latest reply on Nov 26, 2019 by Da Li

Hello,

 

I need to perform a SPI communication with a slave device with a KL03 mcu.

I need to adjust 3 register.

 

First step is programming 0xF register as 0x000000 for reset, the delay 300ms.

Second step is programming 0x1 register as 0x45E15 then delay 30ms

Last step is programming 0x3 register as 0x0FFDC

 

I need to perform 3 txTranfers? or is possible in one transfer?

 

And, Is there any function to wait on ms?

 

Best regards

 

printf("\n\r SPI Master Start...\n\r");
/*
* userConfig.enableStopInWaitMode = false;
* userConfig.polarity = kSPI_ClockPolarityActiveHigh;
* userConfig.phase = kSPI_ClockPhaseFirstEdge;
* userConfig.direction = kSPI_MsbFirst;
* userConfig.dataMode = kSPI_8BitMode;
* userConfig.txWatermark = kSPI_TxFifoOneHalfEmpty;
* userConfig.rxWatermark = kSPI_RxFifoOneHalfFull;
* userConfig.pinMode = kSPI_PinModeNormal;
* userConfig.outputMode = kSPI_SlaveSelectAutomaticOutput;
* userConfig.baudRate_Bps = 500000U;
*/

SPI_MasterGetDefaultConfig(&userConfig);
srcFreq = SPI_MASTER_CLK_FREQ;
SPI_MasterInit(SPI_MASTER, &userConfig, srcFreq);
/* Init Buffer*/
for (i = 0; i < BUFFER_SPI; i++)
{
srcBuff[i] = i;
}
/*Start Transfer*/
xfer.txData = srcBuff;
xfer.dataSize = BUFFER_SIZE;
SPI_MasterTransferBlocking(SPI_MASTER, &xfer);

Outcomes