2025-09-30 11:56 PM
Hello,
I have an issue and until now didn't find the solution :
Using ADC2, one channel IN12, triggered by timer every 100µs, using circular DMA sized of 16 half-words, the array [0] value is always 0, the array's index used by DMA is from 1 to 16, not 0 to 15. See below screen shots :
code :
volatile uint16_t _v_Adc2Values [18]; // Define to 18 to see the shift
HAL_ADC_Start_DMA (&hadc2, (uint32_t *) _v_Adc2Values, 16);
HAL_TIM_Base_Start_IT (&htim15);
result :
When I starts my software this morning to make the screen shots, the 1st start, I have not the issue, the values comes from 0 to 15 in array. Then I restarted my software several times, and all these tries the array result was shifted like the screen shot.
Thank for your help.
Best regards,
Laurent
2025-10-01 12:12 AM
I think the DMA settings are missing in your description.
> Then I restarted my software several times, and all these tries the array result was shifted like the screen shot.
Does "restart" mean a reset without power cycle ?
Perhaps you inadvertendly change the DMA settings somewhere.
I would check and compare the relevant DMA register contents for both cases, i.e. before and after a restart.
2025-10-01 12:17 AM
yes restart is without power cycle.
I do again the same test : power off, power on, launch in debug and run, and this time, the array is shifted.
2025-10-01 12:40 AM
> ... the array is shifted.
Not exactly. The values have shifted within the array.
Which indicates the DMA target address has changed.
2025-10-01 12:44 AM
I would like to say that values are written by DMA in array from index 1 to 16 instead of 0 to 15.