2024-04-18 11:56 PM
I am using timer 2 for trigger DAC and GPIO to generate analog and digital values.
own timer 2 started with DMA to change ARR by an array.
My GPIO array works well and starting to change from index 0 . but my DAC array start from Index 1.
as you can see, the longest pulse (200ms) in latest DAC value (dac[9] = 4000) instead of (dac[0] = 2000)
time[0] = 200000;
time[1] = 100000;
time[2] = 100000;
time[3] = 100000;
time[4] = 100000;
time[5] = 100000;
time[6] = 100000;
time[7] = 100000;
time[8] = 100000;
time[9] = 100000;
dac[0] = 2000;
dac[1] = 2200;
dac[2] = 2500;
dac[3] = 2700;
dac[4] = 2900;
dac[5] = 3100;
dac[6] = 3300;
dac[7] = 3500;
dac[8] = 3700;
dac[9] = 4000;
pin[0] = 0x0000FFFF;
pin[1] = 0xFFFF0000;
pin[2] = 0xFFFF0000;
pin[3] = 0xFFFF0000;
pin[4] = 0xFFFF0000;
pin[5] = 0xFFFF0000;
pin[6] = 0xFFFF0000;
pin[7] = 0xFFFF0000;
pin[8] = 0xFFFF0000;
pin[9] = 0xFFFF0000;
Solved! Go to Solution.
2024-04-19 02:03 AM
I have fixed.
1) start DAC DMA
2) htim2.Instance->EGR = 0x01; // trigged event by software
3) start GPIO DMA
4) start TIMER DMA
but why???
2024-04-19 12:07 AM
I think DAC Trigger Rising edge does not work, it starts on falling edge of TIM2-TRGO.
2024-04-19 02:03 AM
I have fixed.
1) start DAC DMA
2) htim2.Instance->EGR = 0x01; // trigged event by software
3) start GPIO DMA
4) start TIMER DMA
but why???
2024-04-26 12:17 AM
Does anyone know why?