cancel
Showing results for 
Search instead for 
Did you mean: 

Hello! I'm using the STM32L051C8T6 controller. I want to configure ADC polling via DMA with start on the timer event. The interrupt is triggered only once, what could be the problem? I didn't find any data in errata for this case.

AOgar.1
Associate

I describe in more detail what I did. The STM32L051C8T6 controller operates from an external oscillator at a frequency of 20 MHz, a general purpose timer TIM2 with a prescaler 199 and a counter period 99, thus the counting frequency is 1000 Hz. The 4th channel of the timer is turned on in Output Сompare No Output, and Toggle on match mode is selected, all other fields by default. The global timer interrupt is also enabled (it does not apply to the ADC operation, it is necessary for other functions in the project). The ADC polls 2 channels IN0 and IN1, the start is changed from software to start on the TIM2 Output Compare 4 Event, on the rising edge. The remaining fields are left by default. Added Channel1 in the DMA tab and selected Circular mode. Further in the code in the main () function, before the infinite loop while (), I write the following lines

HAL_ADCEx_Calibration_Start(&hadc, ADC_SINGLE_ENDED);

HAL_ADC_Start_DMA(&hadc, (uint32_t*) adcValue , 2);

HAL_TIM_Base_Start_IT(&htim2);

HAL_TIM_OC_Start_IT(&htim2, TIM_CHANNEL_4); where adcValue is an array of 2 uint16_t variables.

After starting, interrupts occur from the timer HAL_TIM_PeriodElapsedCallback() and HAL_TIM_OC_DelayElapsedCallback() the same number of times, but in HAL_ADC_ConvCpltCallback() comes only once, the readings from the ADC, of course, are no longer updated. What am I doing wrong?

On the F103 series controller with similar settings, this code works correctly, on the L071 controller, the situation is similar as with the L051. Is there some feature that I don't take into account or is it a hardware error?

1 REPLY 1
AOgar.1
Associate

Is nobody can help with a simple question? Where can I write to? Where are all the ST specialists?