cancel
Showing results for 
Search instead for 
Did you mean: 

How to start an ADC conversion at some analog signal level?

KNuzh.1
Associate

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 ???)

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

3 REPLIES 3

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

KNuzh.1
Associate

I wonder which way would be the fastest?

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