cancel
Showing results for 
Search instead for 
Did you mean: 

ADC dual mode w watchdog and dma: ADC1 watchdog appears not usable

dhaselwood
Associate II
Posted on February 02, 2014 at 05:12

I would like to find out if the following is correct--

The ADC1 watchdog comparison will not work when dual mode with DMA is used as dual mode places the ADC2 reading in the upper half of the ADC1 data register, with the result that the ADC1 DR will always be high compared to the 16b watchdog register (except if fortuitously the ADC2 conversion was zero).

Part: STM32F103GT6

The situation is a quadrature shaft encoder with two reflective photodetectors,  one to ADC1 and the other to ADC2.  The watchdog high/low registers with each are set to give hystersis and an interrupt, etc.  This works fine.

Now I want to add some monitoring of the values by using DMA in circular mode with 1/2 and completion interrupts, to store the conversion values in a buffer.  DMA requires setting dual mode, which causes the ADC1 Data Register to be loaded with ADC2 in the upper half of the word.  It appears that the ADC1 watchdog compare makes the comparison on the 32 bits and not just the lower 16b, with the result that using the watchdog for ADC1 will no longer work since the upper bits will have some bits from the ADC2 conversion.  I find that the ADC2 watchdog continues to work correctly, but ADC1 watchdog will not generate an interrupt.

3 REPLIES 3
raptorhal2
Lead
Posted on February 02, 2014 at 16:29

ST reps browse this forum and should provide a response.

A possible work around is to pair ADC1 inputs with ADC3 and use ADC3 in continuous mode to generate the missing ADC1 analog watchdog interrupts.

Cheers, Hal

Posted on February 02, 2014 at 16:47

Looking at the RM, this seems to be a quite credible issue. Pushing to moderation.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
dhaselwood
Associate II
Posted on February 02, 2014 at 17:49

Thanks clive1.

Yes, using ADC3 is probably the solution.  It would be good to confirm the understanding of DMA dual mode with ADC1,2 and watchdog.