cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G4: trigger SPI DMA through GPIO EXTI event?

BrindhaP
Associate II

Hi, 

I want to get data from an ADC connected externally through SPI DMA whenever data ready pin is set. 

I want to do it without any interrupt handler, since our firmware have already loaded with other stuffs. 

I have tried the synchronisation of SPI DMA with GPIO EXTI trigger. It works when I configure SPI DMA in circular mode only.

Because synchronisation doesn't triggers the SPI DMA it just syncs the process. I can't find any options to trigger the SPI DMA with timer or any event.

How to trigger SPI DMA through GPIO EXTI event? Is that possible in STM32G4 series?.

 

Thank you!

 

 

 

 

 

14 REPLIES 14

Why the maximum request number is 32?

Why maximum number of request is 32 ?


@BrindhaP wrote:

Why maximum number of request is 32 ?


It is only maximum number of request forwarded to DMA by one synchronisation event. Generaly maximum number of requests is 65535 (normal mode) or infinite (circular mode).

32 should be more than enough for one reading from the ADC, right?

Suppose I want to rceive or send 50 bytes of data in one sync event, how can I configure that?


@BrindhaP wrote:

Suppose I want to rceive or send 50 bytes of data in one sync event, how can I configure that?


There should be some tricky ways using dmamux_evt. Also there will be some possibilities using second DMA channel to restart/reconfigure DMA serving SPI (to autonomously restart normal mode transfer). Also many other tricky ways exists, like blidly synchronise triggers by timer with sufficient time interval to be sure all requests are served. Or use timer to generate SPI clock and use your SPI in transmit slave mode ... etc. Or you can simply use DMA in normal mode and interrupt routine to start transfer if there is enought time (to step into ISR and write few DMA registers) between EXTI signals...