SPI transfer with a KL03

取消
显示结果 
搜索替代 
您的意思是: 
已解决

SPI transfer with a KL03

跳至解决方案
721 次查看
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);
标签 (1)
1 解答
567 次查看
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.
-------------------------------------------------------------------------------

在原帖中查看解决方案

1 回复
568 次查看
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.
-------------------------------------------------------------------------------