Hi everyone!
There are some problems with API DSPI_MasterTransfer() generated by SDK recently, SDK version 3.03, the MCU is MPC5744P:
DSPI is configured as a DMA transmission mode, as shown in Figure 1
Figure 1
When using DSPI_MasterTransfer() to send and receive data, this API is called normally in the task, but when called in the interrupt function (PIT or ADC FIFO), it will stay stuck in DSPI_GetTransferStatus();
Figure 2
I found the reason why it was called in the interrupt function because the DMA transfer was not successfully launched after the interrupt callback function, that is, the function in the following figure 3 was not executed, which will cause the DSPI state can not be updated. I tried to change the interrupt priority higher, and the result was the same. Stay where the While() judgment is.
Figure 3
Figure 4
I did a comparison test, set the PIT 100us interrupt without SPI status judgment (i.e., without calling DSPI_GetTransferStatus()), and found that I could read the data, but when I switched to the PWM CTU_FIFO_OVERFLOW 100us interrupt, The read data is a fixed value. I don't know why.
So is there someone know where the wrong is? Thanks a lot!
Hi,
DSPI status is updated in DSPI_DRV_MasterCompleteDMATransfer which is callback function for RX DMA channel. So if RX DMA transfer is completed, its interrupt should be called if interrupt priority is higher then interrupt from which transfer was started. Try to check priorities of used interrupt.
BR, Petr