We are using S32k148 in LPSPI0 Master in DMA mode.. we have Lz2910 as sensor which is acting as slave. Both master and slave are connected over SPI(LPSPI0).
Received payload from Slave(RCI 2910 Lizard demo board) is not matching .
lpspi0_MasterConfig.bitsPerSec = 4000000U; //2 MHz Baudrate
lpspi0_MasterConfig.whichPcs = LPSPI_PCS0;
lpspi0_MasterConfig.pcsPolarity = LPSPI_ACTIVE_LOW;
lpspi0_MasterConfig.isPcsContinuous = FALSE;
lpspi0_MasterConfig.bitcount = 8U;
lpspi0_MasterConfig.lpspiSrcClk = 40000000U;
lpspi0_MasterConfig.clkPhase = LPSPI_CLOCK_PHASE_2ND_EDGE; // Mode_1: CPOL =1; CPHA =0
lpspi0_MasterConfig.clkPolarity = LPSPI_SCK_ACTIVE_HIGH;
lpspi0_MasterConfig.lsbFirst = FALSE;
lpspi0_MasterConfig.transferType = LPSPI_USING_DMA;
lpspi0_MasterConfig.rxDMAChannel = LPSPI0_RCI_RX_DMA;
lpspi0_MasterConfig.txDMAChannel = LPSPI0_RCI_TX_DMA;
lpspi0_MasterConfig.callback = LpSpi0RCI_Master_Callback;
lpspi0_MasterConfig.callbackParam = NULL;
lspi_tpms_master_init_status = SPI_MasterInit(LPSPI_PCS0,&lpspi0_MasterConfig);
Following are the logs, when executed from Demo board(source code provided from NXP) which is matching with operational document:
Slave: SEND : 0x8 0x71 0xF6 0x0 0x1 0xAE 0x1D 0x0 0x75
RECEIVED : 0x8 0x71 0xF6 0xEB 0xA 0x0 0x0 0x1 0xA6
SEND : 0x8 0x71 0xF6 0x0 0x1 0xAE
Rx_START_FRAME: 0x8 0x71 0x76 0x97 < ----- 3rd and 4th byte corrupted
Rx_End_FRAME:[0x5:0x0][0x6:0x0][0x7:0x0][0x8:0x6F] <--- again 4th Byte got corrupted
I have noticed in logic analyzer, though the length of Rx: 12bytes, mater always receives in chunks of 4 bytes. Point is why is only 3rd and 4th byte of the every chunk is getting corrupted
Also, please let us know how to validate from DMA buffers with the data received from the slave.
Can you please attach the project so that we can test it?