2021-02-25 10:44 AM
What I have: STM32L496, analog signal input.
What I need: on some level of analog signal start an ADC conversion with some delay (80...200 ns. Basically, 55-80 ns is the propagation delay for builtin comparator and 20 ns is the shortest sampling time).
What is the best way to do this?
So far I came up with something like this:
DAC_OUT->COMP_IN->???(timer?)->ADC (External trigger conversion source ???)
Solved! Go to Solution.
2021-02-25 01:51 PM
Sounds plausible. There appears to be only one choice (if I haven't overlooked something), COMPx->TIM3_OR1.TI_RMP>0->TIM3_CH1->set as Input Capture in TIM3_CCMRx and enabled in TIM3_CCER->TIM3_CR2.MMS=0b011 (entirely incorrectly named Compare Pulse) -> TIM3_TRGO and that can be then used as EXT4 in ADC.
Another option would be to output COMP2_OUT onto PB11 by setting it to AF and setting AFR according to COMP2_OUT; and use that pin as EXTI11 by selecting it in the EXTI MUX in SYSCFG, and that's ADC EXT6.
JW
2021-02-25 01:51 PM
Sounds plausible. There appears to be only one choice (if I haven't overlooked something), COMPx->TIM3_OR1.TI_RMP>0->TIM3_CH1->set as Input Capture in TIM3_CCMRx and enabled in TIM3_CCER->TIM3_CR2.MMS=0b011 (entirely incorrectly named Compare Pulse) -> TIM3_TRGO and that can be then used as EXT4 in ADC.
Another option would be to output COMP2_OUT onto PB11 by setting it to AF and setting AFR according to COMP2_OUT; and use that pin as EXTI11 by selecting it in the EXTI MUX in SYSCFG, and that's ADC EXT6.
JW
2021-02-26 11:55 AM
I wonder which way would be the fastest?
2021-02-26 12:36 PM
Why not trying both and see?
I personally would deliberately run the system clock very low during such tests, to be able to easily see the difference. I'd expect jitter, if synchronization to internal clock occurs at any point.
JW