![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
june 2013 docid17496 rev 7 1/33 AN3216 application note getting started with stm3 2l1xxx hardware development introduction this application note is intended for system designers who require a hardware implementation overview of the development b oard features such as the power supply, the clock management, the reset control, the boot mode settings and the debug management. it shows how to use stm32l1xxx product families and describ es the minimu m hardware resources required to develop an stm32l1xxx application. detailed reference design schematics are also co ntained in this document with descriptions of the main components, interfaces and modes. table 1. applicable products type product categories microcontrollers stm32l1 series www.st.com
contents AN3216 2/33 docid17496 rev 7 contents 1 glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2 power supplies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1.1 independent a/d converter supply and reference voltage . . . . . . . . . . . . 8 2.1.2 independent lcd supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.1.3 voltage regulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2 power supply schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.3 reset and power supply supervisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11 2.3.1 power-on reset (por)/power-down reset (pdr), brownout reset (bor) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.3.2 programmable voltage detector (pvd) . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.3.3 brownout reset (bor) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.3.4 system reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3 clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.1 msi clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.2 hse osc clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.2.1 external source (hse bypass) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.2.2 external crystal/ceramic resonator (hse cr ystal) . . . . . . . . . . . . . . . . . 17 3.3 lse osc clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.3.1 external source (lse bypass) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.3.2 external crystal/ceramic re sonator (lse crystal) . . . . . . . . . . . . . . . . . . 18 3.4 clock security system (css) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4 boot configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.1 boot mode selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.2 boot pin connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.3 embedded boot loader mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 5 debug management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5.2 swj debug port (serial wire and jtag) . . . . . . . . . . . . . . . . . . . . . . . . . . 22 docid17496 rev 7 3/33 AN3216 contents 3 5.3 pinout and debug port pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.3.1 swj debug port pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.3.2 flexible swj-dp pin assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.3.3 internal pull-up and pull-down resistors on jtag pins . . . . . . . . . . . . . . 24 5.3.4 swj debug port connection with standard jtag connector . . . . . . . . . 24 6 recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 6.1 printed circuit board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 6.2 component position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 6.3 ground and power supply (v ss , v dd , v ssa , v dda ) . . . . . . . . . . . . . . . . . 25 6.4 decoupling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 6.5 other signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 6.6 unused i/os and features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 7 reference design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 7.1 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 7.1.1 clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 7.1.2 reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 7.1.3 boot mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 7.1.4 swj interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 7.1.5 power supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 7.2 component references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 8 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 list of tables AN3216 4/33 docid17496 rev 7 list of tables table 1. applicable products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 table 2. boot modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 table 3. debug port pin assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 table 4. swj i/o pin availability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 table 5. mandatory components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 table 6. optional components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 table 7. reference connection for all packages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 table 8. document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 docid17496 rev 7 5/33 AN3216 list of figures 5 list of figures figure 1. power supply overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 figure 2. power supply scheme. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 figure 3. optional lcd power supply scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 figure 4. power supply supervisors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 figure 5. power on reset/power down rese t waveform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 figure 6. pvd thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 figure 7. reset circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 figure 8. external clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 figure 9. crystal/ceramic resona tors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 figure 10. external clock (1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 figure 11. crystal/ceramic resonators (1)(2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 figure 12. boot mode selection implementation example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 figure 13. host-to-board connectio n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 figure 14. jtag connector implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 figure 15. typical layout for v dd /v ss pair . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 figure 16. stm32l152vb(t6) microcontroller reference schemati c . . . . . . . . . . . . . . . . . . . . . . . . . . 29 glossary AN3216 6/33 docid17496 rev 7 1 glossary ? medium-density devices are microcontrollers where the flash memory ranges between 32 and 128 kbytes. ? medium-density + devices are microcontrollers where the flash memory is 256 kbytes. ? high-density devices are microcontrollers where the flash memory is 384 kbytes. docid17496 rev 7 7/33 AN3216 power supplies 32 2 power supplies 2.1 introduction digital power voltage (v core ) is provided with an embedded linear voltage regulator with three different programmable ranges from 1.2 to 1.8 v. to be fully functional at full speed, the device requires a 2.0 to 3.6 v operating voltage supply (v dd ), making possible to reach the digital power voltage v core of 1.8 v (product voltage range 1). product voltage range 2 (v core = 1.5 v) and 3 (v core = 1.2 v) can be selected when the v dd operates from 1.65 to 3.6 v. therefore, frequency is limited to 16 mhz and 4 mhz respectively. when the adc and brownout reset (bor) are not used, the device can operate at power voltages below 1.8 v down to 1.65 v. figure 1. power supply overview note: v dda and v ssa must be connected to v dd and v ss , respectively. v dd v ss ai17469 (v dd ) v dda (v ss ) v ssa adc dac reset block pll (from 1.8 v up to v dda ) v ref+ (must be tied to v ssa ) v ref- v lcd i/o supply v dda domain v dd domain standby circuitry (wakeup logic, iwdg, rtc, lse crystal 32 kbyte osc rcc csr) voltage regulator dynamic voltage scaling lcd v core domain core memories digital peripherals temp. sensor step-up converter v sel power supplies AN3216 8/33 docid17496 rev 7 2.1.1 independent a/d converter supply and reference voltage to improve conversion accuracy, the adc and the dac have an independent power supply that can be filtered separately, and shielded from noise on the pcb. ? the adc voltage supply input is available on a separate v dda pin ? an isolated supply ground conn ection is provided on the v ssa pin v dda and v ref require a stable voltage. the consumption on v dda can reach several ma (see i dd (adcx), i dd (dac), i dd (compx), i vdda , and i vref in the product datasheets for further information). when available (depending on the package), v ref must be tied to v ssa . on bga 64-pin and all 100-pin or more packages to ensure a better accuracy on low-voltage inputs and outputs, the user can connect to v ref+ , a separate external reference voltage wh ich is lower than v dd . v ref+ is the highest voltage, represented by the full scale value, for an analog input (adc) or output (dac) signal. ? for adc ? 2.4 v v ref+ = v dda for full speed (adcclk = 16 mhz, 1 msps) ? 1.8 v v ref+ = v dda for medium speed (adcclk = 8 mhz, 500 ksps) ? 2.4 v v ref+ v dda for medium speed (adcclk = 8 mhz, 500 ksps) ? 1.8 v v ref+ < v dda for low speed (adcclk = 4 mhz, 250 ksps) ? when product voltage range 3 is selected (v core = 1.2 v), the adc is low speed (adcclk = 4 mhz, 250 ksps) ? for dac ? 1.8 v v ref+ < v dda on packages with 64 pins or less (except bga package) v ref+ and v ref- pins are not available. they are internally connected to the adc voltage supply (v dda ) and ground (v ssa ). docid17496 rev 7 9/33 AN3216 power supplies 32 2.1.2 independent lcd supply the v lcd pin is provided to control the contrast of the glass lcd. this pin can be used in two ways: ? it can receive, from an external circuitry, the desired maximum voltage that is provided on the segment and common lines to the glass lcd by the microcontroller. ? it can also be used to connect an external capacitor that is used by the microcontroller for its voltage step-up converter. this step-up converter is controlled by software to provide the desired voltage to the segment and common lines of the glass lcd. refer to the specific product datasheet for the capacitor value. the voltage provided to the segment and common lines defines the contrast of the glass lcd pixels. this contrast can be reduced when the dead time between frames is configured. 2.1.3 voltage regulator the internal voltage regulator is always enabled after reset. it can be configured to provide the core with three different voltage ranges. choosing a range with low v core reduces the consumption but lowers the maximum acceptable core speed. consumption ranges in decreasing consumption order are as follows: ? range 1, available only for v dd above 2.0 v, allows maximum speed ? range 2 allows cpu frequency up to 16 mhz ? range 3 allows cpu frequency up to 4 mhz voltage regulator works in three different modes depending on the application modes. ? in run mode, the regulator supplies full power to the v core domain (core, memories and digital peripherals). ? in stop mode, low power run and low power wait modes, the regulator supplies low power to the v core domain, preserving the contents of the registers and sram. ? in standby mode, the regulator is powered of f. the contents of the registers and sram are lost except for those concer ned with the standby circuitry. power supplies AN3216 10/33 docid17496 rev 7 2.2 power supply schemes the circuit is powered by a stabilized power supply, v dd . ? the v dd pins must be connected to v dd with external decoupling capacitors; one single tantalum or ceramic capacitor (minimum 4.7 f typical 10 f) for the package + one 100 nf ceramic capacitor for each v dd pin). ? the v dda pin must be connected to two external decoupling capacitors (100 nf ceramic capacitor + 1 f tantalum or ceramic capacitor). ? the v ref+ pin can be connected to the v dda external power supp ly. if a separate, external reference voltage is applied on v ref+ , a 100 nf and a 1 f capacitor must be connected on this pin. to compensate peak consumption on vref, the 1 f capacitor may be increased up to 10 f when the sampling speed is high. when adc or dac is used, v ref+ must remain between 1.8 v and v dda . v ref+ can be grounded when adc and dac are not active; this enables the user to power down an external voltage reference. ? additional precautions can be ta ken to filter analog noise: v dda can be connected to v dd through a ferrite bead. figure 2. power supply scheme 1. v ref + is either connected to v dda or to v ref . 2. n is the number of v dd and v ss inputs. msv18291v2 vdd1/2/.../n analog: rcs, pll,... gpios out in kernel logic (cpu, digital & memories) standby-power circuitry (osc32k,rtc,wake-up logic, rtc backup registers n 100 nf + 1 10 f regulator vss1/2/.../n vdda vref+ vref- vssa adc level shifter io logic vdd 100 nf + 1 f vref 100 nf + 1 f vdda docid17496 rev 7 11/33 AN3216 power supplies 32 figure 3. optional lcd power supply scheme ? option 1 : lcd power supply is provided by a dedicated vlcd su pply source, vsel switch is open. ? option 2 : lcd power supply is provided by the in ternal step-up conv erter, vsel switch is closed, an external capacitance is neede d for correct behavior of this converter. note: the availa bility of the v lcd rails depend on the device; please refer to your product datasheet for more details. 2.3 reset and power supply supervisor the input supply to the main and low power regulators is monitored by a power-on/power- down/brownout reset circuit. power-on/power-down reset are a null power monitoring with fixed threshold voltages, whereas brownout reset gives the choice between several thresholds with a very low, but not null, power consumption. in addition, the stm32l1xxx embeds a progra mmable voltage detector that compares the power supply with the programmable threshold. an interrupt can be generated when the power supply drops below the v pvd threshold and/or when the power supply is higher than the v pvd threshold. the interrupt service routine then generates a warning message and/or puts the mcu into a safe state. msv32511v1 v dd1/2/.../n n x 100 nf + 1 x 10 f step-up converter v ss1/2/.../n v dd 100 nf v lcd v lcdrail1 v lcdrail2 v lcdrail3 v lcd pb0 or pe12 pb2 pb12 or pe11 c ext c rail3 lcd vsel c rail2 c rail1 option 1 option 2 power supplies AN3216 12/33 docid17496 rev 7 figure 4. power supply supervisors 1. the pvd is available on al l stm32l devices and it is enab led or disabled by software. 2. the bor is available only on devices operating from 1. 8 to 3.6 v, and unless disabled by option byte it masks the por/pdr threshold. 3. when the bor is disabled by option byte, the reset is asserted when v dd goes below pdr level. 4. for devices operating from 1.65 to 3.6 v, there is no bor and the reset is released when v dd goes above por level and asserted when v dd goes below pdr level. v dd /v dda pvd output 100 mv hysteresis v pvd v bor hysteresis 100 mv it enabled bor reset (n rst) por/pdr reset (nr st) pvd bor always active por/pdr (bor not available) ai17211b por v / pdr v bor/pdr reset (nrst) bor disabled by option byte (note 1) (note 2) (note 3) (note 4) docid17496 rev 7 13/33 AN3216 power supplies 32 2.3.1 power-on reset (por )/power-down reset (pdr), brownout reset (bor) the monitoring voltage begins at 0.7 v. during power-on, for devices operating betwee n 1.8 and 3.6 v, the bor keeps the device under reset until the supply voltages (v dd and v ddio ) come close to the lowest acceptable voltage (1.8 v). at power-up th is internal reset is maintained during ~1 ms to wait for the supply to reach its final value and stabilize. at power-down the reset is acti vated as soon as the power drops below the lowest limit (1.65 v). at power-on, a defined reset should be maintained below 0.7 v. the upper threshold for a reset release is defined in the electrical char acteristics section of the product datasheets. figure 5. power on reset/power down reset waveform if you want to run the cpu at full speed the threshold should be raised to 2.0 v. for a programmable threshold above the chip lowest lim it, a brownout reset can be configured to the desired value. the bor can also be used to detect a power voltage drop earlier. the threshold values of the bor can be configured through the flash_obr option byte. 2.3.2 programmable volt age detector (pvd) the device features an embedded programmable voltage detector (pvd) that monitors the v dd /v dda power supply and compares it to the v pvd threshold. seven different pvd levels can be selected by software between 1.85 v and 3.05 v, with a 200 mv step. an interrupt can be generated when v dd /v dda drops below the v pvd threshold and/or when v dd /v dda is higher than the v pvd threshold. the interrupt service routine then generates a warning message and/or puts the mcu into a safe state. the pvd is enabled by software configuration. as an example, the servic e routine can perform emergency shutdown tasks. v dd /v dda re s et por pdr temporiz a tion t r s ttempo power supplies AN3216 14/33 docid17496 rev 7 figure 6. pvd thresholds 2.3.3 brownout reset (bor) during power on, the brownout reset (bor) keeps the device under reset until the supply voltage reaches the specified v bor threshold. for devices operating from 1.65 to 3.6 v, the bor option is not available and the power supply is monitored by the por/pdr. as th e por/pdr thresholds are at 1.5 v, a ?grey zone? exists between the v por /v pdr thresholds and the minimum product operating voltage 1.65 v. for devices operating from 1.8 to 3.6 v, th e bor is always active at power on and its threshold is 1.8 v. when the system reset is released, the bor leve l can be reconfigured or disabled by option byte loading. if the bor level is kept at the lowest level, 1.8 v at power-on and 1.65 v at power down, the system reset is fully managed by the bor and the product operating voltages are within safe ranges. when the bor option is disabled by option byte, the power down reset is controlled by the pdr and a ?grey zone? exists between the 1.65 v and v pdr . v bor is configured through device option bytes. by default, level 4 threshold is activated. five programmable v bor thresholds can be selected (see product datasheets for actual v bor0 to v bor4 thresholds). when the supply voltage (v dd ) drops below the selected v bor threshold, a device reset is generated. when the v dd is above the v bor upper limit the device reset is released and the system can start. bor can be disabled by programming the device option bytes. to disable the bor function, v dd must have been higher than v bor0 to start the device option byte programming sequence. the power-on and power-down is then monitored by the por and pdr (see power-on reset (por)/power-down reset (pdr) section in the product datasheets). the bor threshold hysteresis is ~100 mv (between the risi ng and the fallin g edge of the supply voltage). v dd /v dda pvd o u tp u t 100 mv hy s tere s i s pvd thre s hold docid17496 rev 7 15/33 AN3216 power supplies 32 2.3.4 system reset a system reset sets all registers to their rese t values except for the rtc, backup registers and rcc control/status register, rcc_csr. a system reset is generated when one of the following events occurs: 1. a low level on the nrst pin (external reset) 2. window watchdog end-of-count condition (wwdg reset) 3. independent watchdog end-of -count condition (iwdg reset) 4. a reset bit set by software (swreset) 5. entering standby or stop mode configured to generate a reset (low-power management reset) 6. option byte loader reset 7. exiting standby mode the reset source can be identified by checking the reset flags in the control/status register, rcc_csr. figure 7. reset circuit the stm32l does not require an external rese t circuit to power-up correctly. only a pull- down capacitor is recommended to improve ems performance by pr otecting the device against parasitic resets (see figure 7 ). charging/discharging the pull-down capacitor thru the internal resistor adds to the device power consumption. the recommended value of 100 nf for the capacitor can be reduced to 10 nf to limit this power consumption. r pu v dd /v dda pulse generator (min 20 s) system reset filter 0.1 f external reset circuit nrst ai14366d 8 8 % ( s f t f u * 8 % ( s f t f u 1 p x f s s f t f u 4 p g u x b s f s f t f u - p x q p x f s n b o b h f n f o u s f t f u 0 q u j p o c z u f m p b e f s s f t f u & |