cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronizing ADC injected conversions to regular continuous ADC

SNema
Associate

Summary: ADC injected mode has one property that makes it very inconvenient for my use.

If an external injected trigger occurs or if the JSWSTART bit is set during the

conversion of a regular group of channels, the current conversion is reset.

I'm hoping to find a way to synchronize an injected conversion to regular continuous conversions so that the current conversion is not reset and the injected conversion simply happens after the current regular conversion completes.

Details:

In my application, I have ADC running in regular continuous mode where my sample window is synchronized precisely to some external events. I cannot accommodate any drift / skew to my sample window. Continuous mode works fine for this application as long as I take care to synchronize things once at startup.

Occasionally I need to sample some low-priority / high-latency inputs (for example, external temperature sensors). A nice way to do this might be to use injected mode to sample those low-priority inputs, then return to continuous sampling of my low-latency inputs.

Problem:

Triggering an injected conversion kills my synchronization, even if I specify injected mode sampling time to be equivalent to regular continuous mode sampling time. The reason is that the current conversion is reset when I trigger an injected conversion. So you can imagine I'm N ADC clock cycles into a regular conversion when the injected trigger hits, that regular conversion gets dropped on the floor, now when regular conversions resume I'm skewed by N cycles.

One idea might be to trigger an injected conversion at some precise time so that the injected conversion request happens to be received at exactly the cycle that a regular conversion completes. I'm not sure this is possible though, and the timing isn't clear at all from the reference manual timing diagrams.

Any ideas for this type of application? Maybe I shouldn't be using injected mode here. I tried playing around with JAUTO, but it looks like it's not meant to be set / cleared dynamically during continuous regular conversions (I ran into DMA errors). Maybe there's some better solution.

0 REPLIES 0