AnsweredAssumed Answered

DISCO 469 and DMA

Question asked by rascalito on Jan 9, 2017
Latest reply on Jan 12, 2017 by rascalito

Hello!

I'm trying to implement a microphone (MEMS) acquisition as described in the document "Audio Processing With

an Open Development System". See page 14, Multi Microphone acquisition.

Basically the acquisition works for 16 mics plugged into the Arduino interface, pins PG9 to PG14. Thanks to ST's technical support!! I get the half buffer and full buffer interrupts, which is what I wanted.

Now I want to retrieve the data produced with the above interrupts from an external system using SPI.

What I did first is:

   Configure Timer8 so that it gets clocked at 12.288 MHz. (I changed the crystal to make it work, otherwise don't

try, there is no clock setting capable of producing that frequency). Configure DMA so that it's clocked by Tim8, and send the results into memory. So the DMA is not incremented at the port side, but is incremented at the memory side.

   This works.

   Now I have tried to configure SPI1 as full duplex slave (I did that in Cube MX). Set the proper DMA on RX, set the DMA interrupt, etc... And simply use HAL_SPI_Receive_DMA to kick the DMA, and use  HAL_SPI_RxCpltCallback to receive the external buffer.

  I'm using another board to send SPI buffers externally.

  The problem:

   I can have SPI interrupts only if I don't use Timer 8.

   At first, I had used SPI1. But SPI1 uses DMA2, stream 0. Timer8 uses also DMA2, but stream 1. Therefore I thought that using a single DMA (DMA2 here) for 2 different purposes could be the problem. I have tried to change and used SPI2 instead of SPI1. SPI2 uses DMA1 stream 3, so in this case since it's not the same DMA, it might work I thought. Result: it's exactly the same output, it doesn't work. If I use timer8, no SPI. If I don't use timer8, I get SPI. Can anybody tell me how to use 2 DMAs for what I would like to do?

  To summarize what I want to do:

- Acquisition of port G using timer8 and DMA

- Retrieing my data from outside using SPI and DMA.

Is this possible? It doesn't sound beyond technology. Is it because I access the same memory (internal) with 2 DMAs, therefore access the same bus with 2 DMAs?

 

Please find the main.c in attachment. If I comment out the line 

__HAL_TIM_ENABLE_DMA(&htim8, TIM_DMA_UPDATE); // Try to comment this line

then I can get SPI interrupts, but of course no timer. If I uncomment this line, then I can get the timer,

but no SPI interrupt.

 

Thanks for any hint.

 

Pascal

Attachments

Outcomes