SPI not responding

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

SPI not responding

1,073 Views
noobsplzwin
Contributor III

Hi there,

I am using S32K334 to implement a very responsive SPI slave, and Rasp Pi as the SPI master.
I initialized the SPI using

IntCtrl_Ip_EnableIrq(LPSPI1_IRQn);

IntCtrl_Ip_InstallHandler(LPSPI1_IRQn, Lpspi_Ip_LPSPI_1_IRQHandler, NULL_PTR);

Lpspi_Ip_Init(&Lpspi_Ip_PhyUnitConfig_SpiPhyUnit_0_Instance_0);
Lpspi_Ip_Init(&Lpspi_Ip_PhyUnitConfig_SpiPhyUnit_1_Instance_1);
Lpspi_Ip_UpdateTransferMode(1, LPSPI_IP_INTERRUPT);

Lpspi_Ip_AsyncTransmit(&Lpspi_Ip_DeviceAttributes_SpiExternalDevice_1_Instance_1, spiSlaveTx, spiSlaveRx, CONNOR_SPI_SIZE, SPI_ISR_Callback);


and I am using SPI_ISR_Callback to receive the SPI message from Pi. 

noobsplzwin_0-1696343944994.png

 

I am currently using Spidev library on the Pi side. The problem I am facing right now is I need to add a at least 0.5ms delay on the Pi side after each SPI transmission. Otherwise, S32K344 would start responding 0xFFFFFF after fewer successful SPI transactions. I tried to breakpoint in and noticed that S32K344 SPI ISR is not triggering after Pi SPI transmission, looks like S32k344 SPI is completely halted. 

Could anyone give some advice here on whether I init the S32K3xx SPI properly? Can LPSPI do the job? 

Best regards and thanks in advance!

0 Kudos
Reply
1 Reply

1,058 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @noobsplzwin 

I suggest you take a look at the LPSPI example codes (Lpspi_Ip_HalfDuplexTransfer_S32K344 and Lpspi_Flexio_Ip_Transfer_S32K344) to get familiar with the driver. 

 

B.R.

VaneB

0 Kudos
Reply