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
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 !
Hi,
Do you monitor PTE1 with a logic analyzer/oscilloscope?
Thanks,
Daniel
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
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
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
Hi,
Have you tried the lpspi_transfer_s32k148 SDK example first?
Does it work?
Regards,
Daniel