![]() |
|
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. march 2014 docid18474 rev 5 1/110 stm8al31xx, stm8al3lxx automotive 8-bit ultra-low-power mcu, up to 32 kbytes flash, rtc, data eeprom, lcd, timers, usart, i2c, spi, adc, dac, comps datasheet - production data features ? operating conditions ? operating power supply range 1.8 v to 3.6 v (down to 1.65 v at power down) ? temperature range: - 40 c to 85 or 125 c ? low power features ? five low-power modes: wait, low-power run (5.1 a), low-power wait (3 a), active-halt with full rtc (1.3 a), halt with pdr (400 na) ? run from flash: 195 a/mhz + 440 a ? run from ram: 90 a/mhz + 400 a ? ultra-low leakage per i/0: 50 na ? fast wakeup from halt: 4.7 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 ? 1 to 16 mhz crystal oscillator ? 32 khz crystal oscillator ? internal 16 mhz factory-trimmed rc ? internal 38 khz low consumption rc ? clock security system ? low power rtc ? bcd calendar with alarm interrupt ? auto-wakeup from halt (0.95 ppm resolution) w/ periodic interrupt ? lcd: up to 4x28 segments w/ step-up converter ? memories ? program memory: up to 32 kbytes flash program; data retention 20 years at 55 c ? data memory: up to 1 kbytes true data eeprom; endurance 300 kcycles ? ram: up to 2 kbytes ? dma ? four channels; supported peripherals: adc, dac, spi, i2c, usart, timers ? one channel for memory-to-memory ? 12-bit dac with output buffer ? 12-bit adc up to 1 mbps/25 channels ? temp sensor and internal reference voltage ? two ultra-low-power comparators ? one with fixed threshold and one rail to rail ? wakeup capability ? timers ? two 16-bit timers with two channels (used as ic, oc, pwm), quadrature encoder ? one 16-bit advanced control timer with three channels, supporting motor control ? one 8-bit timer with 7-bit prescaler ? two watchdogs: one window, one independent ? beeper timer with 1-, 2- or 4 khz frequencies ? communication interfaces ? synchronous serial interface (spi) ? fast i2c 400 khz smbus and pmbus ? usart (iso 7816 interface, irda, lin 1.3, lin 2.0) ? up to 41 i/os, all mappable on interrupt vectors ? development support ? fast on-chip programming and non intrusive debugging with swim ? bootloader using usart ? 96-bit unique id ? qualification conforms to aec-q100 grade 1 table 1. device summary reference part number stm8al31xx (without lcd) stm8al3168, stm8al3166, stm8al3148, stm8al3146, stm8al3138, stm8al3136 stm8al3lxx (with lcd) stm8al3l68, stm8al3l66, stm8al3l48, stm8al3l46 lqfp32 lqfp48 www.st.com
contents stm8al31xx, stm8al3lxx 2/110 docid18474 rev 5 contents 1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.1 device overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3 functional overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.1 low power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.2 central processing unit stm8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.2.1 advanced stm8 core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.2.2 interrupt controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.3 reset and supply management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.3.1 power supply scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.3.2 power supply supervisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.3.3 voltage regulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.4 clock management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.5 low power real-time clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.6 lcd (liquid crystal display) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.7 memories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.8 dma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.9 analog-to-digital converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.10 digital-to-analog converter (dac) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.11 ultra-low-power comparators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.12 system configuration controller and routing interface . . . . . . . . . . . . . . . 18 3.13 timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.13.1 tim1 - 16-bit advanced control timer . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.13.2 16-bit general purpose timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.13.3 8-bit basic timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.14 watchdog timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.14.1 window watchdog timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.14.2 independent watchdog timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.15 beeper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.16 communication interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 docid18474 rev 5 3/110 stm8al31xx, stm8al3lxx contents 4 3.16.1 spi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.16.2 i2c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.16.3 usart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.17 infrared (ir) interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.18 development support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4 pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.1 system configuration options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5 memory and register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.1 memory mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.2 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 6 interrupt vector mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 7 option bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 8 unique id . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 9 electrical parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 9.1 parameter conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 9.1.1 minimum and maximum values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 9.1.2 typical values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 9.1.3 typical curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 9.1.4 loading capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 9.1.5 pin input voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 9.2 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 9.3 operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 9.3.1 general operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 9.3.2 embedded reset and power control block characteristics . . . . . . . . . . . 59 9.3.3 supply current characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 9.3.4 clock and timing characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 9.3.5 memory characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 9.3.6 i/o current injection characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 9.3.7 i/o port pin characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 9.3.8 communication interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 9.3.9 lcd controller (stm8al3lxx only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 contents stm8al31xx, stm8al3lxx 4/110 docid18474 rev 5 9.3.10 embedded reference voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 9.3.11 temperature sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 9.3.12 comparator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 9.3.13 12-bit dac characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 9.3.14 12-bit adc1 characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 9.3.15 emc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 9.4 thermal characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 10 package characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 10.1 ecopack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 10.2 package mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 10.2.1 lqfp48 package (7 x 7) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 10.2.2 lqfp32 package (7 x 7) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 11 device ordering information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 12 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 docid18474 rev 5 5/110 stm8al31xx, stm8al3lxx list of tables 6 list of tables table 1. device summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 table 2. medium density stm8al3xxx low power device features and peripheral counts . . . . . . . 10 table 3. timer feature comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 table 4. legend/abbreviation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 table 5. medium density stm8al3xxx pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 table 6. flash and ram boundary addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 table 7. factory conversion registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 table 8. i/o port hardware register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34 table 9. general hardware register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 table 10. cpu/swim/debug module/interrupt controller registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 table 11. interrupt mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 table 12. option byte addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 table 13. option byte description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 table 14. unique id registers (96 bits) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 table 15. voltage characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 table 16. current characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 table 17. thermal characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 table 18. operating lifetime (olf) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 table 19. general operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 table 20. embedded reset and power control block characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . 59 table 21. total current consumption in run mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 table 22. total current consumption in wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 table 23. total current consumption and timing in low power run mode at vdd =1.65 v to 3.6 v. . 64 table 24. total current consumption in low power wait mode at vdd = 1.65 v to 3.6 v . . . . . . . . . 64 table 25. total current consumption and timing in active-halt mode at vdd = 1.65 v to 3.6 v. . . . . 65 table 26. typical current consumption in active-halt mode, rtc clocked by lse external crystal . . 66 table 27. total current consumption and timing in halt mode at vdd = 1.65 to 3.6 v . . . . . . . . . . . 67 table 28. peripheral current consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .68 table 29. current consumption under external reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 table 30. hse external clock characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69 table 31. lse external clock characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69 table 32. hse oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 table 33. lse oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 table 34. hsi oscillator characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 table 35. lsi oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 table 36. ram and hardware registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .75 table 37. flash program memory/data eeprom memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 table 38. flash program memory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 table 39. data memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 table 40. i/o current injection susceptibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 table 41. i/o static characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 table 42. output driving current (high sink ports). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80 table 43. output driving current (true open drain ports). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 table 44. output driving current (pa0 with high sink led driver capability). . . . . . . . . . . . . . . . . . . . 80 table 45. nrst pin characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 table 46. spi1 characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 table 47. i2c characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 table 48. lcd characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 list of tables stm8al31xx, stm8al3lxx 6/110 docid18474 rev 5 table 49. reference voltage characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .90 table 50. ts characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 table 51. comparator 1 characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 table 52. comparator 2 characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 table 53. dac characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 table 54. dac accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 table 55. dac output on pb4-pb5-pb6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 table 56. adc1 characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 table 57. adc1 accuracy with vdda = 2.5 v to 3.3 v. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 table 58. adc1 accuracy with vdda = 2.4 v to 3.6 v. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 table 59. adc1 accuracy with vdda = vref+ = 1.8 v to 2.4 v. . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 table 60. r ain max for f adc = 16 mhz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 table 61. ems data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 table 62. emi data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 table 63. esd absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2 table 64. electrical sensitivities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 table 65. thermal characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 table 66. lqfp48 ? 48-pin low profile quad flat package (7x7), package mechanical data . . . . . . 105 table 67. lqfp32 ? 32-pin low profile quad flat package, package mechanical data . . . . . . . . . . . 106 table 68. document revision history. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 docid18474 rev 5 7/110 stm8al31xx, stm8al3lxx list of figures 7 list of figures figure 1. medium density stm8al3xxx device block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 figure 2. medium density stm8al3xxx clock tree diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 figure 3. stm8al31xx8t 48-pin pinout (without lcd) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 figure 4. stm8al3lxx8t 48-pin pinout (with lcd) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 figure 5. stm8al31xx6t 32-pin pinout (without lcd) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 figure 6. stm8al3lxx6t 32-pin pinout (with lcd) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 figure 7. memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 figure 8. pin loading conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 figure 9. pin input voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 figure 10. por/bor thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 figure 11. typ. idd(run) vs. vdd, fcpu = 16 mhz1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 figure 12. typ. idd(wait) vs. vdd, fcpu = 16 mhz 1). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 figure 13. hse oscillator circuit diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 figure 14. lse oscillator circuit diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 figure 15. typical hsi frequency vs v dd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 figure 16. typical lsi frequency vs. vdd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 figure 17. typical vil and vih vs vdd (high sink i/os) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 figure 18. typical vil and vih vs vdd (true open drain i/os) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 figure 19. typical pull-up resistance r pu vs v dd with vin=vss . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 figure 20. typical pull-up current i pu vs v dd with vin=vss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 figure 21. typ. vol @ vdd = 3.0 v (high sink ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 figure 22. typ. vol @ vdd = 1.8 v (high sink ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 figure 23. typ. vol @ vdd = 3.0 v (true open drain ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 figure 24. typ. vol @ vdd = 1.8 v (true open drain ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 figure 25. typ. vdd - voh @ vdd = 3.0 v (high sink ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 figure 26. typ. vdd - voh @ vdd = 1.8 v (high sink ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 figure 27. typical nrst pull-up resistance r pu vs v dd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 figure 28. typical nrst pull-up current i pu vs v dd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 figure 29. recommended nrst pin configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 figure 30. spi1 timing diagram - slave mode and cpha=0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 figure 31. spi1 timing diagram - slave mode and cpha=1 (1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 figure 32. spi1 timing diagram - master mode (1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 figure 33. typical application with i2c bus and timing diagram 1) . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 figure 34. adc1 accuracy characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 figure 35. typical connection diagram using the adc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 figure 36. maximum dynamic current consumption on v ref+ supply pin during adc conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 figure 37. power supply and reference decoupling (v ref+ not connected to v dda ). . . . . . . . . . . . . 100 figure 38. power supply and reference decoupling (vref+ connected to vdda) . . . . . . . . . . . . . . 100 figure 39. lqfp48 ? 48-pin low profile quad flat package outline (7x7) . . . . . . . . . . . . . . . . . . . . . . 105 figure 40. lqfp32 ? 32-pin low profile quad flat package outline . . . . . . . . . . . . . . . . . . . . . . . . . . 106 figure 41. medium density stm8al3xxx ordering information scheme . . . . . . . . . . . . . . . . . . . . . . 107 introduction stm8al31xx, stm8al3lxx 8/110 docid18474 rev 5 1 introduction this document describes the features, pinout, mechanical data and ordering information of the medium density stm8al31xx and stm8al3lxx devices (microcontrollers with up to 32-kbyte flash memory density). these devices are referred to as medium density devices in the stm8l15x and stm8l16x reference manual (rm0031) and in the stm8l flash programming manual (pm0054). for more details on the whole stmicroelectronics ultra-low-power family please refer to section 3: functional overview on page 11 . 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, please refer to the stm8 cpu programming manual (pm0044). note: the medium density devices provide the following benefits: ? integrated system ? up to 32 kbytes of medium-density embedded flash program memory ? 1 kbyte of data eeprom ? internal high speed and low-power low speed rc. ? embedded reset ? ultra-low power consumption ? 195 a/mhz + 440 a (consumption) ? 0.9 a with lsi 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 all devices offer 12-bit adc, dac, two comparators, real-time clock three 16-bit timers, one 8-bit timer as well as standard communication interface such as spi, i2c and usart. a 4x28-segment lcd is available on the medium-density stm8al3lxx line. table 2: medium density stm8al3xxx low power device features and peripheral counts and section 3 on page 11 give an overview of the complete range of peripherals proposed in this family. figure 1 on page 11 shows the general block diagram of the device family. docid18474 rev 5 9/110 stm8al31xx, stm8al3lxx description 50 2 description the medium density stm8al3xxx devices are members of the stm8al automotive ultra- low-power 8-bit family. the medium density stm8al3xxx family operates from 1.8 v to 3.6 v (down to 1.65 v at power down) and is available in the - 40 to +85 c and - 40 to +125c temperature ranges. the medium density stm8al3xxx ultra-low-power family features the 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 medium density stm8al3xxx microcontrollers feature embedded data eeprom and low power low-voltage single-supply program flash memory. they incorporate an extensive range of enhanced i/os and peripherals. 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. two different packages are proposed which include 32 and 48 pins. depending on the device chosen, different sets of peripherals are included. all stm8al ultra-low-power products are based on the same architecture with the same memory mapping and a coherent pinout. description stm8al31xx, stm8al3lxx 10/110 docid18474 rev 5 2.1 device overview table 2. medium density stm8al3xxx low power device features and peripheral counts features stm8al3xx6 stm8al3xx8 flash (kbytes) 8 16 32 8 16 32 data eeprom (kbytes) 1 ram-kbytes 2 2 lcd 4x17 (1) 4x28 (1) timers basic 1 (8-bit) 1 (8-bit) general purpose 2 (16-bit) 2 (16-bit) advanced control 1 (16-bit) 1 (16-bit) communication interfaces spi 1 1 i2c 1 1 usart 1 1 gpios 30 (2)(3) or 29 (1)(3) 41 (3) 12-bit synchronized adc (number of channels) 1 (22 (2) or 21 (1) ) 1 (25) 12-bit dac (number of channels) 1 (1) 1 (1) 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 v to 3.6 v (down to 1.65 v at power down) operating temperature -40 to +85 c/-40 to +125 c packages lqfp32 (7x7) lqfp48 (7x7) 1. stm8al3lxx versions only 2. stm8al31xx versions only 3. 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). docid18474 rev 5 11/110 stm8al31xx, stm8al3lxx functional overview 50 3 functional overview figure 1. medium density stm8al3xxx device block diagram 1. legend : adc: analog-to-digital converter bor: brownout reset dma: direct memory access dac: digital-to-analog converter i2c: inter-integrated circuit multimaster interface 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 asynchronous receiver transmitter wwdg: window watchdog 16 mhz internal rc clock clocks address, control and data buses debug module spi1 32 kbytes interrupt controller 2 kbytes ram to core and peripherals iwdg (38 khz clock) (swim) port a port b port c i2c1 usart1 power volt. reg. port f 1-16 mhz oscillator 32 khz oscillator 38 khz internal rc lcd driver 4x28 wwdg stm8 core controller and css 1 kbyte port d port e beeper rtc memory program data eeprom @v dd v dd18 v dd1 =1.65 v v ss1 swim scl, sda, mosi, miso, sck, nss rx, tx, ck adc1_inx dac_out comp1_inp comp 1 comp 2 comp2_inp v dda v ssa smb @v dda /v ssa temp sensor 12-bit adc1 v ref+ v ref- 3.6 v 12-bit dac 12-bit dac nrst pa[7:0] pb[7:0] pc[7:0] pd[7:0] pe[7:0] pf0 beep alarm, calib segx, comx por/pdr osc_in, osc_out osc32_in, osc32_out to bor pvd pvd_in reset dma1 8-bit timer 4 16-bit timer 3 16-bit timer 2 16-bit timer 1 (4 channels) 2 channels 2 channels 3 channels comp2_inm v lcd = 2.5 v 3.6 v to lcd booster internal reference voltage vrefint out v ref+ infrared interface ir_tim functional overview stm8al31xx, stm8al3lxx 12/110 docid18474 rev 5 3.1 low power modes the medium density stm8al3xxx device supports 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, event or a reset can be used to exit the microcontroller from wait mode (wfe or wfi mode). wait consumption: refer to table 22 . ? low power run mode : the cpu and the selected peripherals are running. execution is done from ram with a low speed oscillator (lsi or lse). flash and data eeprom are stopped and the voltage regulator is configured in ultra-low-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 run mode consumption: refer to table 23 . ? 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. low power wait mode consumption: refer to table 24 . ? active-halt mode : cpu and peripheral clocks are stopped, except rtc. the wakeup can be triggered by rtc interrupts, external interrupts or reset. active-halt consumption: refer to table 25 and table 26 . ? halt mode : cpu and peripheral clocks are stopped, the device remains powered on. the ram content is preserved. the wakeup is triggered by an external interrupt or reset. a few peripherals have also a wakeup from halt capability. switching off the 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. halt consumption: refer to table 27 . docid18474 rev 5 13/110 stm8al31xx, stm8al3lxx functional overview 50 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. architecture and registers ? harvard architecture ? 3-stage pipeline ? 32-bit wide program memory bus - single 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 medium density stm8al3xxx features 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 functional overview stm8al31xx, stm8al3lxx 14/110 docid18474 rev 5 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 = 1.8 to 3.6 v, down to 1.65 v at power down: external power supply for i/os and for the internal regulator. provided externally through v dd1 pins, the corresponding ground pin is v ss1 . ? v ssa ; v dda = 1.8 to 3.6 v, down to 1.65 v at power down: 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 dd1 and v ss1 , respectively. ? v ss2 ; v dd2 = 1.8 to 3.6 v, down to 1.65 v at power down: external power supplies for i/os. v dd2 and v ss2 must be connected to v dd1 and v ss1 , 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 dac): external voltage reference for dac 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. at power-on, 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 thresholds, 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 under reset when v dd is below a specified threshold, v por/pdr or v bor , without the need for any external reset circuit. 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. docid18474 rev 5 15/110 stm8al31xx, stm8al3lxx functional overview 50 3.3.3 voltage regulator the medium density stm8al3xxx embeds 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 (mvr) 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. 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 khz 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. functional overview stm8al31xx, stm8al3lxx 16/110 docid18474 rev 5 figure 2. medium density stm8al3xxx clock tree diagram 1. the hse clock source can be either an external crystal/ceramic resonator or an external source (hse bypass). refer to section hse clock in the stm8l15x and stm8l16x reference manual (rm0031). 2. the lse clock source can be either an external crystal/ceramic resonator or a external source (lse bypass). refer to section lse clock in the stm8l15x and stm8l16x reference manual (rm0031). 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. 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 every second to every year. ( 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 g # 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 docid18474 rev 5 17/110 stm8al31xx, stm8al3lxx functional overview 50 3.6 lcd (liquid crystal display) the liquid crystal display drives up to 4 common terminals and up to 28 segment terminals to drive up to 112 pixels. ? internal step-up converter to guarantee contrast control whatever v dd . ? static 1/2, 1/3, 1/4 duty supported. ? static 1/2, 1/3 bias supported. ? phase inversion to reduce power consumption and emi. ? up to 4 pixels which can 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 medium density stm8al3xxx devices have the following main features: ? up to 2 kbytes of ram ? the non-volatile memory is divided into three arrays: ? up to 32 kbytes of medium-density embedded flash program memory ? 1 kbyte of data eeprom ? option bytes. it supports 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 controller (dma1) offers a memory-to-memory and peripherals-from/to-memory transfer capability. the 4 channels are shared between the following ips with dma capability: adc1, dac, i2c1, spi1, usart1, the 4 timers. 3.9 analog-to-digital converter ? 12-bit analog-to-digital converter (adc1) with 25 channels (including 1 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 performed on a selected group of analog inputs ? analog watchdog ? triggered by timer note: adc1 can be served by dma1. functional overview stm8al31xx, stm8al3lxx 18/110 docid18474 rev 5 3.10 digital-to-analog converter (dac) ? 12-bit dac with output buffer ? synchronized update capability using tim4 ? dma capability ? external triggers for conversion ? input reference voltage v ref+ for better resolution note: dac can be served by dma1. 3.11 ultra-low-power comparators the medium density stm8al3xxx embeds 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 controller 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, dac and the internal reference voltage v refint . it also provides a set of registers for efficiently managing the charge transfer acquisition sequence (see section 3.13: timers ). docid18474 rev 5 19/110 stm8al31xx, stm8al3lxx functional overview 50 3.13 timers medium density stm8al3xxx devices contain one advanced control timer (tim1), two 16- bit general purpose timers (tim2 and tim3) and one 8-bit basic timer (tim4). all the timers can be served by dma1. table 3 compares the features of the advanced control, general-purpose and basic timers. 3.13.1 tim1 - 16-bit advanced control timer this is a high-end timer designed for a wide range of control applications. with its complementary outputs, dead-time 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 (capture, compare, overflow, break, trigger) 3.13.2 16-bit general purpose timers ? 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 (capture, compare, overflow, break, trigger) ? synchronization with other timers or external signals (external clock, reset, trigger and enable) table 3. 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 yes 3 + 1 3 tim2 any power of 2 from 1 to 128 2 none tim3 tim4 8-bit up any power of 2 from 1 to 32768 0 functional overview stm8al31xx, stm8al3lxx 20/110 docid18474 rev 5 3.13.3 8-bit basic timer 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. 3.14 watchdog timers the watchdog system is based on two independent timers providing maximum security to the applications. 3.14.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.14.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.15 beeper the beeper function outputs a signal on the beep pin for sound generation. the signal is in the range of 1, 2 or 4 khz. 3.16 communication interfaces 3.16.1 spi the serial peripheral interface (spi1) provides 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 can be served by the dma1 controller. docid18474 rev 5 21/110 stm8al31xx, stm8al3lxx functional overview 50 3.16.2 i2c the i 2 c bus interface ( i 2 c1 ) provides 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 note: i 2 c1 can be served by the dma1 controller. 3.16.3 usart the usart interface (usart1) allows 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 can be served by the dma1 controller. usart1 can be used to implement lin slave communication, with lin break detection on the framing error flag (fe in usart_sr register) with a value of 0 in the usart data register (usart_dr). 3.17 infrared (ir) interface the medium density stm8al3xxx 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.18 development support development tools development tools for the stm8 microcontrollers include: ? the stice emulation system offering 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. functional overview stm8al31xx, stm8al3lxx 22/110 docid18474 rev 5 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 interface. the reference document for the bootloader is um0560: stm8 bootloader user manual . docid18474 rev 5 23/110 stm8al31xx, stm8al3lxx pin description 50 4 pin description figure 3. stm8al31xx8t 48-pin pinout (without lcd) 1. reserved. must be tied to v dd . figure 4. stm8al3lxx8t 48-pin pinout (with lcd) 0 6 9 0 ! 6 3 3 6 3 3 ! 6 2 % & |