cancel
Showing results for 
Search instead for 
Did you mean: 

How to read continuous data from an external ADC via the SPI interface with DMA?

CH_bot_
Associate II

I am not sure how to read continuous data from an external ADC. The ADC has an SPI interface and a data ready pin.

Every time the data is ready, the data ready pin goes low and the data can be read. 

My goal is to read out the data via the DMA every time the data ready pin goes low.

Is this possible?

Unfortunately I have not found any examples.

I would be very grateful for any help.

10 REPLIES 10

Correct. Likely I just catch term (not existed at that time officially) from

  hspi2.Init.NSSPMode                   = SPI_NSS_PULSE_ENABLE;
  hspi2.Init.NSSPolarity                = SPI_NSS_POLARITY_LOW;

NSSP...Mode

Advantage of using this mode is to get complete flexibility over sampling rate, SPI in this case running from PLL3.

There is poor alternative, to use Timer->DMA->SPI link, that provides only rough approximation to desired frequency (integer dividers of the main 480 MHz) and may not be acceptable for audio. Secondly, I'm not sure if SPI driven by DMA generates NSS (Chip Select or  Bus select - frame marking SPI bus in essence) .

I had a hard time to figure out all bugs regarding CS pin in different F4/F7/H7 products and in different modes of operation : TI / Motorola / Master-slave etc, so was very happy to discover that two lines of code takes all my headache away