AnsweredAssumed Answered

Starting SPI master with DMA by an external signal

Question asked by alferink.freddy on Apr 3, 2015
Latest reply on Apr 9, 2015 by alferink.freddy
I'm trying to read the serial data from two AD7766 (24 bit ADC in daisy chain mode) with a STM32F4 discovery board. The two AD7766 generates every 8 us new data. This is indicated by the "Data Ready" (DTRY) pin who is going low, and the 6 bytes must be read immediately by the serial interface. The serial data on SDO is clocked out by the SCLK input.

Now I want to use the SPI with DMA to minimize CPU time (SPI1, DMA 2, Channel 3, Stream 0). Because the AD7766 SCLK in an input, the SPI must be configured as master. My problem is how to start the SPI communication (reading 6 bytes set in DMA2_S0NDTR register) on every falling edge on the AD7766 DTRY pin. According to the reference manual RM0090 the NSS pin can't be used for this purpose: "When configured in master mode with NSS configured as an input the SPI enters the master mode fault state".

I've tryed to several ways to start the SPI with an interrupt routine who is triggered by a falling edge of the DTRY and sets the SPE and/or DMA enable bit. But no configuration i've tried works as desired.
Beside this, it's undesirable to use an interrupt for starting the SPI due to the extra CPU time with the insuperable overhead.

The question is how configure the SPI and DMA so it works as discribed above and starts without using any CPU time.

Outcomes