![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
this is information on a product in full production. december 2014 docid018780 rev 6 1/115 stm8l151c2/k2/g2/f2 stm8l151c3/k3/g3/f3 8-bit ultra low-power mcu, up to 8 kb flash, up to 256 b data eeprom, rtc, timers, usart, i2c, spi, adc, comparators datasheet - production data features ? operating conditions ? operating power supply: 1.65 to 3.6 v (without bor), 1.8 to 3.6 v (with bor) ? temperature range: -40 to 85 or 125 c ? low power features ? 5 low-power modes: wait, low power run, low-power wait, active-halt with rtc, halt ? ultra-low leakage per i/0: 50 na ? fast wakeup from halt: 5 s ? advanced stm8 core ? harvard architecture and 3-stage pipeline ? max freq: 16 mhz, 16 cisc mips peak ? up to 40 external interrupt sources ? reset and supply management ? low-power, ultra safe bor reset with 5 selectable thresholds ? ultra-low power por/pdr ? programmable voltage detector (pvd) ? clock management ?32 khz and 1-16 mhz crystal oscillators ? internal 16 mhz factory-trimmed rc ? internal 38 khz low consumption rc ? clock security system ? low power rtc ? bcd calendar with alarm interrupt ? digital calibration with +/- 0.5 ppm accuracy ? lse security system ? auto-wakeup from halt w/ periodic interrupt ? memories ? up to 8 kbytes of flash program memory plus 256 bytes of data eeprom with ecc ? flexible write/read protection modes ? 1 kbyte of ram ? dma ? 4 channels supporting adc, spi, i 2 c, usart, timers ? 1 channel for memory-to-memory ? 12-bit adc up to 1 msps/28 channels ? temp. sensor and internal ref. voltage ? 2 ultra low-power comparators ? 1 with fixed threshold and 1 rail to rail ? wakeup capability ? timers ? two 16-bit timers with 2 channels (ic, oc, pwm), quadrature encoder (tim2, tim3) ? one 8-bit timer with 7-bit prescaler (tim4) ? 1 window and 1 independent watchdog ? beeper timer with 1, 2 or 4 khz frequencies ? communication interfaces ? one synchronous serial interface (spi) ? fast i 2 c 400 khz ? one usart ? up to 41 i/os, all mappable on interrupt vectors ? up to 20 capacitive sensing channels supporting touchkey, proximity touch, linear touch, and rotary touch sensors ? development support ? fast on-chip programming and non- intrusive debugging with swim ? bootloader using usart ? 96-bit unique id ufqfpn32 tssop20 ufqfpn20 lqfp48 7x7mm 5x5mm ufqfpn28 4x4mm 3x3mm 6.5x6.4mm www.st.com
contents stm8l151x2, stm8l151x3 2/115 docid018780 rev 6 contents 1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.1 device overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.2 ultra-low-power continuum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3 functional overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.1 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.2 central processing unit stm8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.2.1 advanced stm8 core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.2.2 interrupt controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.3 reset and supply management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3.1 power supply scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3.2 power supply supervisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3.3 voltage regulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.4 clock management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.5 low power real-time clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.6 memories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.7 dma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.8 analog-to-digital converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.9 ultra-low-power comparators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.10 system configuration controller and routing interface . . . . . . . . . . . . . . . 21 3.11 touch sensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.12 timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.12.1 16-bit general purpose timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.12.2 8-bit basic timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.13 watchdog timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.13.1 window watchdog timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.13.2 independent watchdog timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.14 beeper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.15 communication interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.15.1 spi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 docid018780 rev 6 3/115 stm8l151x2, stm8l151x3 contents 4 3.15.2 i2c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.15.3 usart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.16 infrared (ir) interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.17 development support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4 pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 4.1 system configuration options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 5 memory and register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.1 memory mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.2 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 6 interrupt vector mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 7 electrical parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 7.1 parameter conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 7.1.1 minimum and maximum values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 7.1.2 typical values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 7.1.3 typical curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 7.1.4 loading capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 7.1.5 pin input voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 7.2 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 7.3 operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 7.3.1 general operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 7.3.2 embedded reset and power control block characteristics . . . . . . . . . . . 54 7.3.3 supply current characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 7.3.4 clock and timing characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 7.3.5 memory characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 7.3.6 i/o current injection characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 7.3.7 i/o port pin characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 7.3.8 communication interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 7.3.9 embedded reference voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 7.3.10 temperature sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 7.3.11 comparator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 7.3.12 12-bit adc1 characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 7.3.13 emc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 contents stm8l151x2, stm8l151x3 4/115 docid018780 rev 6 7.4 thermal characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 8 option bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 9 unique id . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 10 package characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 10.1 ecopack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 10.2 package mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 10.2.1 48-pin low profile quad flat 7x7mm package (lqfp48) . . . . . . . . . . . . 104 10.2.2 32-lead ultra thin fine pitch quad flat no-lead 5x5 mm package (ufqfpn32) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 10.2.3 28-lead ultra thin fine pitch quad flat no-lead 4x4 mm package (ufqfpn28) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 10.2.4 20-lead ultra thin fine pitch quad flat no-lead package (ufqfpn20) . 109 10.2.5 20-pin thin shrink small outline package . . . . . . . . . . . . . . . . . . . . . . . 111 11 device ordering information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 12 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 docid018780 rev 6 5/115 stm8l151x2, stm8l151x3 list of tables 6 list of tables table 1. low-density stm8l151x2/3 low power device features and peripheral counts . . . . . . . . . 12 table 2. timer feature comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 table 3. legend/abbreviation for table 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 table 4. low-density stm8l151x2/3 pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 table 5. flash and ram boundary addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 table 6. factory conversion registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 table 7. i/o port hardware register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 table 8. general hardware register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 table 9. cpu/swim/debug module/interrupt controller registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 table 10. interrupt mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 table 11. voltage characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 table 12. current characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 table 13. thermal characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 table 14. general operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 table 15. embedded reset and power control block characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . 54 table 16. total current consumption in run mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 table 17. total current consumption in wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 table 18. total current consumption and timing in low power run mode at vdd = 1.65 v to 3.6 v . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 table 19. total current consumption in low power wait mode at vdd = 1.65 v to 3.6 v . . . . . . . . . 63 table 20. total current consumption and timing in active-halt mode at vdd = 1.65 v to 3.6 v. . . . . 64 table 21. typical current consumption in active-halt mode, rtc clocked by lse external crystal . . 64 table 22. total current consumption and timing in halt mode at vdd = 1.65 to 3.6 v . . . . . . . . . . . 65 table 23. peripheral current consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .66 table 24. current consumption under external reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 table 25. hse external clock characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67 table 26. lse external clock characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67 table 27. hse oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 table 28. lse oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 table 29. hsi oscillator characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 table 30. lsi oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 table 31. ram and hardware registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .73 table 32. flash program and data eeprom memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 table 33. i/o current injection susceptibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 table 34. i/o static characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 table 35. output driving current (high sink ports). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .78 table 36. output driving current (true open drain ports). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 table 37. output driving current (pa0 with high sink led driver capability). . . . . . . . . . . . . . . . . . . . 78 table 38. nrst pin characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 table 39. spi1 characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 table 40. i2c characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 table 41. reference voltage characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .87 table 42. ts characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 table 43. comparator 1 characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 table 44. comparator 2 characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 table 45. adc1 characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 table 46. adc1 accuracy with vdda = 3.3 v to 2.5 v. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 table 47. adc1 accuracy with vdda = 2.4 v to 3.6 v. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 list of tables stm8l151x2, stm8l151x3 6/115 docid018780 rev 6 table 48. adc1 accuracy with vdda = vref+ = 1.8 v to 2.4 v. . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 table 49. r ain max for f adc = 16 mhz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 table 50. ems data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 table 51. emi data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 table 52. esd absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 table 53. electrical sensitivities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 table 54. thermal characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 table 55. option byte addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 table 56. option byte description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 table 57. unique id registers (96 bits) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 table 58. lqfp48 package mechanical data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 table 59. ufqfpn32 package mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 table 60. ufqfpn28 package mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 table 61. ufqfpn20 - 20-lead ultra thin fine pitch quad flat package (3x3) package mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 table 62. tssop20 - 20-pin thin shrink small outline package mechanical data . . . . . . . . . . . . . . 111 docid018780 rev 6 7/115 stm8l151x2, stm8l151x3 list of figures 8 list of figures figure 1. low-density stm8l151x2/3 device block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 figure 2. low-density stm8l151x2/3 clock tree diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 figure 3. stm8l151cx lqfp48 package pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 figure 4. stm8l151kx ufqfpn32 package pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 figure 5. stm8l151gx ufqfpn28 package pinout. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 figure 6. stm8l151fx ufqfpn20 package pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 figure 7. stm8l151fx tssop20 package pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 figure 8. memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 figure 9. pin loading conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 figure 10. pin input voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 figure 11. por/bor thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 figure 12. typ. idd(run) vs. vdd, fcpu = 16 mhz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 figure 13. typ. idd(wait) vs. vdd, fcpu = 16 mhz 1). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 figure 14. typ. idd(lpr) vs. vdd (lsi clock source) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 figure 15. typ. idd(lpw) vs. vdd (lsi clock source) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 figure 16. hse oscillator circuit diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 figure 17. lse oscillator circuit diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 figure 18. typical hsi frequency vs v dd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 figure 19. typical lsi frequency vs. vdd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 figure 20. typical vil and vih vs vdd (high sink i/os) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 figure 21. typical vil and vih vs vdd (true open drain i/os) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 figure 22. typical pull-up resistance r pu vs v dd with vin=vss . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 figure 23. typical pull-up current i pu vs v dd with vin=vss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 figure 24. typ. vol @ vdd = 3.0 v (high sink ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 figure 25. typ. vol @ vdd = 1.8 v (high sink ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 figure 26. typ. vol @ vdd = 3.0 v (true open drain ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 figure 27. typ. vol @ vdd = 1.8 v (true open drain ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 figure 28. typ. vdd - voh @ vdd = 3.0 v (high sink ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 figure 29. typ. vdd - voh @ vdd = 1.8 v (high sink ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 figure 30. typical nrst pull-up resistance r pu vs v dd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 figure 31. typical nrst pull-up current i pu vs v dd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 figure 32. recommended nrst pin configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 figure 33. spi1 timing diagram - slave mode and cpha=0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 figure 34. spi1 timing diagram - slave mode and cpha=1 (1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 figure 35. spi1 timing diagram - master mode (1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 figure 36. typical application with i2c bus and timing diagram 1) . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 figure 37. adc1 accuracy characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 figure 38. typical connection diagram using the adc1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 figure 39. power supply and reference decoupling (v ref+ not connected to v dda ). . . . . . . . . . . . . . 94 figure 40. power supply and reference decoupling (vref+ connected to vdda) . . . . . . . . . . . . . . . 94 figure 41. max. dynamic current consumption on v ref+ supply pin during adc conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 figure 42. lqfp48 package outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 figure 43. ufqfpn32 package outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 figure 44. recommended ufqfpn32 footprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 figure 45. ufqfpn28 package outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 figure 46. recommended ufqfpn28 footprint (dimensions in mm) . . . . . . . . . . . . . . . . . . . . . . . . 108 figure 47. ufqfpn20 - 20-lead ultra thin fine pitch quad flat package outline (3x3) . . . . . . . . . . . . 109 list of figures stm8l151x2, stm8l151x3 8/115 docid018780 rev 6 figure 48. ufqfpn20 recommended footprint (dimensions in mm). . . . . . . . . . . . . . . . . . . . . . . . . 110 figure 49. tssop20 - 20-pin thin shrink small outline package . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 figure 50. tssop20 recommended footprint (dimensions in mm) . . . . . . . . . . . . . . . . . . . . . . . . . . 112 figure 51. low-density stm8l151x2/3 ordering information scheme. . . . . . . . . . . . . . . . . . . . . . . . 113 docid018780 rev 6 9/115 stm8l151x2, stm8l151x3 introduction 49 1 introduction this document describes the features, pinout, mechanical data and ordering information for the low-density stm8l151x2/3 devices: stm8l151x2 and stm8l151x3 microcontrollers with a flash memory density of up to 8 kbytes. for further details on the stmicroelectronics ultra low-power family please refer to section 2.2: ultra-low-power continuum on page 13 . for detailed information on device operation and registers, refer to the reference manual (rm0031). for information on to the flash program memory and data eeprom, refer to the programming manual (pm0054). for information on the debug module and swim (single wire interface module), refer to the stm8 swim communication protocol and debug module user manual (um0470). for information on the stm8 core, refer to the stm8 cpu programming manual (pm0044). low-density devices provide the following benefits: ? integrated system ? up to 8 kbytes of low-density embedded flash program memory ? 256 bytes of data eeprom ?1 kbyte of ram ? internal high-speed and low-power low speed rc. ? embedded reset ? ultra low-power consumption ?1 a in active-halt mode ? clock gated system and optimized power management ? capability to execute from ram for low power wait mode and low power run mode ? advanced features ? up to 16 mips at 16 mhz cpu clock frequency ? direct memory access (dma) for memory-to-memory or peripheral-to-memory access. ? short development cycles ? application scalability across a common family product architecture with compatible pinout, memory map and modular peripherals. ? wide choice of development tools introduction stm8l151x2, stm8l151x3 10/115 docid018780 rev 6 stm8l ultra low-power microcontrollers can operate either from 1.8 to 3.6 v (down to 1.65 v at power-down) or from 1.65 to 3.6 v. they are available in the -40 to +85 c and -40 to +125 c temperature ranges. these features make the stm8l ultra low-power microcontroller families suitable for a wide range of applications: ? medical and handheld equipment ? application control and user interface ? pc peripherals, gaming, gps and sport equipment ? alarm systems, wired and wireless sensors ? metering the devices are offered in five different packages from 20 to 48 pins. different sets of peripherals are included depending on the device. refer to section 3 for an overview of the complete range of peripherals proposed in this family. all stm8l ultra low-power products are based on the same architecture with the same memory mapping and a coherent pinout. figure 1 shows the block diagram of the stm8l low-density family. docid018780 rev 6 11/115 stm8l151x2, stm8l151x3 description 49 2 description the low-density stm8l151x2/3 ultra low-power devices feature an enhanced stm8 cpu core providing increased processing power (up to 16 mips at 16 mhz) while maintaining the advantages of a cisc architecture with improved code density, a 24-bit linear addressing space and an optimized architecture for low power operations. the family includes an integrated debug module with a hardware interface (swim) which allows non-intrusive in-application debugging and ultrafast flash programming. all low-density stm8l151x2/3 microcontrollers feature embedded data eeprom and low- power low-voltage single-supply program flash memory. the devices incorporate an extensive range of enhanced i/os and peripherals, a 12-bit adc, two comparators, a real-time clock, two 16-bit timers, one 8-bit timer, as well as standard communication interfaces such as an spi, an i 2 c interface, and one usart. the modular design of the peripheral set allows the same peripherals to be found in different st microcontroller families including 32-bit families. this makes any transition to a different family very easy, and simplified even more by the use of a common set of development tools. description stm8l151x2, stm8l151x3 12/115 docid018780 rev 6 2.1 device overview table 1. low-density stm8l151x2/3 low power device features and peripheral counts features stm8l151f3 stm8l151g3 stm8l151k3/ stm8l151c3 stm8l151f2 stm8l151g2 stm8l151k2/ stm8l151c2 flash (kbytes) 8 4 data eeprom (bytes) 256 ram (kbytes) 1 timers basic 1 (8-bit) general purpose 2 (16-bit) commun -ication interfaces spi 1 i2c 1 usart 1 gpios 18 (1) 26 (1) 30 (2) /41 (1)(2) 18 (1) 26 (1) 30 (2) /41 (1)(2) 12-bit synchronized adc (number of channels) 1 (10) 1 (18) 1 (23/28) (3) 1 (10) 1 (18) 1 (23/28) (3) comparators (comp1/comp2) 2 others rtc, window watchdog, independent watchdog, 16-mhz and 38-khz internal rc, 1- to 16-mhz and 32-khz external oscillator cpu frequency 16 mhz operating voltage 1.8 to 3.6 v (down to 1.65 v at power-down) with bor 1.65 to 3.6 v without bor operating temperature ? 40 to +85 c / ? 40 to +125 c packages tssop20 ufqfpn20 ufqfpn28 ufqfpn32 lqfp48 tssop20 ufqfpn20 ufqfpn28 ufqfpn32 lqfp48 1. the number of gpios given in this table includes the nrst/pa1 pin but the application can use the nrst/pa1 pin as general purpose output only (pa1). 2. 26 gpios in the stm8l151k3 and 40 gpios in the stm8l151c3. 3. 22 channels in the stm8l151k3 and 28 channels in the stm8l151c3. docid018780 rev 6 13/115 stm8l151x2, stm8l151x3 description 49 2.2 ultra-low-power continuum the ultra-low-power low-density stm8l15xxx devices are fully pin-to-pin, software and feature compatible. besides the full compatibility within the family, the devices are part of stmicroelectronics microcontrollers ultra-low-power strategy which also includes stm8l101xx and stm8l15xxx. the stm8l and stm32l families allow a continuum of performance, peripherals, system architecture, and features. they are all based on stmicroelectronics 0.13 m ultra-low leakage process. note: 1 the stm8l151xx and stm8l152xx are pin-to-pin compatible with stm8l101xx devices. performance all families incorporate highly energy-efficient cores with both harvard architecture and pipelined execution: advanced stm8 core for stm8l families and arm ? cortex ? -m3 core for stm32l family. in addition specific care for the design architecture has been taken to optimize the ma/dmips and ma/mhz ratios. this allows the ultra-low-power performance to range from 5 up to 33.3 dmips. shared peripherals stm8l151xx/152xx and stm8l15xxx share identical peripherals which ensure a very easy migration from one family to another: ? analog peripherals: adc1 and comparators comp1/comp2 ? digital peripherals: rtc and some communication interfaces common system strategy to offer flexibility and optimize performance, the stm8l151xx/152xx and stm8l15xxx devices use a common architecture: ? same power supply range from 1.8 to 3.6 v, down to 1.65 v at power down ? architecture optimized to reach ultra-low consumption both in low power modes and run mode ? fast startup strategy from low power modes ? flexible system clock ? ultra-safe reset: same reset strategy for both stm8l15x and stm32l15xxx including power-on reset, power-down reset, brownout reset and programmable voltage detector. features st ultra-low-power continuum also lies in feature compatibility: ? more than 10 packages with pin count from 20 to 100 pins and size down to 3 x 3 mm ? memory density ranging from 4 to 128 kbytes functional overview stm8l151x2, stm8l151x3 14/115 docid018780 rev 6 3 functional overview figure 1. low-density stm8l151x2/3 device block diagram 1. legend : adc: analog-to-digital converter bor: brownout reset dma: direct memory access i2c: inter-integrated circuit multimaster interface iwdg: independent watchdog por/pdr: power on reset / power down reset rtc: real-time clock spi: serial peripheral interface swim: single wire interface module usart: universal synchronous asynchronous receiver transmitter wwdg: window watchdog 2. there is no tim1 on stm8l151x2, stm8l151x3 devices. - 3 6 # l o c k c o n t r o l l e r a n d # 3 3 # l o c k s ! d d r e s s c o n t r o l a n d d a t a b u s e s + b y t e + b y t e 2 ! - t o c o r e a n d p e r i p h e r a l s ) 7 $ ' k ( z c l o c k 0 o r t ! 0 o r t " 0 o r t # 0 o w e r 6 / , 4 2 % ' 7 7 $ ' b y t e 0 o r t $ 0 o r t % " e e p e r 2 4 # m e m o r y 0 r o g r a m $ a t a % % 0 2 / - 6 $ $ 6 $ $ 6 $ $ 6 6 3 3 3 7 ) - 3 # , 3 $ ! 3 0 ) ? - / 3 ) 3 0 ) ? - ) 3 / 3 0 ) ? 3 # + 3 0 ) ? . 3 3 5 3 ! 2 4 ? 2 8 5 3 ! 2 4 ? 4 8 5 3 ! 2 4 ? # + ! $ # ? ) . x # / - 0 ? ) . 0 # / - 0 # / - 0 # / - 0 ? ) . 0 6 $ $ ! 6 3 3 ! 3 - " 6 $ $ ! 6 3 3 ! 4 e m p s e n s o r b i t ! $ # 6 $ $ 2 % & 6 . 2 3 4 0 ! ; = 0 " ; = 0 # ; = 0 $ ; = 0 % ; = 0 & |