Hi rey,
Thank you for your thread! I've learnt a lot from it.
I'm using S32K3 as SPI slave too. And I want to make the S32K3 can receive SPI messages continuously as soon as possible, so I configured SPI5 as slave mode with DMA enabled.
But when I send amount data to the S32K3, it will get into the (LPSPI_IP_EVENT_FAULT = 1) error state.
This is my SPI slave callback function. Is my "SPI slave callback function" the same as yours?
Flowing is my SPI slave callback function.
····································································································
// @brief spi slave receive code
char spi5_recv[50] = {0};
const char spi5x_send[50] = {0};
void Spi5SlaveDmaCallback(uint8 Instance, Lpspi_Ip_EventType Event) {
if (Instance == 5) {
switch (Event) {
case LPSPI_IP_EVENT_END_TRANSFER:
Lpspi_Ip_AsyncTransmit(&Lpspi_Ip_DeviceAttributes_SpiExternalDevice_5_BOARD_InitPeripherals,
spi5x_send, spi5_recv, 32, Rt1176SpiAsyncRecvCallback);
break;
case LPSPI_IP_EVENT_FAULT://
rt_kprintf("e");
break;
default:
break;}}}
void StartSpi5SlaveDmaRecvData(void) {
Lpspi_Ip_AsyncTransmit(
&Lpspi_Ip_DeviceAttributes_SpiExternalDevice_5_BOARD_InitPeripherals,
spi5x_send, spi5_recv, 32, Rt1176SpiAsyncRecvCallback);
}
·····························································································
Best regards,
autolan22