![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
preliminary data this is preliminary information on a new product now in deve lopment or undergoing evaluation. details are subject to change without notice. september 2010 doc id 17959 rev 1 1/110 1 stm8l162r8 stm8l162m8 8-bit ultralow power mcu, 64 kb flash, 2 kb data eeprom rtc, aes, lcd, timers, usarts, i2c, spis, adc, dac, comps 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 ? ultralow 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, ultrasafe bor reset with 5 selectable thresholds ? ultralow 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.5ppm accuracy ? lse security system ? auto-wakeup from halt w/ periodic interrupt ? advanced anti-tamper detection lcd: 8x40 or 4x44 w/ step-up converter memories ? 64 kb of flash program memory plus 2 kb of data eeprom with ecc and rww ? flexible write/read protection modes ? 4 kb of ram dma ? 4 channels supporting adc, aes, dacs, spis, i 2 c, usarts, timers ? 1 channel for memory-to-memory aes encryption hardware accelerator 2x12-bit dac (dual mo de) with output buffer 12-bit adc up to 1 msps/28 channels ? temp. sensor and internal ref. voltage 2 ultralow power comparators (comp) ? 1 with fixed threshold and 1 rail to rail ? wakeup capability timers ? three 16-bit timers with 2 channels (ic, oc, pwm), quadrature encoder ? one 16-bit advanced control timer with 3 channels, supporting motor control ? one 8-bit timer with 7-bit prescaler ? 1 window and 1 independent watchdog ? beeper timer with 1, 2 or 4 khz frequencies communication interfaces ? two synchronous serial interface (spi) ?fast i 2 c 400 khz smbus and pmbus ? three usarts (iso 7816 interface + irda) up to 67 i/os, all mappab le on interrupt vectors up to 16 capacitive sensing channels with free firmware development support ? fast on-chip programming and non- intrusive debugging with swim ? bootloader using usart 96-bit unique id lqfp80 lqfp64 www.st.com
contents stm8l162r8, stm8l162m8 2/110 doc id 17959 rev 1 contents 1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2.1 stm8l ultralow power 8-bit family benefits . . . . . . . . . . . . . . . . . . . . . . . . 3 2.2 device overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.3 ultralow power continuum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3 functional overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3.1 low power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.2 central processing unit stm8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.2.1 advanced stm8 core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.2.2 interrupt controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.3 reset and supply management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.3.1 power supply scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.3.2 power supply supervisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.3.3 voltage regulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.4 clock management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.5 low power real-time clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.6 lcd (liquid crystal display) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.7 memories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.8 dma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.9 analog-to-digital converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.10 digital-to-analog converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.11 ultralow power comparators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.12 system configuration controller and routi ng interface . . . . . . . . . . . . . . . 13 3.13 aes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.14 timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.14.1 16-bit advanced control timer (tim1) . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.14.2 16-bit general purpose timers (tim2, tim3, tim5) . . . . . . . . . . . . . . . . 14 3.14.3 8-bit basic timer (tim4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.15 watchdog timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.15.1 window watchdog timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 stm8l162r8, stm8l162m8 contents doc id 17959 rev 1 3/110 3.15.2 independent watchdog timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.16 beeper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.17 communication interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.17.1 spi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.17.2 i 2 c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.17.3 usart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.18 infrared (ir) interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.19 development support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4 pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5 memory and register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 5.1 memory mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 5.2 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 6 interrupt vector mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 7 option bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 8 unique id . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 9 electrical parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 9.1 parameter conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 9.1.1 minimum and maximum values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 9.1.2 typical values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 9.1.3 typical curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 9.1.4 loading capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 9.1.5 pin input voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 9.2 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 9.3 operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 9.3.1 general operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 9.3.2 power-up / power-down operating conditions . . . . . . . . . . . . . . . . . . . . 61 9.3.3 supply current characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 9.3.4 clock and timing characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 9.3.5 memory characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 9.3.6 i/o port pin characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 9.3.7 communication interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 contents stm8l162r8, stm8l162m8 4/110 doc id 17959 rev 1 9.3.8 lcd controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 9.3.9 embedded reference voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 9.3.10 temperature sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 9.3.11 comparator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 9.3.12 12-bit dac characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 9.3.13 emc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 9.4 thermal characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 10 package characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 10.1 package mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 11 ordering information scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 12 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 stm8l162r8, stm8l162m8 list of tables doc id 17959 rev 1 1/110 list of tables table 1. high density stm8l162x low power device features and peripheral counts . . . . . . . . . . . . 4 table 2. timer feature comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 table 3. legend/abbreviation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 table 4. stm8l162x pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 table 5. flash and ram boundary addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 table 6. factory conversion regiserst. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 table 7. i/o port hardware register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 table 8. general hardware register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 table 9. cpu/swim/debug module/interrupt controller registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 table 10. interrupt mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 table 11. option byte addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 table 12. option byte description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 table 13. unique id registers (96 bits) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 table 14. voltage characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 table 15. current characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 table 16. thermal characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 table 17. general operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 table 18. operating conditions at power-up / power-down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 table 19. total current consumption in run mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 table 20. total current consumption in wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 table 21. total current consumption and timing in low power run mode at vdd = 1.65 v to 3.6 v . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 table 22. total current consumption in low power wait mode at vdd = 1.65 v to 3.6 v . . . . . . . . . 68 table 23. total current consumption and timing in active-halt mode at vdd = 1.65 v to 3.6 v . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 table 24. typical current consumption in active-halt mode, rtc clocked by lse external crystal . . 71 table 25. total current consumption and timing in halt mode at vdd = 2 v . . . . . . . . . . . . . . . . . . . 71 table 26. peripheral current consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 table 27. current consumption under external reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 table 28. hse external clock characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 table 29. lse external clock characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 table 30. hse oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 table 31. lse oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 table 32. hsi oscillator characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 table 33. lsi oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 table 34. ram and hardware registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 table 35. flash program and da ta eeprom memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 table 36. i/o static characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 table 37. output driving current (standard ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 table 38. output driving current (true open drain ports). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 table 39. output driving current (pa0 wi th high sink led driver capability). . . . . . . . . . . . . . . . . . . . 83 table 40. nrst pin characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 table 41. spi1 characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 table 42. i2c characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 table 43. lcd characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 table 44. reference voltage characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 table 45. ts characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 table 46. comparator 1 characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 list of tables stm8l162r8, stm8l162m8 2/110 doc id 17959 rev 1 table 47. comparator 2 characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 table 48. dac characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 table 49. dac accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 table 50. dac output on pb4-pb5-pb6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 table 51. adc1 characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 table 52. adc1 accuracy with vdda = 3.3 v to 2.5 v. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 table 53. adc1 accuracy with vdda = 2.4 v to 3.6 v. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 table 54. adc1 accuracy with vdda = vref+ = 1.8 v to 2.4 v. . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 table 55. ems data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 table 56. emi data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 table 57. esd absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3 table 58. electrical sensitivities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 table 59. thermal characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 table 60. 80-pin low profile quad flat package mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 table 61. lqfp64 ? 10 x 10 mm, 64-pin low-profile quad flat package mechanical data . . . . . . . . 107 table 62. ordering information scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 stm8l162r8, stm8l162m8 list of figures doc id 17959 rev 1 1/110 list of figures figure 1. high density stm8l162xx device block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 figure 2. clock tree diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 figure 3. stm8l162m8 80-pin package pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 figure 4. stm8l162r8 64-pin pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 figure 5. memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 figure 6. pin loading conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 figure 7. pin input voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 figure 8. power supply thresholds. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 figure 9. hse oscillator circuit diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 figure 10. lse oscillator circuit diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 figure 11. typical hsi frequency vs v dd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 figure 12. typical lsi frequency vs. vdd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 figure 13. typical vil and vih vs vdd (standard i/os) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 figure 14. typical vil and vih vs vdd (true open drain i/os) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 figure 15. typical pull-up resistance r pu vs v dd with vin=vss . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 figure 16. typical pull-up current i pu vs v dd with vin=vss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 figure 17. typ. vol @ vdd = 3.0 v (standard ports). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 figure 18. typ. vol @ vdd = 1.8 v (standard ports). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 figure 19. typ. vol @ vdd = 3.0 v (true open drain ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 figure 20. typ. vol @ vdd = 1.8 v (true open drain ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 figure 21. typ. vdd - voh @ vdd = 3.0 v (standard ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 figure 22. typ. vdd - voh @ vdd = 1.8 v (standard ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 figure 23. typical nrst pull-up resistance r pu vs v dd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 figure 24. typical nrst pull-up current i pu vs v dd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 figure 25. recommended nrst pin configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 figure 26. spi1 timing diagram - slave mode and cpha=0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 figure 27. spi1 timing diagram - slave mode and cpha=1 (1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 figure 28. spi1 timing diagram - master mode (1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 figure 29. typical application with i2c bus and timing diagram 1) . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 figure 30. adc1 accuracy characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 figure 31. typical connection diagram using the adc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 figure 32. power supply and reference decoupling (v ref+ not connected to v dda ). . . . . . . . . . . . . 101 figure 33. power supply and reference decoupling (vref+ connected to vdda) . . . . . . . . . . . . . . 101 figure 34. 80-pin low profile quad flat package (14 x 14 mm) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 figure 35. lqfp64 ? 10 x 10 mm, 64 pin low-profile quad flat package outline . . . . . . . . . . . . . . . . 107 figure 36. recommended footprint (1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 introduction stm8l162r8, stm8l162m8 2/110 doc id 17959 rev 1 1 introduction this document describes the features, pinout, mechanical data and ordering information for the high density stm8l162r8 and stm8l162m8 devices. for further details on the stmicroelectroni cs ultralow power family please refer to section 2.3: ultralow power continuum on page 5 . 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). 2 description the high density stm8l162xx ultralow 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 high density stm8l162xx 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 dacs, two comparators, a real-time clock, aes, 8x40 or 4x44-segment lcd, four 16-bit timers, one 8-bit timer, as well as standard communication interfaces such as two spis, an i 2 c interface, and three usarts. 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 differ ent family very easy, and simplified even more by the use of a common set of development tools. stm8l162r8, stm8l162m8 description doc id 17959 rev 1 3/110 2.1 stm8l ultralow power 8-bit family benefits high density stm8l162xx devices are part of the stm8l ultralow power family providing the following benefits: integrated system ? 64 kbytes of high-density embedded flash program memory ? 2 kbytes of data eeprom ? 4 kbytes of ram ? internal high-speed and low-power low speed rc. ? embedded reset ultralow power consumption ? 1 a in active-halt mode ? clock gated system and optimized power management ? capability to execute from ram for lo w 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 acro ss a common family prod uct architecture with compatible pinout, memory map and modular peripherals. ? wide choice of development tools stm8l ultralow 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 ultralow powe r 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 four different packages from 48 to 80 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 ultralow 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 high density stm8l162xx families. description stm8l162r8, stm8l162m8 4/110 doc id 17959 rev 1 2.2 device overview table 1. high density stm8l162x low power device features and peripheral counts features stm8l162r8 stm8l162m8 flash (kbytes) 64 64 data eeprom (kbytes) 2 2 ram (kbytes) 4 4 aes 1 1 lcd 8x36 or 4x40 8x40 or 4x44 timers basic 1 (8-bit) 1 (8-bit) general purpose 3 (16-bit) 3 (16-bit) advanced control 1 (16-bit) 1 (16-bit) communicatio n interfaces spi 2 2 i2c 1 1 usart 3 3 gpios 54 (1) 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). 68 (1) 12-bit synchronized adc (number of channels) 1 (28) 1 (28) 12-bit dac number of channels 2 2 2 2 comparators (comp1/comp2) 2 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 lqfp64 lqfp80 stm8l162r8, stm8l162m8 description doc id 17959 rev 1 5/110 2.3 ultralow power continuum the ultralow power stm8l151xx, stm8l152xx and stm8l162xx are fully pin-to-pin, software and feature compatible . besides the full compatibility within the family, the devices are part of stmicroelectronics microcontrollers ultralow power strategy which also includes stm8l101xx and stm32 l15xxx. the stm8l and stm32l families allow a continuum of performance, peripherals, system architecture, and features. they are all based on stmicroelectronics 0.13 m ultralow leakage process. note: 1 the stm8l151xx and stm8l152xx are pin-to-pin compatible with stm8l101xx devices. 2 the stm32l family is pin-to-pin compatible with the general purpose stm32f family. please refer to stm32l15xx documentation for more information on these devices. performance all families incorporate highly energy-efficien t cores with both harvar d architecture and pipelined execution: advanced stm8 core fo r 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 ultralow power performance to range from 5 up to 33.3 dmips. shared peripherals stm8l151xx/152xx/162xx and stm32l15xx share identical peripherals which ensure a very easy migration from one family to another: analog peripherals: adc1, dac1/dac2, and comparators comp1/comp2 digital peripherals: rtc and some communication interfaces common system strategy to offer flexibility and opti mize performance, the stm8 l15xx/162xx and stm32l15xx devices use a common architecture: same power supply range from 1.65 to 3.6 v. for stm8l101xx and medium density stm8l15xx, the power supply must be above 1.8 v at power-on, and go below 1.65 v at power-down. architecture optimized to reach ultralow consumption both in low power modes and run mode fast startup strategy from low power modes flexible system clock ultrasafe reset: same reset strategy for both stm8l15xx/162xx and stm32l15xx including power-on reset, power-down reset, brownout reset and programmable voltage detector. features st utralow 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 stm8l162r8, stm8l162m8 6/110 doc id 17959 rev 1 3 functional overview figure 1. high density stm8l162xx device block diagram 1. legend : af: alternate function adc: analog-to-digital converter aes: advanced encryption standard hardware accelerator bor: brownout reset dma: direct memory access dac: digital-to-analog converter i2c: inter-integrated circuit multimaster interface a i1 8 517 clock controller a nd c ss clock s addre ss , co n t rol a nd d a t a bus e s 64-k b yte 4-k b yte ram to core a nd peripher a l s iwdg ( 38 khz clock) port a port b port c power volt. reg. lcd driver wwdg 2-k b yte port d port e beeper rtc memory progr a m d a t a eeprom @v dd v dd1 8 v dd =1.65 v v ss s wim s cl, s da, s pi1_mo s i, s pi1_mi s o, s pi1_ s ck, s pi1_n ss u s art1_rx, u s art1_tx, u s art1_ck adc1_inx comp1_inp comp 1 comp 2 comp2_inp v dda, v ss a s mb @v dda /v ss a temp s en s or 12- b it adc1 v ddref 3 .6 v 12- b it dac 12- b it dac1 nr s t pa[7:0] pb[7:0] pc[7:0] pd[7:0] pe[7:0] pf[7:0] beep alarm, calib, tamp1/2/ 3 s egx, comx por/pdr o s c_in, o s c_out o s c 3 2_in, o s c 3 2_out to bor pvd pvd_in re s et dma1 (4 ch a nnel s ) 3 ch a nnel s 2 ch a nnel s 2 ch a nnel s comp2_inm v lcd = 2.5 to 3 .6 v lcd b oo s ter intern a l reference volt a ge vrefint o u t ir_tim 1-16 mhz o s cill a tor 16 mhz intern a l rc 3 2 khz o s cill a tor s tm 8 core 16- b it timer 1 16- b it timer 2 38 khz intern a l rc interr u pt controller 16- b it timer 3 de bu g mod u le ( s wim) 8 - b it timer 4 infr a red interf a ce s pi1 i2c1 u s art1 v ss ref port f 16- b it timer 5 2 ch a nnel s s pi2 s pi2_mo s i, s pi2_mi s o, s pi2_ s ck, s pi2_n ss u s art2_rx, u s art2_tx, u s art2_ck u s art2 u s art 3 _rx, u s art 3 _tx, u s art 3 _ck u s art 3 pg[7:0] port g ph[7:0] port h pi[ 3 :0] port i 8x40 or 4x44 dac1 (af) 12- b it dac 12- b it dac2 dac2 (af) if ae s stm8l162r8, stm8l162m8 functional overview doc id 17959 rev 1 7/110 iwdg: independent watchdog lcd: liquid crystal display por/pdr: power on reset / power-down reset rtc: real-time clock spi: serial peripheral interface swim: single wire interface module usart: universal synchronous asyn chronous receiver transmitter wwdg: window watchdog 3.1 low power modes the high density stm8l162xx devices support five low power modes to achieve the best compromise between low power consumption, short startup time and available wakeup sources: wait mode : cpu clock is stopped, but selected peripherals keep running. an internal or external interrupt or a reset can be used to exit the microcontroller from wait mode (wfe or wfi mode). low power run mode : the cpu and the selected peripherals are running. execution is done from ram with a lo w speed oscillator (l si or lse). flash memory and data eeprom are stopped and the voltage regulator is configured in ultralow power mode. the microcontroller enters low power run mode by software and can exit from this mode by software or by a reset. all interrupts must be masked. they cannot be used to exit the microcontroller from this mode. low power wait mode: this mode is entered when executing a wait for event in low power run mode. it is similar to low power run mode except that the cpu clock is stopped. the wakeup from this mode is triggered by a reset or by an internal or external event (peripheral event generated by the timers, serial interfaces, dma controller (dma1), comparators and i/o ports). when the wakeup is triggered by an event, the system goes back to low power run mode. all interrupts must be masked. they cannot be used to exit the microcontroller from this mode. active-halt mode : cpu and peripheral clocks are stopped, except rtc. the wakeup can be triggered by rtc interrupts, external interrupts or reset. halt mode : cpu and peripheral clocks are stopped, the device remains powered on. the wakeup is triggered by an external interrupt or reset. a few peripherals have also a wakeup from halt capability. switching off th e internal reference voltage reduces power consumption. through software configuration it is also possible to wake up the device without waiting for the internal reference voltage wakeup time to have a fast wakeup time of 5 s. 3.2 central processing unit stm8 3.2.1 advanced stm8 core the 8-bit stm8 core is designed for code efficiency and performance with an harvard architecture and a 3-stage pipeline. it contains 6 internal registers which are directly addressable in each execution context, 20 addressing modes including indexed indirect and relative addressing, and 80 instructions. functional overview stm8l162r8, stm8l162m8 8/110 doc id 17959 rev 1 architecture and registers harvard architecture 3-stage pipeline 32-bit wide program memory bus - si ngle cycle fetching most instructions x and y 16-bit index registers - enabling indexed addressing modes with or without offset and read-modify-write type data manipulations 8-bit accumulator 24-bit program counter - 16 mbyte linear memory space 16-bit stack pointer - access to a 64 kbyte level stack 8-bit condition code register - 7 condition flags for the result of the last instruction addressing 20 addressing modes indexed indirect addressing mode for lookup tables located anywhere in the address space stack pointer relative addressing mode for local variables and parameter passing instruction set 80 instructions with 2-byte average instruction size standard data movement and logic/arithmetic functions 8-bit by 8-bit multiplication 16-bit by 8-bit and 16-bit by 16-bit division bit manipulation data transfer between stack and accumulator (push/pop) with direct stack access data transfer using the x and y registers or direct memory-to-memory transfers 3.2.2 interrupt controller the high density stm8l162xx devices feature a nested vectored interrupt controller: nested interrupts with 3 software priority levels 32 interrupt vectors with hardware priority up to 40 external interrupt sources on 11 vectors trap and reset interrupts 3.3 reset and supply management 3.3.1 power supply scheme the device requires a 1.65 v to 3.6 v operating supply voltage (v dd ). the external power supply pins must be connected as follows: v ss1 , v dd1 , v ss2 , v dd2 , v ss3 , v dd3 , v ss4 , v dd4 = 1.65 to 3.6 v: external power supply for i/os and for the internal regulator. provided externally through v dd pins, the stm8l162r8, stm8l162m8 functional overview doc id 17959 rev 1 9/110 corresponding ground pin is v ss . v ss1 /v ss2 /v ss3 /v ss4 and v dd1 /v dd2 /v dd3 /v dd4 must not be left unconnected. v ssa , v dda = 1.65 to 3.6 v: external power supplies for analog peripherals (minimum voltage to be applied to v dda is 1.8 v when the adc1 is used). v dda and v ssa must be connected to v dd and v ss , respectively. v ref+ , v ref- (for adc1): external reference voltage for adc1. must be provided externally through v ref+ and v ref- pin. v ref+ (for dac1/2): external voltage reference for dac1 and dac2 must be provided externally through v ref+ . 3.3.2 power supply supervisor the device has an integrated zeropower power-on reset (por)/power-down reset (pdr), coupled with a brownout reset (bor) circuitry. when the microcontroller operates between 1.8 and 3.6 v, bor is always active and ensures proper operation starting from 1.8 v. after the 1.8 v bor threshold is reached, the option byte loading process starts, either to confirm or modify default threshol ds, or to disable bor permanently (in which case, the v dd min value at power-down is 1.65 v). five bor thresholds are available through option bytes, starting from 1.8 v to 3 v. to reduce the power consumption in halt mode, it is possible to automatically switch off the internal reference voltage (and consequently the bor) in halt mode. the device remains in reset state when v dd is below a specified threshold, v por/pdr or v bor , without the need for any external reset circuit. note: when the microcontroller operates between 1.65 and 3.6 v, bor is permanently disabled. 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. this pvd offers 7 different levels between 1.85 v and 3.05 v, chosen by software, with a step around 200 mv. 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 can then generate a warning message and/or put the mcu into a safe state. the pvd is enabled by software. 3.3.3 voltage regulator the high density stm8l162xx devices embed an internal voltage regulator for generating the 1.8 v power supply for the core and peripherals. this regulator has two different modes: main voltage regulator mode (mv r) for run, wait for interrupt (wfi) and wait for event (wfe) modes. low power voltage regulator mode (lpvr) for halt, active-halt, low power run and low power wait modes. when entering halt or active-halt modes, the system automatically switches from the mvr to the lpvr in order to reduce current consumption. 3.4 clock management the clock controller distributes the system clock (sysclk) coming from different oscillators to the core and the peripherals. it also manages clock gating for low power modes and ensures clock robustness. functional overview stm8l162r8, stm8l162m8 10/110 doc id 17959 rev 1 features clock prescaler: to get the best compromise between speed and current consumption the clock frequency to the cpu and peripherals can be adjusted by a programmable prescaler safe clock switching: clock sources can be changed safely on the fly in run mode through a configuration register. clock management: to reduce power consumption, the clock controller can stop the clock to the core, individual peripherals or memory. system clock sources: 4 different clock sources can be used to drive the system clock: ? 1-16 mhz high speed external crystal (hse) ? 16 mhz high speed internal rc oscillator (hsi) ? 32.768 low speed external crystal (lse) ? 38 khz low speed internal rc (lsi) rtc and lcd clock sources: the above four sources can be chosen to clock the rtc and the lcd, whatever the system clock. startup clock: after reset, the microcontroller restarts by default with an internal 2 mhz clock (hsi/8). the prescaler ratio and clock source can be changed by the application program as soon as the code execution starts. clock security system (css): this feature can be enabled by software. if a hse clock failure occurs, the system clock is automatically switched to hsi. configurable main clock output (cco): this outputs an external clock for use by the application. figure 2. clock tree diagram ( 3 % / 3 # - ( z ( 3 ) 2 # - ( z , 3 ) 2 # k ( z , 3 % / 3 # k ( z ( 3 ) , 3 ) 2 4 # p r e s c a l e r 0 # , + t o p e r i p h e r a l s 2 4 # # , + t o , # $ t o ) 7 $ ' 3 9 3 # , + ( 3 % , 3 ) , 3 % / 3 # ? / 5 4 / 3 # ? / 5 4 / 3 # ? ) . / 3 # ? ) . c l o c k o u t p u t # # / p r e s c a l e r ( 3 ) , 3 ) ( 3 % , 3 % # # / t o c o r e a n d m e m o r y 3 9 3 # , + 0 r e s c a l e r ) 7 $ ' # , + 2 4 # 3 % , ; = , 3 % # , + " % % 0 3 % , ; = t o " % % 0 " % % 0 # , + a i # 3 3 c o n f i g u r a b l e 0 e r i p h e r a l # l o c k e n a b l e b i t s t o 2 4 # 2 4 # # , + c l o c k e n a b l e b i t , # $ # , + t o , # $ 3 9 3 # , + ( a l t c l o c k e n a b l e b i t , # $ p e r i p h e r a l 2 4 # # , + , # $ p e r i p h e r a l stm8l162r8, stm8l162m8 functional overview doc id 17959 rev 1 11/110 3.5 low power real-time clock the real-time clock (rtc) is an independent binary coded decimal (bcd) timer/counter. six byte locations contain the second, minute, hour (12/24 hour), week day, date, month, year, in bcd (binary coded decimal) format. correction for 28, 29 (leap year), 30, and 31 day months are made automatically. the subsecond field can also be read in binary format. the calendar can be corrected from 1 to 32767 rtc clock pulses. this allows to make a synchronization to a master clock. the rtc offers a digital calibration which allows an accuracy of +/-0.5ppm. it provides a programmable alarm and programmable periodic interrupts with wakeup from halt capability. periodic wakeup time using the 32.768 khz lse with the lowest resolution (of 61 s) is from min. 122 s to max. 3.9 s. with a different resolution, the wakeup time can reach 36 hours periodic alarms based on the calendar can also be generated from lse period to every year a clock security system detects a failure on lse, and can provide an interrupt with wakeup capability. the rtc clock can automatically switch to lsi in case of lse failure. the rtc also provides 3 anti-tamper detection pins. this detection embeds a programmable filter and can wakeup the mcu. 3.6 lcd (liquid crystal display) the liquid crystal display drives up to 8 common terminals and up to 40 segment terminals to drive up to 320 pixels. it can also be configured to drive up to 4 common and 44 segments (up to 176 pixels). internal step-up converter to guarantee contrast control whatever v dd . static 1/2, 1/3, 1/4, 1/8 duty supported. static 1/2, 1/3, 1/4 bias supported. phase inversion to reduce power consumption and emi. up to 8 pixels which ca n programmed to blink. the lcd controller can operate in halt mode. note: unnecessary segments and common pins can be used as general i/o pins. 3.7 memories the high density stm8l162xx devices have the following main features: 4 kbytes of ram the non-volatile memory is divided into three arrays: ? 64 kbytes of medium-density embedded flash program memory ? 2 kbytes of data eeprom ?option bytes. functional overview stm8l162r8, stm8l162m8 12/110 doc id 17959 rev 1 the eeprom embeds the error correction code (e cc) feature. it supp orts the read-while- write (rww): it is possible to execute the code from the program matrix while programming/erasing the data matrix. the option byte protects part of the flash program memory from write and readout piracy. 3.8 dma a 4-channel direct memory access controlle r (dma1) offers a memory-to-memory and peripherals-from/to-memory tr ansfer capability. the 4 chann els are shared between the following ips with dma capability: adc1, dac1 ,dac2, aes, i2c1, spi1, spi2, usart1, usart2, usart3, and the 5 timers. 3.9 analog-to-digital converter 12-bit analog-to-digital converter (adc1) with 28 channels (including 4 fast channel), temperature sensor and internal reference voltage conversion time down to 1 s with f sysclk = 16 mhz programmable resolution programmable sampling time single and continuous mode of conversion scan capability: automatic conversion perfor med on a selected gr oup of anal og inputs analog watchdog: interrupt generation when the converted voltage is outside the programmed threshold triggered by timer note: adc1 can be served by dma1. 3.10 digital-to-analog converter 12-bit dac with 2 buffered outputs (two digital signals can be converted into two analog voltage signal outputs) synchronized update capability using timers dma capability for each channel external triggers for conversion noise-wave generation triangular-wave generation dual dac channels with independent or simultaneous conversions input reference voltage v ref+ for better resolution note: dac can be served by dma1. stm8l162r8, stm8l162m8 functional overview doc id 17959 rev 1 13/110 3.11 ultralow power comparators the high density stm8l162xx devices embed two comparators (comp1 and comp2) sharing the same current bias and voltage reference. the voltage reference can be internal or external (coming from an i/o). one comparator with fixed threshold (comp1). one comparator rail to rail with fast or slow mode (comp2). the threshold can be one of the following: ? dac output ? external i/o ? internal reference voltage or internal reference voltage submultiple (1/4, 1/2, 3/4) the two comparators can be used together to offer a window function. they can wake up from halt mode. 3.12 system configuration cont roller and routing interface the system configuration controller provides the capability to remap some alternate functions on different i/o ports. tim4 and adc1 dma channels can also be remapped. the highly flexible routing interface allows application software to control the routing of different i/os to the tim1 timer input captures. it also controls the routing of internal analog signals to adc1, comp1, comp2, dac1 and the internal reference voltage v refint . finally, it provides a set of registers for efficiently managing a set of dedicated i/os supporting up to 16 capacitive sensing channels using the proxsense tm technology. 3.13 aes the aes hardware accelerator can be used to encipher and deciphe r data using the aes algorithm (compatible with fips pub 197, 2001 nov 26). key scheduler key derivation for decryption 128-bit data block processed 128-bit key length 892 clock cycles to encrypt/decrypt one 128-bit block aes data flow can be served by the dma1 controller 3.14 timers the high density stm8l162xx devices contain one advanced control timer (tim1), three 16- bit general purpose timers (tim2,tim3 and tim5) and one 8-bit basic timer (tim4). all the timers can be served by dma1. ta bl e 2 compares the features of the advanced control, general-purpose and basic timers. functional overview stm8l162r8, stm8l162m8 14/110 doc id 17959 rev 1 3.14.1 16-bit advanced control timer (tim1) this is a high-end timer designed for a wide range of control applications. with its complementary outputs, dead-ti me control and center-aligned pwm capability, the field of applications is extended to motor control, lighting and half-bridge driver. 16-bit up, down and up/down autoreload counter with 16-bit prescaler 3 independent capture/compare channels (capcom) configurable as input capture, output compare, pwm generation (edge and center aligned mode) and single pulse mode output 1 additional capture/compare channel which is not connected to an external i/o synchronization module to control the timer with external signals break input to force timer outputs into a defined state 3 complementary outputs with adjustable dead time encoder mode interrupt capability on various events (cap ture, compare, overflow, break, trigger) 3.14.2 16-bit general purpose timers (tim2, tim3, tim5) 16-bit autoreload (ar) up/down-counter 7-bit prescaler adjustable to fixed power of 2 ratios (1?128) 2 individually configurable capture/compare channels pwm mode interrupt capability on various events (cap ture, compare, overflow, break, trigger) synchronization with other timers or external signals (external clock, reset, trigger and enable) 3.14.3 8-bit basi c timer (tim4) the 8-bit timer consists of an 8-bit up auto-reload counter driven by a programmable prescaler. it can be used for timebase generation with interrupt generation on timer overflow or for dac trigger generation. table 2. timer feature comparison timer counter resolution counter type prescaler factor dma1 request generation capture/compare channels complementary outputs tim1 16-bit up/down any integer from 1 to 65536 ye s 3 + 1 3 tim2 any power of 2 from 1 to 128 2 none tim3 tim5 tim4 8-bit up any power of 2 from 1 to 32768 0 stm8l162r8, stm8l162m8 functional overview doc id 17959 rev 1 15/110 3.15 watchdog timers the watchdog system is based on two independent timers providing maximum security to the applications. 3.15.1 window watchdog timer the window watchdog (wwdg) is used to detect the occurrence of a software fault, usually generated by external interferences or by unexpected logical conditions, which cause the application program to abandon its normal sequence. 3.15.2 independent watchdog timer the independent watchdog peripheral (iwdg) can be used to resolve processor malfunctions due to hardware or software failures. it is clocked by the internal lsi rc clock source, and thus stays active even in case of a cpu clock failure. 3.16 beeper the beeper functi on outputs a signal on the beep pin for sound gener ation. the signal is in the range of 1, 2 or 4 khz. 3.17 communication interfaces 3.17.1 spi the serial peripheral interfaces (spi1 and spi2) provide half/ full duplex synchronous serial communication with external devices. maximum speed: 8 mbit/s (f sysclk /2) both for master and slave full duplex synchronous transfers simplex synchronous transfers on 2 lines with a possible bidirectional data line master or slave operation - selectable by hardware or software hardware crc calculation slave/master selection input pin note: spi1 and spi2 can be served by the dma1 controller. 3.17.2 i 2 c the i 2 c bus interface (i2c1) provi des multi-master capability, and controls all i2c bus- specific sequencing, protocol, arbitration and timing. master, slave and multi-master capability standard mode up to 100 khz and fast speed modes up to 400 khz. 7-bit and 10-bit addressing modes. smbus 2.0 and pmbus support hardware crc calculation functional overview stm8l162r8, stm8l162m8 16/110 doc id 17959 rev 1 note: i 2 c1 can be served by the dma1 controller. 3.17.3 usart the usart interfaces (usart1, usart2 and usart3) allow full duplex, asynchronous communications with external devices requiring an industry standard nrz asynchronous serial data format. it offers a very wide range of baud rates. 1 mbit/s full duplex sci spi1 emulation high precision baud rate generator smartcard emulation irda sir encoder decoder single wire half duplex mode note: usart1, usart2 and usart3 can be served by the dma1 controller. 3.18 infrared (ir) interface the high density stm8l162xx devices contain an infrared interface which can be used with an ir led for remote control functions. two timer output compare channels are used to generate the infrared remote control signals. 3.19 development support development tools development tools for the stm8 microcontrollers include: the stice emulation system offe ring tracing and code profiling the stvd high-level language debugger including c compiler, assembler and integrated development environment the stvp flash programming software the stm8 also comes with starter kits, evaluation boards and low-cost in-circuit debugging/programming tools. single wire data interface (swim) and debug module the debug module with its single wire data interface (swim) permits non-intrusive real-time in-circuit debugging and fast memory programming. the single wire interface is used for direct access to the debugging module and memory programming. the interface can be activated in all device operation modes. the non-intrusive debugging module features a performance close to a full-featured emulator. beside memory and peripherals, cpu operation can also be monitored in real- time by means of shadow registers. bootloader a bootloader is available to reprogram the flash memory using the usart1, usart2, usart3 (usarts in asynchronous mode), spi1 or spi2 interfaces. stm8l162r8, stm8l162m8 pin description doc id 17959 rev 1 17/110 4 pin description figure 3. stm8l162m8 80-pin package pinout figure 4. stm8l162r8 64-pin pinout . 2 3 4 0 ! 0 ( 0 ( 0 ( 0 ! 0 ! 6 , # $ 0 % 0 % 0 $ 0 $ 0 $ 0 ( 0 % 0 $ 0 % 0 % 0 ! 6 $ $ 6 $ $ ! 6 2 % & |