SPI transfer with a KL03

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

SPI transfer with a KL03

Jump to solution
1,056 Views
javierhernande1
Contributor IV

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);
Labels (1)
1 Solution
902 Views
nxf56274
NXP Employee
NXP Employee

Hi,

You can use "nop" to write a delay function by yourself. You should perform three transfers

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

1 Reply
903 Views
nxf56274
NXP Employee
NXP Employee

Hi,

You can use "nop" to write a delay function by yourself. You should perform three transfers

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------