my spi set as follows:
it work for SyncTransmit,but i want change to AsyncTransmit,i just change function "Lpspi_Ip_SyncTransmit(&MASTER_EXTERNAL_DEVICE, TxMasterBuffer, RxMasterBuffer, NUMBER_OF_BYTES, TIMEOUT);" to "Lpspi_Ip_AsyncTransmit(&MASTER_EXTERNAL_DEVICE, TxMasterBuffer, RxMasterBuffer, NUMBER_OF_BYTES, (Lpspi_Ip_CallbackType)spi_callback);" . i think it should work, but it not work. what can i do ?
Hi,
what does not work in fact?
The only difference between functions is a Sync one does not finish until transfer is finished or timeout happens, while Async one starts transfer and leave function. User should check for end of transfer either using a callback or calling GetStatus function, I think.
Also do you have LPSPI interrupt installed/initialized?
BR, Petr
Hi PetrS,do you mean the AsyncTransmit must use interrupt "Lpspi_Ip_LPSPI_0_IrqRxDmaHandler" to check the LPSPI_IP_IDLE status?
Hi,
as I wrote, for async function you need to wait for end of transfer. Function just prepare transmission/reception and leave. So either you will check module status using Lpspi_Ip_GetStatus, it returns IDLE after transfer is finished. Or if you define callback within Async function, this callback will be called with event LPSPI_IP_EVENT_END_TRANSFER after transfer is done.
BR, Petr
Hi,PetrS,I means use function “Lpspi_Ip_SyncTransmit(&MASTER_EXTERNAL_DEVICE, TxMasterBuffer, RxMasterBuffer, NUMBER_OF_BYTES, TIMEOUT);” I can get the message with DMA, but replace the function "Lpspi_Ip_AsyncTransmit(&MASTER_EXTERNAL_DEVICE, TxMasterBuffer, RxMasterBuffer, NUMBER_OF_BYTES, (Lpspi_Ip_CallbackType)spi_callback); ". I can not get the message with DMA. I have LPSPI interrupt installed/initialized, such as"IntCtrl_Ip_InstallHandler(LPSPI0_IRQn, Lpspi_Ip_LPSPI_0_IRQHandler, NULL_PTR);
IntCtrl_Ip_EnableIrq(LPSPI0_IRQn);".