AnsweredAssumed Answered

Best way to aquire data from SPI

Question asked by Mikael Elharrar on Jun 8, 2017
Latest reply on Jun 8, 2017 by Butcher

Hi community,

 

I'm using an external ADC with my kinetis k64.

The micro is configured as SPI Master.

The ADC is sampling two analog signals at 42 KiloSamplesPerSeconds.

A GPIO input pin (configured as interrupt), drives me a falling edge at each new sample. Then I need to send 12 bytes through SPI to get the samples (4 bytes status, 4 bytes sample channel 1 and 4 bytes sample 2).

After some testbenches, I see that it is impossible to work in interrupt mode. This make the microcontroller "crazy".

Note that for each 16 samples I need to write the block of aquiered data into a flash memory.

My question is:

What is the best model to use with DMA/SPI ?

Is there a way to start a DMA transfer with gpio interrupt ?

 

The operation should be:

1) Interrupt occurs (DMA trigger)

2) DMA send through SPI 12 bytes

3) The retrieve data are stored in memory.

4) After 16 samples, write the block into memory, but should not stop the data retrieval.

 

Any idea ?

 

Thanks

Outcomes