SPI Slave with DMA. Callback not running after master finish sending data (K64F)

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

SPI Slave with DMA. Callback not running after master finish sending data (K64F)

1,565 Views
unknowncoder
Contributor III

Hi, 

I am using the MCUXpresso SDK 2.3 with the K64F. I am trying to setup the SPI in slave mode using DMA. 

I am having a problems where the callback is not running after the master finish sending data.

The callback I am referring to is the "dspi_slave_edma_transfer_callback_t".

When the master finishes sending data the "Chip Select" (CS) signal goes high, but the callback never runs. The callback should run after the master release the chip select line because the transfer is complete. Isn't that correct?

Does the callback only run after the DMA buffer is full? The DMA buffer may never be full because the master can send variable data. I want to read the after the master has release the chip select line. How do I get the callback to run after the master has released the chip select line?

Is it possible to make the CS also trigger an interrupt without affect the SPI driver? So when ever the rising edge occurs I know the master has finished the transfer

Update

After reading the user guide I am thinking that I could configure the CS pin in interrupt mode and as an input. When the PORTA interrupt handler runs I can then check the state of the CS pin by reading the register? 

Is this correct?

Solution:

I configured the CS pin at the register level not using the driver to trigger an interrupt. This allowed me to check when the CS pin went high by the master and thus I know when the master has finished sending data event if the DMA complete had not finished.

Labels (1)
0 Kudos
2 Replies

981 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

The callback function is called by edma interrupt, not by dspi status. So, when CS go high, callback function will not run.

Is it possible to make the CS also trigger an interrupt without affect the SPI driver?
-Yes, CS can trig gpio interrupt at the same time. 

Regards

Jing

0 Kudos

981 Views
unknowncoder
Contributor III

Ive already got it working. I just enabled interrupts on the pin. 

0 Kudos