AnsweredAssumed Answered

s32k148 spi can transmit but receive 0

Question asked by xia xiaohei on Dec 10, 2018
Latest reply on Dec 14, 2018 by Daniel Martynek

Hi~

board:  s32k148 176LQFP

code: s32ds example project ---- lpspi_transfer_s32k148

power: miniusb 5v

problem: slave can receive but master receive data 0

loop function: 

          slaveDataSend = 140;
          LPSPI_DRV_SlaveTransfer(RECEIVE, &slaveDataSend, &slaveDataReceive, 1);
          LPSPI_DRV_MasterTransferBlocking(SEND, &masterDataSend, &masterDataReceive, 1, 10);

debug information: slave and master modelcan both enter the interrupt function to process receive and transmit data,slave device can receive data from master device,but master device recieve data from slave are 0

configuration

LPSPI0:MASTER

const lpspi_master_config_t Send_MasterConfig0 = {
  .bitsPerSec = 50000U,
  .whichPcs = LPSPI_PCS0,
  .pcsPolarity = LPSPI_ACTIVE_LOW,
  .isPcsContinuous = false,
  .bitcount = 8U,
  .lpspiSrcClk = 48000000U,
  .clkPhase = LPSPI_CLOCK_PHASE_1ST_EDGE,
  .clkPolarity = LPSPI_SCK_ACTIVE_HIGH,
  .lsbFirst = true,
  .transferType = LPSPI_USING_INTERRUPTS,
  .rxDMAChannel = 255,
  .txDMAChannel = 255,
  .callback = NULL,
  .callbackParam = NULL,
};

LPSPI1:SLAVE

lpspi_slave_config_t Receive_SlaveConfig0 = {
  .pcsPolarity = LPSPI_ACTIVE_LOW,
  .bitcount = 8U,
  .clkPhase = LPSPI_CLOCK_PHASE_1ST_EDGE,
  .whichPcs = LPSPI_PCS0,
  .clkPolarity = LPSPI_SCK_ACTIVE_HIGH,
  .lsbFirst = true,
  .transferType = LPSPI_USING_INTERRUPTS,
  .rxDMAChannel = 255,
  .txDMAChannel = 255,
  .callback = NULL,
  .callbackParam = NULL,
};

May I ask what is the cause of this phenomenon?

 

thanks !

Outcomes