![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
january 2015 docid024134 rev 2 1/17 1 AN4232 application note getting started with analog comparators for stm32f3 series introduction this document describes the main features of the analog comparator embedded in stm32f3 series. the application cases are: ? cy cle-by-cycle current control ? fr equency and pulse width measurement ? analog voltage monitoring ? preventing false over-current detections in motor control applications ? humidity measurement the five application cases demonstrate the usefulness of analog comparators and show ho w th ey are integrated with other peripherals, for example, the digital-to-analog-converter (dac) and timers. to ensure a quick start, some application cases presented in this document are imp l emented in c language and are available in the stm32f30x and stm32f37x dsp and standard peripherals library packages. please note that this document is not intend ed to re place the analog comparator (comp) section in the product reference manual. all values given in this document are for guidance only. please refer to the related datasheet for guaranteed and up-to-date values. throughout this document: ? stm3 2f30x refers to the stm32f301, stm32f302, stm32f303, stm32f3x8, stm3 2f328, stm32f358, stm32f398 and stm32f334. ? stm32f37x refers to the stm32f373 and stm32f378 product lines. www.st.com
contents AN4232 2/17 docid024134 rev 2 contents 1 overview of analog comparators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.1 hysteresis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.2 propagation delay (response time) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2 application examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.1 cycle-by-cycle current control (peak current control) . . . . . . . . . . . . . . . . . 8 2.2 frequency and pulse width measurement . . . . . . . . . . . . . . . . . . . . . . . . 10 2.3 analog voltage monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.4 preventing false over-current detections in motor control applications . . 12 2.5 humidity measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 docid024134 rev 2 3/17 AN4232 list of tables 3 list of tables table 1. applicable products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 table 2. typical values of an hysteresis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 table 3. document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 list of figures AN4232 4/17 docid024134 rev 2 list of figures figure 1. effect of a noisy input on a comparator output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 figure 2. waveform of a comparator output with and without an hysteresis . . . . . . . . . . . . . . . . . . . . 6 figure 3. propagation delay in analog comparators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 figure 4. block diagram of cycle-by-cycle current control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 figure 5. comparator outpu t capability in low-power mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 figure 6. current consumption in an analog voltage monito ring application . . . . . . . . . . . . . . . . . . . 11 figure 7. comparator output blanking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 figure 8. block diagram of the humidity measurement applicat ion . . . . . . . . . . . . . . . . . . . . . . . . . . 14 docid024134 rev 2 5/17 AN4232 overview of analog comparators 16 1 overview of analog comparators 1.1 hysteresis a comparator compares the inverting input with the non-inverting input and even small voltage fluctuations cause bounce on comparator the output. this bounce is not acceptable in many applications. figure 1 shows the output bouncing when the input is noisy. figure 1. effect of a noisy input on a comparator output this bounce on the comparator output can be prevented by adding hysteresis into comparators. the analog comparators in stm32f37x and stm32f30x devices have a configurable hysteresis value: no, low, medium and high hysteresis value. table 2 shows the typical values of an hysteresis in each configuration. caution: th e hysteresis feature is not available on the following microcontrollers: stm32f301x6/8, stm32f302x6/8, stm32f303x4/6/8, stm32f334xx, stm32f302xd/e and stm32f303xd/e. 0 6 9 overview of analog comparators AN4232 6/17 docid024134 rev 2 figure 2. waveform of a comparator output with and without an hysteresis 1.2 propagation delay (response time) another important feature of the analog comparat or is the propagation delay. this delay is defined as the time between the moment the input signal crosses the threshold and the moment the output state changes (usually when the output reaches 50% of v dd ). there is a trade off between the comparator propagation delay and the power consumption: the faster the comparator goes, the more it consumes power. in stm32f302xb/c, stm32f303xb/c and st m3 2f37x devices, the operation mode (speed/power consumption) is configurable ma king it useful for both low-power applications (such as voltage monitoring) and critical ti me applications (such as motor control). the analog comparators in stm32f30x and stm32f37x devices can operate at low speed/low power with 2 s/1.2 a and can also operate at high sp eed/high power with 50 ns/75 a. table 2. typical values of an hysteresis hysteresis typical value no hysteresis 0 mv low hysteresis 8 mv medium hysteresis 15 mv high hysteresis 31 mv ,?????]? v , q y h u w l q j , q s x w & |