SPI MasterTransfer() With DMA on MPC5744P Sending Problem

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

SPI MasterTransfer() With DMA on MPC5744P Sending Problem

984 Views
DOK
Contributor I

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 1575693394_0-1694342456652.png

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();

575693394_1-1694342630195.png

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.

575693394_2-1694342753761.png

Figure 3

575693394_3-1694342806987.png

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!

Labels (1)
Tags (2)
0 Kudos
Reply
1 Reply

784 Views
PetrS
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply