![]() |
|
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. june 2015 docid025118 rev 5 1/106 STM8AF6213 stm8af6223 stm8af6223a stm8af6226 automotive 8-bit mcu, with up to 8 kbyte flash, data eeprom, 10-bit adc, timers, lin, spi, i2c, 3 to 5.5 v datasheet - production data features ? core ?max f cpu : 16 mhz ? advanced stm8a core with harvard architecture and 3-stage pipeline ? extended instruction set ? memories ? program memory: 4 to 8 kbyte flash program; data retention 20 years at 55 c after 1 kcycle ? data memory: 640 byte true data eeprom; endurance 300 kcycle ? ram: 1 kbyte ? clock management ? low-power crystal re sonator oscillator with external clock input ? internal, user-trimmable 16 mhz rc and low-power 128 khz rc oscillators ? clock security system with clock monitor ? reset and supply management ? wait/auto-wakeup/halt low-power modes with user definable clock gating ? low-consumption power-on and power- down reset ? interrupt management ? nested interrupt controller with 32 interrupts ? up to 28 external interrupts on 7 vectors ? timers ? advanced control timer: 16-bit, 4 capcom channels, 3 complementary outputs, dead- time insertion and flex ible synchronization ? 16-bit general purpose timer with 3 capcom channels each (ic, oc, pwm) ? 8-bit ar basic timer with 8-bit prescaler ? auto-wakeup timer ? window and independent watchdog timers ? i/os ? up to 28 i/os on a 32-pin package including 21 high sink outputs ? highly robust i/o design, immune against current injection ? communication interfaces ? linuart lin 2.2 compliant, master/slave modes with automatic resynchronization ? spi interface up to 8 mbit/s or f master /2 ?i 2 c interface up to 400 kbit/s ? analog to digital converter (adc) ? 10-bit, 1 lsb adc with up to 7 muxed channels + 1 internal channel, scan mode and analog watchdog ? internal reference voltage measurement ? operating temperature up to 150 c ? qualification conforms to aec-q100 rev g lqfp32 7x7 mm tssop20 (6.4x4.4 mm) www.st.com
contents STM8AF6213/23/23a/26 2/106 docid025118 rev 5 contents 1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4 product overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.1 central processing unit (cpu) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.1.1 architecture and registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.1.2 addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.1.3 instruction set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.2 single wire interface module (swim) and debug module (dm) . . . . . . . . 14 4.2.1 swim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4.2.2 debug module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4.3 interrupt controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4.4 flash program and data eeprom memory . . . . . . . . . . . . . . . . . . . . . . . 14 4.4.1 write protection (wp) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4.4.2 read-out protection (rop) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.5 clock controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.5.1 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.6 power management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.7 watchdog timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.8 auto wakeup counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4.9 beeper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4.10 tim1 - 16-bit advanced control timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4.11 tim5 - 16-bit general purpose timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4.12 tim6 - 8-bit basic timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4.13 analog-to-digital converter (adc1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.14 communication interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.14.1 linuart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.14.2 serial peripheral interface (spi) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 4.14.3 inter integr ated circuit (i 2 c) interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 docid025118 rev 5 3/106 STM8AF6213/23/23a/26 contents 4 5 pinout and pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.1 tssop20 pinouts and pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.2 lqfp32 pinout and pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 5.3 alternate function remapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 6 memory and register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 6.1 memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 6.2 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 6.2.1 i/o port hardware register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 6.2.2 cpu/swim/debug module/interrupt contro ller registers . . . . . . . . . . . . 43 7 interrupt vector mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 8 option bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 8.1 option byte description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 8.2 STM8AF6213/23/23a/26 alternate function remapping bits . . . . . . . . . . . 49 9 electrical characteristi cs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 9.1 parameter conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 9.1.1 minimum and maximum values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 9.1.2 typical values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 9.1.3 typical curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 9.1.4 loading capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 9.1.5 pin input voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 9.2 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 9.3 operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 9.3.1 vcap external capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 9.3.2 supply current characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 9.3.3 external clock sources and timing characteristics . . . . . . . . . . . . . . . . . 67 9.3.4 internal clock sources and timing characte ristics . . . . . . . . . . . . . . . . . 69 9.3.5 memory characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 9.3.6 i/o port pin characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 9.3.7 reset pin characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 9.3.8 spi serial peripheral interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 9.3.9 i 2 c interface characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 9.3.10 10-bit adc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 contents STM8AF6213/23/23a/26 4/106 docid025118 rev 5 9.3.11 emc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 10 package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 10.1 lqfp32 package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 10.2 tssop20 package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 10.3 thermal characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 10.3.1 reference document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 10.3.2 selecting the product temperature range . . . . . . . . . . . . . . . . . . . . . . . 98 11 ordering information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 12 stm8 development tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 12.1 emulation and in-circuit debugging tools . . . . . . . . . . . . . . . . . . . . . . . . 101 12.1.1 stice key features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 12.2 software tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 12.2.1 stm8 toolset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 12.2.2 c and assembly toolchains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 12.3 programming tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 13 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 docid025118 rev 5 5/106 STM8AF6213/23/23a/26 list of tables 6 list of tables table 1. STM8AF6213/23/23a/26 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 table 2. peripheral clock gating bit assignments in clk_pckenr1/2 registers . . . . . . . . . . . . . . . 16 table 3. tim timer features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 table 4. communication peripheral naming correspondence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 table 5. legend/abbreviations for pinout tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 3 table 6. STM8AF6213/stm8af6223 tssop20 pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 table 7. stm8af6223a tssop20 pin descripti on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 table 8. stm8af6226 lqfp32 pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 table 9. memory model for the devices covered in this datas heet. . . . . . . . . . . . . . . . . . . . . . . . . . 35 table 10. i/o port hardware register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 table 11. general hardware register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 table 12. cpu/swim/debug module/interrupt controller registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 table 13. interrupt mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 table 14. option bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 table 15. option byte description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 table 16. stm8af6226 alternate functi on remapping bits [7:2] for 32-pin packages . . . . . . . . . . . . 49 table 17. STM8AF6213 and stm8af6223 alte rnate function remapping bits [7:2] ? for 20-pin packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 table 18. stm8af6223a alternate function remapping bits [7:2] for 20-pin packages . . . . . . . . . . . 50 table 19. stm8af6226 alternate functi on remapping bits [1:0] for 32-pin packages . . . . . . . . . . . . 51 table 20. STM8AF6213/stm8af6223 alte rnate function remapping bits [1:0] ? for 20-pin packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 table 21. stm8af6223a alternate function remapping bits [1:0] for 20-pin packages . . . . . . . . . . . 52 table 22. voltage characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 table 23. current characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 table 24. thermal characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 table 25. operating lifetime (olf) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 table 26. general operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 table 27. operating conditions at power-up/power-down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 table 28. total current consumption wit h code execution in run mode at v dd = 5 v. . . . . . . . . . . . . 58 table 29. total current consumption wit h code execution in run mode at v dd = 3.3 v . . . . . . . . . . . 59 table 30. total current consumption in wait mode at v dd = 5 v . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 table 31. total current consumption in wait mode at v dd = 3.3 v . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 table 32. total current consumption in active halt mode at v dd = 5 v . . . . . . . . . . . . . . . . . . . . . . . 61 table 33. total current consumption in active halt mode at v dd = 3.3 v . . . . . . . . . . . . . . . . . . . . . . 61 table 34. total current consum ption in halt mode at v dd = 5 v. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 table 35. total current consum ption in halt mode at v dd = 3.3 v . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 table 36. wakeup times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 table 37. total current consumption and ti ming in forced reset state . . . . . . . . . . . . . . . . . . . . . . . . 63 table 38. peripheral current consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 table 39. hse user external clock characteri stics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 7 table 40. hse oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 table 41. hsi oscillator characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 table 42. lsi oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 table 43. ram and hardware registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 table 44. flash program memory/data eeprom memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 table 45. flash program memory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 table 46. data memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 list of tables STM8AF6213/23/23a/26 6/106 docid025118 rev 5 table 47. i/o static characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 table 48. output driving current (standard ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 table 49. output driving current (true open drain ports). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 table 50. output driving current (high sink ports). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 table 51. nrst pin characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 table 52. spi characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 table 53. i 2 c characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 table 54. adc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 table 55. adc accuracy with rain < 10 k ? , v dd = 5 v . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 table 56. adc accuracy with rain < 10 k ? , v dd = 3.3 v . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 table 57. ems data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 table 58. emi data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 table 59. esd absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 table 60. electrical sensitivities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 table 61. lqfp32 - 32-pin, 7 x 7 mm low-profile quad flat package ? mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 table 62. tssop20 ? 20-lead thin shrink sm all outline, 6.5 x 4.4 mm, 0.65 mm pitch, ? package mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 table 63. thermal characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 table 64. document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 docid025118 rev 5 7/106 STM8AF6213/23/23a/26 list of figures 8 list of figures figure 1. STM8AF6213/23/23a/26 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 figure 2. flash memory organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 figure 3. STM8AF6213/stm8af6223 tssop20 pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 figure 4. stm8af6223a tssop20 pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 figure 5. stm8af6226 lqfp32 pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 9 figure 6. memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 figure 7. pin loading conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 figure 8. pin input voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 figure 9. f cpumax versus v dd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 figure 10. external capacitor c ext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 figure 11. typ i dd(run) vs. v dd hse user external clock, f cpu = 16 mhz . . . . . . . . . . . . . . . . . . . . . 64 figure 12. typ i dd(run) vs. f cpu hse user external clock, v dd = 5 v . . . . . . . . . . . . . . . . . . . . . . . . 64 figure 13. typ i dd(run) vs. v dd hsei rc osc., f cpu = 16 mhz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 figure 14. typ i dd(wfi) vs. v dd hse user external clock, f cpu = 16 mhz . . . . . . . . . . . . . . . . . . . . . 65 figure 15. typ i dd(wfi) vs. f cpu hse user external clock, v dd = 5 v . . . . . . . . . . . . . . . . . . . . . . . . . 66 figure 16. typ i dd(wfi) vs. v dd hsi rc osc., f cpu = 16 mhz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 figure 17. hse external clock source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 figure 18. hse oscillator circuit diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 figure 19. typical v il and v ih vs v dd @ 4 temperatures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 figure 20. typical pull-up resistance r pu vs v dd @ 4 temperatures . . . . . . . . . . . . . . . . . . . . . . . . . 73 figure 21. typical pull-up current i pu vs v dd @ 4 temperatures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 figure 22. typ. v ol @ v dd = 5 v (standard ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 figure 23. typ. v ol @ v dd = 3.3 v (standard ports). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 figure 24. typ. v ol @ v dd = 5 v (true open drain ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 figure 25. typ. v ol @ v dd = 3.3 v (true open drain ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 figure 26. typ. v ol @ v dd = 5 v (high sink ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 figure 27. typ. v ol @ v dd = 3.3 v (high sink ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 figure 28. typ. v dd - v oh @ v dd = 5 v (standard ports). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 figure 29. typ. v dd - v oh @ v dd = 3.3 v (standard ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 figure 30. typ. v dd - v oh @ v dd = 5 v (high sink ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 figure 31. typ. v dd - v oh @ v dd = 3.3 v (high sink ports) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 figure 32. typical nrst v il and v ih vs v dd @ 4 temperatures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 figure 33. typical nrst pull-up resistance vs v dd @ 4 temperatures. . . . . . . . . . . . . . . . . . . . . . . . 80 figure 34. typical nrst pull-up current vs v dd @ 4 temperatures . . . . . . . . . . . . . . . . . . . . . . . . . . 80 figure 35. recommended reset pin protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 figure 36. spi timing diagram - slave mode and cpha = 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 figure 37. spi timing diagram - slave mode and cpha = 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 figure 38. spi timing diagram - master mode (1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 figure 39. typical application with i2c bus and timing diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 figure 40. adc accuracy characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 figure 41. typical application with adc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 figure 42. lqfp32 - 32-pin, 7 x 7 mm low-profile quad flat package outline . . . . . . . . . . . . . . . . . . . 92 figure 43. lqfp32 - 32-pin, 7 x 7 mm low-profile quad flat package ? recommended footprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 figure 44. lqfp32 marking example (package top view) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 figure 45. tssop20 ? 20-lead thin shrink sm all outline, 6.5 x 4.4 mm, 0.65 mm pitch, ? package outline. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 figure 46. tssop20 ? 20-lead thin shrink sm all outline, 6.5 x 4.4 mm, 0.65 mm pitch, ? list of figures STM8AF6213/23/23a/26 8/106 docid025118 rev 5 package footprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 figure 47. tssop20 marking example (package top view) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 figure 48. STM8AF6213/23/23a/26 ordering information scheme (1) (2) . . . . . . . . . . . . . . . . . . . . . . 100 docid025118 rev 5 9/106 STM8AF6213/23/23a/26 introduction 103 1 introduction the datasheet contains the description of STM8AF6213, stm8af6223, stm8af6223a and stm8af6226 features, pinout, electrical characteristics, mechanical data and ordering information. ? for complete information on the stm8a microcontroller memory, registers and peripherals, please refer to stm8s series and stm8af series 8-bit microcontrollers reference manual (rm0016). ? for information on programming, erasing and protection of the internal flash memory please refer to the stm8 flash programming manual (pm0051). ? for information on the debug and swim (s ingle 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). description STM8AF6213/23/23a/26 10/106 docid025118 rev 5 2 description the STM8AF6213, stm8af6223, stm8af6223a and stm8af6226 automotive 8-bit microcontrollers offer 4 to 8 kbyte of flash program memory, plus integrated true data eeprom. the stm8s series and stm8af series 8-bit microcontrollers reference manual (rm0016) refers to devices in this family as low-density. they provid e the following benefits: performance, robustness and reduced system cost. device performance and robustness are ensured by advanced core and peripherals made in a state-of-the-art technology, a 16 mhz clock frequency, robust i/os, independent watchdogs with separate clock source, and a cl ock security system. the system cost is reduced thanks to an integrated true data eeprom for up to ? 300 kwrite/erase cycles and a high system integratio n level with internal clock oscillators, watchdog, and brown-out reset. full documentation is offered as well as a wide choice of development tools. 2 table 1. STM8AF6213/23/23a/26 features device stm8af6226 stm8af6223 stm8af6223a STM8AF6213 pin count 32 20 max. number of gpios 28 including 21 high-sink i/os 16 including 12 high-sink i/os ext. interrupt pins 28 16 timer capcom channels 6 7 6 7 timer complementary outputs 3121 a/d converter channels 7 5 7 5 low-density flash program memory (byte) 8 k 4 k data eeprom (byte) 640 (1) 1. no read-while-write (rww) capability ram (byte) 1 k peripheral set multipurpose timer (tim1), spi, i2c, linuart, window wdg, independent wdg, adc, pwm time r (tim5), 8-bit timer (tim6) docid025118 rev 5 11/106 STM8AF6213/23/23a/26 block diagram 103 3 block diagram figure 1. STM8AF6213/23/23a/26 block diagram ; 7 $ / 0 + ] 5 & |