hi, when using spi callback function, I meet a trouble, need some help.
my code description: I use LPSI0 as slave to communicate with external device,using interrupt mode.here is my code:
callback function defined:
void lpspi_callback_int(uint8 Instance, Lpspi_Ip_EventType Event)
{
Event_global = Event;
if(Event ==LPSPI_IP_EVENT_END_TRANSFER)
{
// Cache_Ip_InvalidateByAddr(CACHE_IP_CORE,CACHE_IP_DATA, (uint32)&rxBuffer[0U], 8);
// read data from rxBuffer
t++;
__asm volatile ("nop");
}
else if (Event ==LPSPI_IP_EVENT_FAULT)
{
__asm volatile ("nop");
}
}
start receive data:
lpspi_status = Lpspi_Ip_AsyncTransmit(&SLAVE_EXTERNAL_DEVICE_1, TxSlaveBuffer, RxSlaveBuffer, NUMBER_OF_BYTES, lpspi_callback_int);
Phenomenon: The callback function is invoked when the master sends data for the first time, but it is not invoked during subsequent data transmissions.
How to fix this issue? Ensure the callback function is triggered on every external SPI data transmission.