s32k148 spi can transmit but receive 0

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

s32k148 spi can transmit but receive 0

1,187 Views
xyj1230730
Contributor I

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

2018-12-10_161458.png

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 !

0 Kudos
5 Replies

852 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

Do you monitor PTE1 with a logic analyzer/oscilloscope?

Thanks,

Daniel

0 Kudos

852 Views
xyj1230730
Contributor I

Hi

Thanks for your attention,because there is no logic analyzer/oscilloscope,so I'm not sure about this,could I have another ways to found out the reason?

Thanks

xia

0 Kudos

852 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

It would really help if you measured it, to see if the slave returns something.

Anyway, how do you know that the received data == 0, only by checking the SW receive buffer?

Do you see any LPSPI error flags? 

Regards,

Daniel

0 Kudos

852 Views
xyj1230730
Contributor I

Hi

There is no error flags,the data==0 showed in receive model ,and (uint32_t)base->RDR data is also 0 in the interrupt function. because there is no analyzer/oscilloscope,so I can't provide measure data. 

Can test The s32k148-176  lpspi in the same board over lpspi0 for master and lpspi1 for slave?

Thanks!

xia

0 Kudos

852 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

Have you tried the lpspi_transfer_s32k148 SDK example first?

Does it work?

pastedImage_1.png

 

Regards,

Daniel

0 Kudos