AnalogIn, comparator and interrupt

17 Jun 2011

Is there a way to use a comparator on a analog in without continuously sampling with the ADC? Can I program an analog in level that triggers an interrupt?

26 Jul 2011

Sorry for repost, I hope someone can answer.

26 Jul 2011

Just had a quick look at the manual and looks like you are out of luck. Short answer seems to be no, you'll need to sample.

26 Jul 2011

thanks andy

26 Jul 2011

You could maybe an external comparator or op-amp and then use the swing to trigger an interrupt on the mbed?

23 May 2015

http://www.st.com/web/en/resource/technical/document/reference_manual/DM00094349.pdf Then, a question:

Bits 6:4 >>> 3bits settings, 0000 >>> 4bits settings

which is correct? //////////// Bits 6:4 COMP2INMSEL[2:0]: Comparator 2 inverting input selection These bits allows to select the source connected to the inverting input of the comparator 2. 0000: 1/4 of Vrefint 0001: 1/2 of Vrefint 0010: 3/4 of Vrefint 0011: Vrefint 0100: PA4 or DAC1_CH1 output if enabled 0110: PA2 Remaining combinations: reserved. 415/1077 DocID025202 Rev 4 //////////

I read all of STM32F302MR8T6 manual to use STM32F302 nucleo. There is no detail to use analog comparators in a chip. How to write the software without hardware description?

Functional overview the comparators in STM32F302x6 STM32F302x8 21/135 DocID025147 Rev 3

  • Three fast rail-to-rail analog comparators with analog supply from 2.0 to 3.6 V The STM32F302x6/8 devices embed up to three ultra-fast rail-to-rail comparators which offer the features below: Programmable internal or external reference voltage Selectable output polarity. The reference voltage can be one of the following: External I/O DAC output Internal reference voltage or submultiple (1/4, 1/2, 3/4). Refer to Table 26: Embedded internal reference voltage for the value and precision of the internal reference voltage. All comparators can wake up from STOP mode, and also generate interrupts and breaks for the timers.

Takao

02 Nov 2016

Takao Shimizu wrote:

http://www.st.com/web/en/resource/technical/document/reference_manual/DM00094349.pdf Then, a question:

Bits 6:4 >>> 3bits settings, 0000 >>> 4bits settings

which is correct? //////////// Bits 6:4 COMP2INMSEL[2:0]: Comparator 2 inverting input selection These bits allows to select the source connected to the inverting input of the comparator 2. 0000: 1/4 of Vrefint 0001: 1/2 of Vrefint 0010: 3/4 of Vrefint 0011: Vrefint 0100: PA4 or DAC1_CH1 output if enabled 0110: PA2 Remaining combinations: reserved. 415/1077 DocID025202 Rev 4 //////////

RM0365 DocID025202 Rev 6, P416

Bits 6:4 COMP2INMSEL[2:0]: Comparator 2 inverting input selection These bits allows to select the source connected to the inverting input of the comparator 2. 0000: 1/4 of Vrefint 0001: 1/2 of Vrefint 0010: 3/4 of Vrefint 0011: Vrefint 0100: PA4 or DAC1_CH1 output if enabled 0110: PA2 Remaining combinations: reserved.

??? COMP2INMSEL[2:0] 3 bits, above are 4bits.

p419 Bits 6:4 COMP4INMSEL[2:0]: Comparator 4 inverting input selection These bits allows to select the source connected to the inverting input of the comparator 4. 0000: 1/4 of Vrefint 0001: 1/2 of Vrefint 0010: 3/4 of Vrefint 0011: Vrefint 0100: PA4 or DAC1_CH1 output if enabled 0101: Reserved 0110: PE8 0111: PB2 Remaining combinations: reserved.

??? COMP4INMSEL[2:0] 3 bits, above are 4bits.

Takao