2017-10-11 11:50 PM
Hello,
I'm newbie with STM32 microcontrollers.
I want to read ADC in regular mode conversion but triggered by TIM1 Capture Compare event with a period of 100us.
Despite the fact that TIM1 Capture Compare on channel 2 has an event (interruption) at every 100us - tested by toggling LD2 on board - ADC does not trigger.
Instead, if I use injected mode conversion ADC trigger and it achieve values.
I checked 'stm32f4xx_hal_adc.c' to see if is any reference about start conversion with external trigger/timer trigger but I didn't find something.
What can I have to do to make the project work?
In attachment is CubeMX project settings and main.c file.
2017-10-12 07:41 PM
Get the ADC trigger pin for normal channel manually wired to a timer channel.
To make sure things works fine, check the setup: If the trigger is launching a multichannel sweep or not?
If yes, you'll need a DMA to read all the values from a single ADC DR and expand them on a RAM array for reading.
Make sure the channel sweep is done in one shot mode.
2017-10-13 12:20 AM
Hello,
thank you for advices. I checked your advice and nothing is happening.
But if I place this: hadc1.Instance->CR2 |= ADC_CR2_SWSTART; in stm32f4xx_it.c where TIM IRQ is handling everything works like charm.
I read in any direction stm32f4xx_hal_adc.c but nowhere is written what happens if there is an external/timer trigger, only if no external trigger/timer trigger exists. I guess it is a bug in this library.
Thank you again and best regards.