S32k142 spi: LPSPI_DRV_MasterTransfer() problem

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

S32k142 spi: LPSPI_DRV_MasterTransfer() problem

跳至解决方案
2,429 次查看
nanjun
Contributor III

Hi,

The example lpspi_transfer_s32k142 works properly on the eval-board, where the slave transfers date to master by LPSPI_DRV_SlaveTransfer() and LPSPI_DRV_MasterTransferBlocking().

However, I exchanged the direction of data transfering and the master shall send the data to slave with the following lines:

masterDataSend = (uint8_t)adcRead;
LPSPI_DRV_MasterTransfer(SEND,&masterDataSend, &masterDataReceive, BUFFER_SIZE);
LPSPI_DRV_SlaveTransferBlocking(RECEIVE, &slaveDataSend, &slaveDataReceive, BUFFER_SIZE, TIMEOUT);
FTM_DRV_UpdatePwmChannel(INST_FLEXTIMER_PWM1, 0U, FTM_PWM_UPDATE_IN_DUTY_CYCLE, slaveDataReceive<<8, 0U, true);

where slaveDataReceive is always 0.

Is there anything shall be reconfigured as well to make it operate properly?

Attached is the entire project. Thank you!

Kind regards,

Nanjun

 

 

 

0 项奖励
回复
1 解答
2,417 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Nanjun,

This won't work, the SlaveTransfer must be ready before the Master starts the transfer.

danielmartynek_0-1635865837113.png

 

Regards,

Daniel

在原帖中查看解决方案

0 项奖励
回复
1 回复
2,418 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Nanjun,

This won't work, the SlaveTransfer must be ready before the Master starts the transfer.

danielmartynek_0-1635865837113.png

 

Regards,

Daniel

0 项奖励
回复