2020-02-15 07:33 AM
The ADC (ADC3 if that's relevant) provides for triggering by way of the TIM6 TRGO event. I have the ADC configured to convert with "ExternalTrigConv" pointing to ADC_EXTERNAL_TRIG_T6_TRGO, and the update event's rising edge. In no case am I able to get the thing to trigger though, not off of TIM6, only by software conversion start. I'm sure TIM6 is firing because when I intercept its ISR it's running on time, it's just not triggering the ADC.
The errata for the 32F4xx suggests that one has to enable the DAC RCC clock domain for it to work. This doesn't help on the H7 (and it's not mentioned in the H7 errata).
Has anyone managed to use TIM6 to trigger conversions of the ADC? I can start the s/w conversion in a roundabout way (roundabout because of the HAL locks if I do stuff in ISRs) after TIM6 fires its ISR but I'd rather not couple things so closely.
TIM6 when it's mentioned in the docs is always in relation to the DAC and not the ADC so I wonder if the connection just doesn't exist on the H7 part. Anyone? TIA
Solved! Go to Solution.
2020-03-11 09:44 AM
When using another timer, get the magic value for the ADCx->CFGR= line from the table titled ADC1, ADC2 and ADC3 - External triggers for regular channels in the reference manual.
TIM7 is not listed in the table, it is no wonder that it didn't work.
TIM1 has a few possibilities, capture/compare event on channels 1,2,3 or its trigger outputs.
2020-03-11 12:57 PM
OK, thanks for confirming that. I will make a minimal example and send to ST support for help. This application does require microsecond accuracy to sample from the edges of a PWM signal, so I need it to work. Frustrating as it is probably some simple setting...
2020-03-11 04:04 PM
Actually, I did manage to resolve it. It works perfectly. TBH, I am not completely sure why it wasn't working yesterday, but it is today. I suspect I did not have master mode enabled...
So for future reference, STM32H753, TIM1 OC2REF or UpdateEvent can be used on TRGO2 to drive ADC1 to start conversions. USe update event for when PWM is off, then switch to OCxREF when PWM is on to trigger on each PWM edge.
2020-03-12 12:56 AM
> I suspect I did not have master mode enabled...
Master mode cannot be enabled/disabled, it's always on. The source of the output triggers can be selected, but some kind of trigger is always enabled. The default is trigger on reset event on both, so be careful when setting the prescaler, because generating the update event activates the trigger by default.
2020-03-12 07:11 AM
2020-03-12 08:09 AM
I'm afraid that HAL and CubeMX has improved a lot since you guys wrote that code for the other series.
Apparently some clicking around in CubeMX can solve it now.
It's just the guy writing my paychecks who doesn't like such answers as I don't know how much random clicking around is needed to implement this feature. As a matter of policy, non-working and poorly documented library calls are now removed on sight, if the underlying interface is properly documented.