STM8S903K3 STM8S903F3
16 MHz STM8S 8-bit MCU, up to 8 Kbytes Flash, 1 Kbyte RAM, 640
bytes EEPROM,10-bit ADC, 2 timers, UART, SPI, I²C
-
Switch-off peripheral clocks individually
•
Permanently active, low consumption power-on
and power-down reset
Interrupt management
Nested interrupt controller with 32 interrupts
LQFP32 7x7 UFQFPN32 5x5
SDIP32 400 mils
•
•
Up to 28 external interrupts on 7 vectors
•
Timers
Advanced control timer: 16-bit, 4 CAPCOM
channels, 3 complementary outputs, dead-time
insertion and flexible synchronization
TSSOP20
UFQFPN20 3x3 SO20W 300 mils
Features
Core
16 MHz advanced STM8 core with Harvard
architecture and 3-stage pipeline
purpose timer,
•
16-bit generalOC or PWM) with 3 CAPCOM
channels (IC,
•
8-bit basic timer with 8-bit prescaler
•
Auto wakeup timer
•
Window and independent watchdog timers
Communications interfaces
UART with clock output for synchronous
operation, Smartcard, IrDA, LIN master mode
•
•
Extended instruction set
Memories
Program memory: 8 Kbytes Flash; data retention
20 years at 55 °C after 10 kcycles
•
•
SPI interface up to 8 Mbit/s
•
I C interface up to 400 Kbit/s
2
•
•
Data memory: 640 bytes true data EEPROM;
endurance 300 kcycles
•
RAM: 1 Kbytes
Clock, reset and supply management
2.95 to 5.5 V operating voltage
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
I/Os
Up to 28 I/Os on a 32-pin package including 21
high sink outputs
•
clock
4 master
•
Flexible powercontrol, resonator clock sources:
oscillator
-
Low crystal
-
External clock input
-
Internal, user-trimmable 16 MHz RC
-
Internal low power 128 kHz RC
•
Clock security system with clock monitor
•
Power management: (wait, active-halt, halt)
-
Low power modes
July 2011
•
•
Highly robust I/O design, immune against current
injection
Development support
Embedded single wire interface module (SWIM)
for fast on-chip programming and non intrusive
debugging
•
Unique ID:
96-bit key including lot number
DocID15590 Rev 6
1/115
www.st.com
Contents
STM8S903K3 STM8S903F3
Contents
1
2
3
4
Introduction ..............................................................................................................8
Description ...............................................................................................................9
Block diagram ........................................................................................................10
Product overview ...................................................................................................11
4.1 Central processing unit STM8 .....................................................................................11
4.2 Single wire interface module (SWIM) and debug module (DM) ..................................11
4.3 Interrupt controller .......................................................................................................12
4.4 Flash program and data EEPROM memory ................................................................12
4.5 Clock controller ............................................................................................................13
4.6 Power management ....................................................................................................14
4.7 Watchdog timers ..........................................................................................................15
4.8 Auto wakeup counter ...................................................................................................15
4.9 Beeper ........................................................................................................................15
4.10 TIM1 - 16-bit advanced control timer .........................................................................16
4.11 TIM5 - 16-bit general purpose timer ..........................................................................16
4.12 TIM6 - 8-bit basic timer ..............................................................................................16
4.13 Analog-to-digital converter (ADC1) ............................................................................17
4.14 Communication interfaces .........................................................................................17
4.14.1 UART1 ...............................................................................................17
4.14.2 SPI .....................................................................................................18
4.14.3 I²C ......................................................................................................18
5 Pinout and pin description ...................................................................................20
5.1 STM8S903F3 TSSOP20/SO20 pinout ........................................................................21
5.2 STM8S903F3 UFQFPN20 pinout ................................................................................22
5.3 TSSOP/SO/UFQFPN20 pin description ......................................................................23
5.4 STM8S903K3 UFQFPN32/LQFP32/SDIP32 pinout ....................................................24
5.5 UFQFPN/LQFP/SDIP32 pin description ......................................................................25
5.6 Alternate function remapping .......................................................................................27
6 Memory and register map .....................................................................................28
6.1 Memory map
6.2 Register map
6.2.1
6.2.2
6.2.3
................................................................................................................28
...............................................................................................................29
I/O port hardware register map ............................................................29
General hardware register map ...........................................................30
CPU/SWIM/debug module/interrupt controller registers .....................39
7 Interrupt vector mapping ......................................................................................42
8 Option bytes ...........................................................................................................44
8.1 STM8S903K3/F3 alternate function remapping bits ....................................................46
2/115
DocID15590 Rev 6
STM8S903K3 STM8S903F3
Contents
9 Unique ID ................................................................................................................50
10 Electrical characteristics ....................................................................................51
10.1 Parameter conditions .................................................................................................51
10.1.1 Minimum and maximum values .........................................................51
10.1.2 Typical values .....................................................................................51
10.1.3 Typical curves ....................................................................................51
10.1.4 Loading capacitor ...............................................................................51
10.1.5 Pin input voltage .................................................................................51
10.2 Absolute maximum ratings ........................................................................................52
10.3 Operating conditions ..................................................................................................54
10.3.1 VCAP external capacitor ....................................................................55
10.3.2 Supply current characteristics ............................................................56
10.3.3 External clock sources and timing characteristics .............................66
10.3.4 Internal clock sources and timing characteristics ...............................68
10.3.5 Memory characteristics ......................................................................70
10.3.6
10.3.7
10.3.8
10.3.9
I/O port pin characteristics .................................................................71
Reset pin characteristics ....................................................................79
SPI serial peripheral interface ............................................................81
2
I C interface characteristics ...............................................................84
10.3.10 10-bit ADC characteristics ................................................................85
10.3.11 EMC characteristics .........................................................................88
11 Package information ............................................................................................92
11.1 32-pin LQFP package mechanical data .....................................................................92
11.2 32-lead UFQFPN package mechanical data .............................................................94
11.3 20-lead UFQFPN package mechanical data .............................................................95
11.4 UFQFPN recommended footprint ..............................................................................97
11.5 SDIP32 package mechanical data .............................................................................98
11.6 20-pin TSSOP package mechanical data ................................................................100
11.7 20-pin SO package mechanical data .......................................................................101
11.8 Thermal characteristics ............................................................................................102
11.8.1 Reference document ........................................................................103
11.8.2 Selecting the product temperature range .........................................103
12 Ordering information .........................................................................................104
12.1 STM8S903K3/F3 FASTROM microcontroller option list ..........................................104
13 STM8 development tools ..................................................................................110
13.1 Emulation and in-circuit debugging tools .................................................................110
13.2 Software tools ..........................................................................................................110
13.2.1 STM8 toolset ....................................................................................111
13.2.2 C and assembly toolchains ..............................................................111
13.3 Programming tools ..................................................................................................111
14 Revision history .................................................................................................112
DocID15590 Rev 6
3/115
List of tables
STM8S903K3 STM8S903F3
List of tables
Table 1. STM8S903K3/F3 access line features .......................................................................................9
Table 2. Peripheral clock gating bit assignments in CLK_PCKENR1/2 registers ..................................14
Table 3. TIM timer features ....................................................................................................................16
Table 4. Legend/abbreviations for pinout tables ...................................................................................20
Table 5. TSSOP20/SO20/UFQFPN20 pin description ...........................................................................25
Table 6. UFQFPN32/LQFP32/SDIP32 pin description ...........................................................................25
Table 7. I/O port hardware register map ................................................................................................29
Table 8. General hardware register map ................................................................................................44
Table 9. CPU/SWIM/debug module/interrupt controller registers .........................................................55
Table 10. Interrupt mapping ...................................................................................................................42
Table 11. Option bytes .........................................................................................................................112
Table 12. Option byte description ...........................................................................................................44
Table 13. STM8S903K3 alternate function remapping bits [7:2] for 32-pin packages ...........................46
Table 14. STM8S903F3 alternate function remapping bits [7:2] for 20-pin packages ...........................47
Table 15. STM8S903K3 alternate function remapping bits [1:0] for 32-pin packages .........................102
Table 16. STM8S903F3 alternate function remapping bits [1:0] for 20-pin packages ...........................49
Table 17. Unique ID registers (96 bits) .................................................................................................112
Table 18. Voltage characteristics ...........................................................................................................52
Table 19. Current characteristics ...........................................................................................................52
Table 20. Thermal characteristics ..........................................................................................................53
Table 21. General operating conditions .................................................................................................54
Table 22. Operating conditions at power-up/power-down ......................................................................55
Table 23. Total current consumption with code execution in run mode at V
DD
= 5 V .............................56
Table 24. Total current consumption with code execution in run mode at V
DD
= 3.3 V ..........................57
Table 25. Total current consumption in wait mode at V
DD
= 5 V ............................................................58
Table 26. Total current consumption in wait mode at V
DD
= 3.3 V .........................................................58
Table 27. Total current consumption in active halt mode at V
DD
= 5 V ..................................................59
Table 28. Total current consumption in active halt mode at V
DD
= 3.3 V ...............................................60
Table 29. Total current consumption in halt mode at V
DD
= 5 V .............................................................61
Table 30. Total current consumption in halt mode at V
DD
= 3.3 V ..........................................................61
Table 31. Wakeup times .........................................................................................................................61
Table 32. Total current consumption and timing in forced reset state ....................................................62
Table 33. Peripheral current consumption .............................................................................................63
Table 34. HSE user external clock characteristics .................................................................................66
Table 35. HSE oscillator characteristics .................................................................................................66
Table 36. HSI oscillator characteristics ..................................................................................................68
Table 37. LSI oscillator characteristics ...................................................................................................69
Table 38. RAM and hardware registers ..................................................................................................70
Table 39. Flash program memory/data EEPROM memory ....................................................................70
Table 40. I/O static characteristics .........................................................................................................71
Table 41. Output driving current (standard ports) ..................................................................................73
Table 42. Output driving current (true open drain ports) ........................................................................73
Table 43. Output driving current (high sink ports) ..................................................................................74
Table 44. NRST pin characteristics ........................................................................................................79
Table 45. SPI characteristics ..................................................................................................................82
2
Table 46. I C characteristics ..................................................................................................................84
Table 47. ADC characteristics ................................................................................................................85
4/115
DocID15590 Rev 6
STM8S903K3 STM8S903F3
List of tables
Table 48. ADC accuracy with R
AIN
< 10 kΩ , V
DD
= 5 V .........................................................................86
Table 49. ADC accuracy with R
AIN
< 10 kΩ R
AIN
, V
DD
= 3.3 V ..............................................................87
Table 50. EMS data ................................................................................................................................89
Table 51. EMI data .................................................................................................................................90
Table 52. ESD absolute maximum ratings .............................................................................................90
Table 53. Electrical sensitivities .............................................................................................................91
Table 54. 32-pin low profile quad flat package mechanical data .........................................................102
Table 55. 32-lead, ultra thin, fine pitch quad flat no-lead package mechanical data .............................94
Table 56. 20-lead, ultra thin, fine pitch quad flat no-lead package (3 x 3) package mechanical data ....96
Table 57. 32-lead shrink plastic DIP (400 ml) package mechanical data ..............................................99
Table 58. 20-pin, 4.40 mm body, 0.65 mm pitch mechanical data .......................................................101
Table 59. 20-lead, plastic small outline (300 mils) mechanical data ....................................................101
Table 60. Thermal characteristics ........................................................................................................102
Table 61. Document revision history ....................................................................................................112
DocID15590 Rev 6
5/115