cancel
Showing results for 
Search instead for 
Did you mean: 

How to access the signal formation process when using DMA

macam1
Associate III

A signal is generated by a DAC DMA used on the STM32F405. Using a buffer containing an array [100]. As shown in the picture, the point (circle on the line) represents the point to be detected. This is only for detection, not to start and stop the signal.

In short, I want to detect when the array [45] "starts ignition detection" and array [50] "stops ignition detection". However, I'm still trying to figure out how to detect it because the DMA will directly generate the signal without me knowing exactly where it forms the array [45].

Do you have any suggestions or ideas on how to achieve this?

 

WhatsApp Image 2024-12-12 at 09.58.56_187f2753.jpg

 

3 REPLIES 3
MasterT
Lead

You can use another TIM as a counter.

Let say you already conected TIM1->DAC->DMA. So waveform generated with sampling rate defined by TIM1 clock.

Than chain same events  (that triggers a DAC conversion) to another timer like TIM1->TIM2 and set tim2 to fire interrupt when it's reach specific values 45 or 50. 

Timer 2 in external clock mode 1 (SMS=111 in TIM2_SMCR register).

But I want the counter data or array, not the sampling time.

Right, sync necessary. DMA generates 2 interrupt, HalfComplete (HT) and TransferComplete (TC). Just reset TIM2 inside TC interrupt subroutine. Than each sample transfered by DMA  'd corresponds to TIM2 CNT incremented value. There is also option to verify that system in sync, read DMA counter and TIM2 CNT and compare at any moments. I see learning is complicated, get youself more familiar with DMA, check what registers it has, what information available to read. Reference Manual (RM) for uCPU is your bible