2023-06-07 10:59 AM
Hi All,
I am using STM32F410RB chip.
I want to make launch adc from timer periodically.
From reference manual (RM0401) ADC can be triggered from TIM1_CH1 event.
On figure 49 the only connection from TIM1 to ADC is TRGO.
And from the same figure this TRGO can be triggered by ITR0-ITR3 or by TIF_ED.
How this can be related to TIM1_CH1 event.
From TIM1 description TIM1_CH1 event can be triggered when input compare or output
compare events are triggered. But I don't need external pint TIM1_CH1.
If we don't use external pin how to setup TIM1_CH1 event when CNT overwlows?
I have configured TIM1 without any output pins.
I see that the CNT counter is updating but ADC is not working.
Is it possible to trigger ADC from TIM1 without configuring external poins.
How to trigger TIM1_CH1 event?
Thanks,
2023-06-08 07:44 AM - edited 2023-11-20 03:41 AM
Hello @Community member and welcome to the community,
You can refer to the attached example that I generated using STM32CubeMx
in the ADC Configuration I only set the external Trigger to Timer 1 Capture Compare 1 event
The Timer configuration is as in the screen below:
You need to set the output compare No Output Channel 1 mode to Toggle on match
ps: I attached the project with the .ioc file
Mohamed Aymen
2023-06-08 08:17 AM
Hello,
Thanks for reply.
I am using STM32f410RBT6 chip not bga.
I have checked my settings. They are the same as you provided.
But ADC still not working.
Maybe I am launching ADC wrong?
I enable ADC interrupt and call two functions.
HAL_TIM_Base_Start_IT(&htim1);
HAL_ADC_Start_IT(&hadc1);
I see that ADC interrupt is not triggered. Although TIMI1 is counting.
I see it in peripherals view on the Keil.
But no iterrupts of ADC are trigered.
2023-06-08 08:39 AM
You actually need to enable TIM1_CH1 output (you don't need to assign a pin in GPIO, but I don't know how does this work in CubeMX - if you assign a pin, you at least can check that the triggering signal works). This means that you can't use the "No output" selection and in TIM1 you have to enable also TIM1_BDTR.MOE.
JW
2023-06-08 10:05 AM
Thanks to all for help.
My error was that i was using Srart_timebase function instead of HAL_TIM_OC_Start.
now it works fine