AnsweredAssumed Answered

How can I implement S32k144 spi0 communication its own spi1

Question asked by shen jun on Aug 13, 2019
Latest reply on Aug 15, 2019 by Daniel Martynek

How can I implement S32k144 lpspi0 communication its own lpspi1 for test lpspi function is OK,is there one demo for reference,thank you.

follow is the S32 DS IDE example : lpspi_transfer_s32k144


LPSPI_DRV_MasterInit(SEND, &masterState, &Send_MasterConfig0);

 

LPSPI_DRV_SlaveInit(RECEIVE, &slaveState, &Receive_SlaveConfig0);

 

ADC_DRV_ConfigConverter(INST_ADCONV1, &adConv1_ConvConfig0);

 

FTM_DRV_Init(INST_FLEXTIMER_PWM1, &flexTimer_pwm1_InitConfig, &ftmStateStruct);
FTM_DRV_InitPwm(INST_FLEXTIMER_PWM1, &flexTimer_pwm1_PwmConfig);

while(1)
{
   ADC_DRV_ConfigChan(INST_ADCONV1, 0U, &adConv1_ChnConfig0);
   ADC_DRV_WaitConvDone(INST_ADCONV1);

 

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

}

Outcomes