STM8S103K3 STM8S103F3 STM8S103F2
STM8S103K3 STM8S103F3 STM8S103F2
STM8S103K3 STM8S103F3 STM8S103F2
Communications interfaces
• Extended instruction set • UART with clock output for synchronous
operation, Smartcard, IrDA, LIN master mode
Memories
• Program memory: 8 Kbytes Flash; data retention • SPI interface up to 8 Mbit/s
20 years at 55 °C after 10 kcycles • I C interface up to 400 Kbit/s
2
Contents
1 Introduction ..............................................................................................................8
2 Description ...............................................................................................................9
3 Block diagram ........................................................................................................10
4 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 ..........................................................................................................14
4.8 Auto wakeup counter ...................................................................................................15
4.9 Beeper ........................................................................................................................15
4.10 TIM1 - 16-bit advanced control timer .........................................................................15
4.11 TIM2 - 16-bit general purpose timer ..........................................................................16
4.12 TIM4 - 8-bit basic timer ..............................................................................................16
4.13 Analog-to-digital converter (ADC1) ............................................................................16
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 ...................................................................................19
5.1 STM8S103Kx UFQFPN32/LQFP32/SDIP32 pinout and pin description .....................20
5.2 STM8S103Fx TSSOP20/SO20/UFQFPN20 pinout and pin description .....................24
5.2.1 STM8S103Fx TSSOP20/SO20 pinout .................................................24
5.2.2 STM8S103Fx UFQFPN20 pinout ........................................................25
5.2.3 STM8S103Fx TSSOP20/SO20/UFQFPN20 pin description ................25
5.3 Alternate function remapping .......................................................................................27
6 Memory and register map .....................................................................................28
6.1 Memory map ................................................................................................................28
6.2 Register map ...............................................................................................................29
6.2.1 I/O port hardware register map ............................................................29
6.2.2 General hardware register map ..........................................................30
6.2.3 CPU/SWIM/debug module/interrupt controller registers .....................40
7 Interrupt vector mapping ......................................................................................42
8 Option bytes ...........................................................................................................44
8.1 Alternate function remapping bits ................................................................................46
9 Unique ID ................................................................................................................49
10 Electrical characteristics ....................................................................................50
10.1 Parameter conditions .................................................................................................50
10.1.1 Minimum and maximum values .........................................................50
10.1.2 Typical values .....................................................................................50
10.1.3 Typical curves ....................................................................................50
10.1.4 Loading capacitor ...............................................................................50
10.1.5 Pin input voltage .................................................................................51
10.2 Absolute maximum ratings ........................................................................................51
10.3 Operating conditions ..................................................................................................53
10.3.1 VCAP external capacitor ....................................................................54
10.3.2 Supply current characteristics ............................................................55
10.3.3 External clock sources and timing characteristics .............................65
10.3.4 Internal clock sources and timing characteristics ...............................67
10.3.5 Memory characteristics ......................................................................70
10.3.6 I/O port pin characteristics .................................................................71
10.3.7 Reset pin characteristics ....................................................................79
10.3.8 SPI serial peripheral interface ............................................................82
2
10.3.9 I C interface characteristics ...............................................................85
10.3.10 10-bit ADC characteristics ................................................................86
10.3.11 EMC characteristics .........................................................................90
11 Package information ............................................................................................94
11.1 32-pin LQFP package mechanical data .....................................................................94
11.2 32-lead UFQFPN package mechanical data .............................................................96
11.3 20-lead UFQFPN package mechanical data .............................................................97
11.4 SDIP32 package mechanical data .............................................................................98
11.5 20-pin TSSOP package mechanical data ................................................................100
11.6 20-pin SO package mechanical data .......................................................................101
11.7 UFQFPN recommended footprint ............................................................................102
12 Thermal characteristics ....................................................................................104
12.1 Reference document ...............................................................................................105
12.2 Selecting the product temperature range ................................................................105
13 Ordering information .........................................................................................106
13.1 STM8S103 FASTROM microcontroller option list ...................................................106
14 STM8 development tools ..................................................................................111
14.1 Emulation and in-circuit debugging tools .................................................................111
14.2 Software tools ..........................................................................................................111
14.2.1 STM8 toolset ....................................................................................112
14.2.2 C and assembly toolchains ..............................................................112
14.3 Programming tools ..................................................................................................112
15 Revision history .................................................................................................113
List of tables
Table 1. STM8S103xx 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 ...................................................................................19
Table 5. UFQFPN32/LQFP32/SDIP32 pin description ...........................................................................21
Table 6. STM8S103Fx pin description ...................................................................................................25
Table 7. I/O port hardware register map ................................................................................................29
Table 8. General hardware register map ...............................................................................................30
Table 9. CPU/SWIM/debug module/interrupt controller registers .........................................................40
Table 10. Interrupt mapping ...................................................................................................................42
Table 11. Option bytes .........................................................................................................................113
Table 12. Option byte description ...........................................................................................................44
Table 13. STM8S103K alternate function remapping bits for 32-pin devices ........................................46
Table 14. STM8S103F alternate function remapping bits for 20-pin devices ........................................47
Table 15. Unique ID registers (96 bits) .................................................................................................113
Table 16. Voltage characteristics ...........................................................................................................51
Table 17. Current characteristics ...........................................................................................................52
Table 18. Thermal characteristics ..........................................................................................................52
Table 19. General operating conditions .................................................................................................53
Table 20. Operating conditions at power-up/power-down ......................................................................54
Table 21. Total current consumption with code execution in run mode at VDD = 5 V .............................55
Table 22. Total current consumption with code execution in run mode at VDD = 3.3 V ..........................56
Table 23. Total current consumption in wait mode at VDD = 5 V ............................................................57
Table 24. Total current consumption in wait mode at VDD = 3.3 V .........................................................57
Table 25. Total current consumption in active halt mode at VDD = 5 V ..................................................58
Table 26. Total current consumption in active halt mode at VDD = 3.3 V ...............................................59
Table 27. Total current consumption in halt mode at VDD = 5 V .............................................................60
Table 28. Total current consumption in halt mode at VDD = 3.3 V ..........................................................60
Table 29. Wakeup times .........................................................................................................................60
Table 30. Total current consumption and timing in forced reset state ....................................................61
Table 31. Peripheral current consumption .............................................................................................62
Table 32. HSE user external clock characteristics .................................................................................65
Table 33. HSE oscillator characteristics .................................................................................................66
Table 34. HSI oscillator characteristics ..................................................................................................67
Table 35. LSI oscillator characteristics ...................................................................................................69
Table 36. RAM and hardware registers ..................................................................................................70
Table 37. Flash program memory/data EEPROM memory ....................................................................70
Table 38. I/O static characteristics .........................................................................................................71
Table 39. Output driving current (standard ports) ..................................................................................73
Table 40. Output driving current (true open drain ports) ........................................................................74
Table 41. Output driving current (high sink ports) ..................................................................................74
Table 42. NRST pin characteristics ........................................................................................................79
Table 43. SPI characteristics ..................................................................................................................82
2
Table 44. I C characteristics ..................................................................................................................85
Table 45. ADC characteristics ................................................................................................................87
Table 46. ADC accuracy with RAIN < 10 kΩ , VDD= 5 V .........................................................................87
Table 47. ADC accuracy with RAIN < 10 kΩ RAIN, VDD = 3.3 V ..............................................................88
List of figures
Figure 1. Block diagram .........................................................................................................................10
Figure 2. Flash memory organization ....................................................................................................13
Figure 3. STM8S103Kx UFQFPN32/LQFP32 pinout .............................................................................20
Figure 4. STM8S103Kx SDIP32 pinout .................................................................................................21
Figure 5. STM8S103Fx TSSOP20/SO20 pinout ....................................................................................24
Figure 6. STM8S103Fx UFQFPN20-pin pinout .....................................................................................25
Figure 7. Memory map ...........................................................................................................................28
Figure 8. Pin loading conditions .............................................................................................................50
Figure 9. Pin input voltage .....................................................................................................................51
Figure 10. fCPUmax versus VDD ..............................................................................................................54
Figure 11. External capacitor CEXT .......................................................................................................55
Figure 12. Typ IDD(RUN) vs. VDD HSE user external clock, fCPU = 16 MHz .............................................63
Figure 13. Typ IDD(RUN) vs. fCPU HSE user external clock, VDD = 5 V ....................................................63
Figure 14. Typ IDD(RUN) vs. VDD HSI RC osc, fCPU = 16 MHz .................................................................64
Figure 15. Typ IDD(WFI) vs. VDD HSE user external clock, fCPU = 16 MHz ..............................................64
Figure 16. Typ IDD(WFI) vs. fCPU HSE user external clock, VDD = 5 V .....................................................65
Figure 17. Typ IDD(WFI) vs. VDD HSI RC osc, fCPU = 16 MHz .................................................................65
Figure 18. HSE external clocksource .....................................................................................................66
Figure 19. HSE oscillator circuit diagram ...............................................................................................67
Figure 20. Typical HSI frequency variation vs VDD @ 4 temperatures ..................................................69
Figure 21. Typical LSI frequency variation vs VDD @ 4 temperatures ...................................................69
Figure 22. Typical VIL and VIH vs VDD @ 4 temperatures ......................................................................72
Figure 23. Typical pull-up resistance vs VDD @ 4 temperatures ............................................................73
Figure 24. Typical pull-up current vs VDD @ 4 temperatures .................................................................73
Figure 25. Typ. VOL @ VDD = 5 V (standard ports) ................................................................................75
Figure 26. Typ. VOL @ VDD = 3.3 V (standard ports) .............................................................................75
Figure 27. Typ. VOL @ VDD = 5 V (true open drain ports) ......................................................................76
Figure 28. Typ. VOL @ VDD = 3.3 V (true open drain ports) ...................................................................76
Figure 29. Typ. VOL @ VDD = 5 V (high sink ports) ................................................................................77
Figure 30. Typ. VOL @ VDD = 3.3 V (high sink ports) .............................................................................77
Figure 31. Typ. VDD - VOH@ VDD = 5 V (standard ports) .......................................................................78
Figure 32. Typ. VDD - VOH @ VDD = 3.3 V (standard ports) ...................................................................78
Figure 33. Typ. VDD - VOH@ VDD = 5 V (high sink ports) .......................................................................79
Figure 34. Typ. VDD - VOH@ VDD = 3.3 V (high sink ports) ....................................................................79
Figure 35. Typical NRST VIL and VIH vs VDD @ 4 temperatures ...........................................................80
Figure 36. Typical NRST pull-up resistance vs VDD @ 4 temperatures .................................................81
Figure 37. Typical NRST pull-up current vs VDD @ 4 temperatures ......................................................81
Figure 38. Recommended reset pin protection ......................................................................................82
Figure 39. SPI timing diagram - slave mode and CPHA = 0 ..................................................................84
Figure 40. SPI timing diagram - slave mode and CPHA = 1 ..................................................................84
(1)
Figure 41. SPI timing diagram - master mode ...................................................................................85
2
Figure 42. Typical application with I C bus and timing diagram ............................................................89
Figure 43. ADC accuracy characteristics ...............................................................................................89
Figure 44. Typical application with ADC ................................................................................................90
Figure 45. 32-pin low profile quad flat package (7 x 7) ..........................................................................94
Figure 46. 32-lead, ultra thin, fine pitch quad flat no-lead package (5 x 5) ............................................96
Figure 47. 20-lead, ultra thin, fine pitch quad flat no-lead package outline (3 x 3) ................................97
Figure 48. 32-lead shrink plastic DIP (400 ml) package ........................................................................98
Figure 49. 20-pin, 4.40 mm body, 0.65 mm pitch .................................................................................101
Figure 50. 20-lead, plastic small outline (300 mils) package ...............................................................101
Figure 51. Recommended footprint for on-board emulation ................................................................102
Figure 52. Recommended footprint without on-board emulation .........................................................103
Figure 53. STM8S103x access line ordering information scheme ......................................................106
1 Introduction
This datasheet contains the description of the device features, pinout, electrical characteristics,
mechanical data and ordering information.
• For complete information on the STM8S microcontroller memory, registers and peripherals,
please refer to the STM8S microcontroller family reference manual (RM0016).
• For information on programming, erasing and protection of the internal Flash memory
please refer to the STM8S Flash programming manual (PM0051).
• For information on the debug 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).
2 Description
The STM8S103x access line 8-bit microcontrollers offer 8 Kbytes Flash program memory,
plus integrated true data EEPROM. The STM8S microcontroller family reference manual
(RM0016) refers to devices in this family as low-density. They provide 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 clock 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 integration level with internal clock oscillators, watchdog
and brown-out reset.
Full documentation is offered as well as a wide choice of development tools.
RAM (bytes) 1K 1K 1K
2
Multipurpose timer (TIM1), SPI, I C, UART window
Peripheral set WDG,independent WDG, ADC, PWM timer (TIM2), 8-bit
timer (TIM4)
(1)
No read-while-write (RWW) capability
3 Block diagram
Figure 1: Block diagram
Reset Reset
RC int. 16 MHz
Detector
POR BOR RC int. 128 kHz
Window WDG
STM8 core
Independent WDG
640 bytes
data EEPROM
Address and data bus
SPI Up to
8 Mbit/s
4 CAPCOM
channels +3
complementary
LIN master 16-bit advanced outputs
SPI emul. UART1 control timer (TIM1)
4 Product overview
The following section intends to give an overview of the basic features of the device functional
modules and peripherals.
For more detailed information please refer to the corresponding family reference manual
(RM0016).
• 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
4.2 Single wire interface module (SWIM) and debug module (DM)
The single wire interface module and debug module permits non-intrusive, real-time in-circuit
debugging and fast memory programming.
SWIM
Single wire interface module for direct access to the debug module and memory programming.
The interface can be activated in all device operation modes. The maximum data transmission
speed is 145 bytes/ms.
Debug module
The non-intrusive debugging module features a performance close to a full-featured emulator.
Beside memory and peripherals, also CPU operation can be monitored in real-time by means
of shadow registers.
• R/W to RAM and peripheral registers in real-time
• R/W access to all resources by stalling the CPU
• Breakpoints on all program-memory instructions (software breakpoints)
• Two advanced breakpoints, 23 predefined configurations
4.3 Interrupt controller
• Nested interrupts with three software priority levels
• 32 interrupt vectors with hardware priority
• Up to 27 external interrupts on 6 vectors including TLI
• Trap and reset interrupts
4.4 Flash program and data EEPROM memory
• 8 Kbytes of Flash program single voltage Flash memory
• 640 bytes true data EEPROM
• User option byte area
Write protection (WP)
Write protection of Flash program memory and data EEPROM is provided to avoid unintentional
overwriting of memory that could result from a user software malfunction.
There are two levels of write protection. The first level is known as MASS (memory access
security system). MASS is always enabled and protects the main Flash program memory,
data EEPROM and option bytes.
To perform in-application programming (IAP), this write protection can be removed by writing
a MASS key sequence in a control register. This allows the application to write to data
EEPROM, modify the contents of main program memory or the device option bytes.
A second level of write protection, can be enabled to further protect a specific area of memory
known as UBC (user boot code). Refer to the figure below.
The size of the UBC is programmable through the UBC option byte, in increments of 1 page
(64-byte block) by programming the UBC option byte in ICP mode.
This divides the program memory into two areas:
• Main program memory: Up to 8 Kbytes minus UBC
• User-specific boot code (UBC): Configurable up to 8 Kbytes
The UBC area remains write-protected during in-application programming. This means that
the MASS keys do not unlock the UBC area. It protects the memory used to store the boot
program, specific code libraries, reset and interrupt vectors, the reset routine and usually the
IAP and communication routines.
Figure 2: Flash memory organization
Programmable
UBC area area from 64
Remains write protected during IAP bytes(1 page)
up to 8 Kbytes
(in 1 page steps)
Low density
Flash program
memory
(8 Kbytes)
Program memory area
Write access possible for IAP
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. The clock signal is not switched until the new clock source
is ready. The design guarantees glitch-free switching.
• Clock management: To reduce power consumption, the clock controller can stop the
clock to the core, individual peripherals or memory.
• Master
clock:
clock sources: Four different clock sources can be used to drive the master
• 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 an HSE clock
failure occurs, the internal RC (16 MHz/8) is automatically selected by the CSS and an
interrupt can optionally be generated.
• Configurable
application.
main clock output (CCO): This outputs an external clock for use by the
Activation of the watchdog timers is controlled by option bytes or by software. Once activated,
the watchdogs cannot be disabled by the user program without performing a reset.
Any power of
TIM2 16 2 from 1 to Up 3 0 No No
32768
Any power of
TIM4 8 2 from 1 to Up 0 0 No
128
Main features
• One Mbit/s full duplex SCI
• SPI emulation
• High precision baud rate generator
• Smartcard emulation
• IrDA SIR encoder decoder
• LIN master mode
• Single wire half duplex mode
Asynchronous communication (UART mode)
• Full duplex communication - NRZ standard format (mark/space)
• Programmable transmit and receive baud rates up to 1 Mbit/s (f
CPU
following any standard baud rate regardless of the input frequency
/16) and capable of
Output speed
O1 = Slow (up to 2 MHz)
O2 = Fast (up to 10 MHz)
O3 = Fast/slow programmability with slow as default state after reset
O4 = Fast/slow programmability with fast as default state after reset
Reset state
Bold X (pin state after internal reset release).
Unless otherwise specified, the pin state is the same during the reset
phase and after the internal reset release.
PD1 (HS)/SWIM
32 31 30 29 28 27 26 25
NRST 1 24 PC7 (HS)/SPI_MISO
OSCIN/PA1 2 23 PC6 (HS)/SPI_MOSI
OSCOUT/PA2 3 22 PC5 (HS)/SPI_SCK
VSS 4 21 PC4 (HS)/TIM1_CH4/CLK_CCO
VCAP 5 20 PC3 (HS)/TIM1_CH3
VDD 6 19 PC2 (HS)/TIM1_CH2
[SPI_NSS] TIM2_CH3/(HS) PA3 7 18 PC1 (HS)/TIM1_CH1/UART1_CK
PF4 8 17 PE5 (HS)/SPI_NSS
9 10 11 12 13 14 15 16
PB7
PB6
I2C_SDA/ (T) PB5
I2C_SCL/(T) PB4
TIM1_ETR/AIN3/(HS) PB3
TIM1_CH3N/ AIN2/(HS) PB2
TIM1_CH2N/ AIN1/(HS) PB1
TIM1_CH1N/AIN0/(HS) PB0
VDD 11 22 PE5/SPI_NSS
(3) 2
16 11 PB5/ I/O X X O1 T Port B5 I C data
2
I C_SDA
(3) 2
17 12 PB4/ I/O X X O1 T Port B4 I C clock
2
I C_SCL
(1)
I/O pins used simultaneously for high current source/sink must be uniformly spaced around the package. In addition, the total
driven current must respect the absolute maximum ratings (see Electrical characteristics).
(2)
When the MCU is in Halt/Active-halt mode, PA1 is automatically configured in input weak pull-up and cannot be used for waking
up the device. In this mode, the output state of PA1 is not driven. It is recommended to use PA1 only in input mode if Halt/Active-halt
is used in the application.
(3)
In the open-drain output column, "T" defines a true open-drain I/O (P-buffer, weak pull-up, and protection diode to VDD are not
implemented).
(4)
The PD1 pin is in input pull-up during the reset phase and after internal reset release.
PD3 (HS)/AIN4/TIM2_CH2/ADC_ETR
20 19 18 17 16
NRST 1 15
PD1(HS)/SWIM
OSCIN/PA1 2 14 PC7 (HS)/SPI_MISO [TIM1_CH2]
OSCOUT/PA2 3 13 PC6 (HS)/SPI_MOSI [TIM1_CH1]
VSS 4 12 PC5 (HS)/SPI_SCK [TIM2_CH1]
VCAP 5 11 PC4 (HS)/TIM1_CH4/CLK_CCO/AIN2 [TIM1_CH2N]
6 7 8 9 10
[TIM1_CH1N] [TLI] TIM1_CH3/(HS) PC3
VDD
(2)
5 2 PA1/ OSCIN I/O X X X O1 X X Port A1 Resonator/
crystal in
2 2
11 8 PB5/ I C_ SDA I/O X X O1 T Port B5 I C data Timer 1 - break
(3)
[TIM1_ BKIN] input [AFR4]
2 2
12 9 PB4/ I C_ SCL I/O X X O1 T Port B4 I C clock ADC external
(3)
trigger [AFR4]
(1)
I/O pins used simultaneously for high current source/sink must be uniformly spaced around the package. In addition, the total driven current must respect the absolute
maximum ratings.
(2)
When the MCU is in halt/active-halt mode, PA1 is automatically configured in input weak pull-up and cannot be used for waking up the device. In this mode, the output
state of PA1 is not driven. It is recommended to use PA1 only in input mode if halt/active-halt is used in the application.
(3)
In the open-drain output column, "T" defines a true open-drain I/O (P-buffer, weak pull-up, and protection diode to VDD are not implemented).
0x00 0000
RAM
(1 Kbyte)
Reserved
0x00 3FFF
0x00 4000
640 bytes data EEPROM
0x00 427F
0x00 4280
Reserved
0x00 47FF
0x00 4800 Option bytes
0x00 480A
0x00 480B Reserved
0x00 4864
0x00 4865
0x00 4870
Unique ID
0x00 4871
Reserved
0x00 4FFF
0x00 5000
GPIO and periph. reg.
0x00 57FF
0x00 5800
Reserved
0x00 7EFF
0x00 7F00
CPU/SWIM/debug/ITC
registers
0x00 7FFF
0x00 8000
32 interrupt vectors
0x00 807F
0x00 8080 Flash program memory
0x00 9FFF
(8 Kbytes)
0x00 A000
Reserved
0x02 7FFF
Reset
Address Block Register label Register name
status
0x00 5018 Port E PE_CR2 Port E control register 2 0x00
(1)
Depends on the external circuitry.
0x00 5062 Flash FLASH _PUKR Flash program memory unprotection 0x00
register
0x00 5064 Flash FLASH _DUKR Data EEPROM unprotection register 0x00
(1)
0x00 50B3 RST RST_SR Reset status register 0xXX
(2)
0x00 50E0 IWDG IWDG_KR IWDG key register 0xXX
2 2
0x00 5210 I C I2C_CR1 I C control register 1 0x00
2
0x00 5211 I2C_CR2 I C control register 2 0x00
2
0x00 5212 I2C_FREQR I C frequency register 0x00
2
0x00 5213 I2C_OARL I C Own address register low 0x00
2
0x00 5214 I2C_OARH I C Own address register high 0x00
2
0x00 5216 I2C_DR I C data register 0x00
2
0x00 5217 I2C_SR1 I C status register 1 0x00
2
0x00 5218 I2C_SR2 I C status register 2 0x00
2
0x00 5219 I2C_SR3 I C status register 3 0x0X
2
0x00 521A I2C_ITR I C interrupt control register 0x00
2
0x00 521B I2C_CCRL I C Clock control register low 0x00
2
0x00 521C I2C_CCRH I C Clock control register high 0x00
2
0x00 521D I2C_TRISER I C TRISE register 0x02
2
0x00 521E I2C_PECR I C packet error checking register 0x00
0x00 53E0 to ADC1 ADC _DBxR ADC data buffer registers 0x00
0x00 53F3
(1)
Depends on the previous reset source.
(2)
Write only register.
0x00 7F0B to
Reserved area (85 bytes)
0x00 7F5F
0x00 7F78 to
Reserved area (2 bytes)
0x00 7F79
0x00 7F81 to
Reserved area (15 bytes)
0x00 7F8F
(1)
Accessible by debug module only
0x00 806C to
Reserved
0x00 807C
(1)
Except PA1
8 Option bytes
Option bytes contain configurations for device hardware features as well as the memory
protection of the device. They are stored in a dedicated block of the memory. Except for the
ROP (read-out protection) byte, each option byte has to be stored twice, in a regular form
(OPTx) and a complemented one (NOPTx) for redundancy.
Option bytes can be modified in ICP mode (via SWIM) by accessing the EEPROM address
shown in the table below.
Option bytes can also be modified ‘on the fly’ by the application in IAP mode, except the ROP
option that can only be modified in ICP mode (via SWIM).
Refer to the STM8S Flash programming manual (PM0051) and STM8 SWIM communication
protocol and debug module user manual (UM0470) for information on SWIM programming
procedures.
0x4803 Alternate OPT2 AFR7 AFR6 AFR5 AFR4 AFR3 AFR2 AFR1 AFR0 0x00
function
0x4804 remapping NOPT2 NAFR7 NAFR6 NAFR5 NAFR4 NAFR3 NAFR2 NAFR1 NAFR0 0xFF
(AFR)
0x4805h Miscell. OPT3 Reserved HSI LSI_ EN IWDG WWDG WWDG 0x00
option TRIM _HW _HW _HALT
0x4807 Clock OPT4 Reserved EXT CLK CKAWU PRS C1 PRS C0 0x00
option SEL
OPT0
ROP[7:0] Memory readout protection (ROP)
0xAA: Enable readout protection (write access via SWIM protocol)
OPT1
UBC[7:0] User boot code area
0x00: no UBC, no write-protection
0x01: Page 0 defined as UBC, memory write-protected
0x02: Pages 0 to 1 defined as UBC, memory write-protected.
Page 0 and 1 contain the interrupt vectors.
...
0x7F: Pages 0 to 126 defined as UBC, memory write-protected
Other values: Pages 0 to 127 defined as UBC, memory
write-protected
Note: Refer to the family reference manual (RM0016) section on
Flash write protection for more details.
OPT2
AFR[7:0]
Refer to following section for alternate function remapping decriptions
of bits [7:2] and [1:0] respectively.
OPT3
HSITRIM:High speed internal clock trimming register size
0: 3-bit trimming supported in CLK_HSITRIMR register
1: 4-bit trimming supported in CLK_HSITRIMR register
OPT4
EXTCLK: External clock selection
0: External crystal connected to OSCIN/OSCOUT
1: External clock signal on OSCIN
OPT5
HSECNT[7:0]:HSE crystal oscillator stabilization time
0x00: 2048 HSE cycles
0xB4: 128 HSE cycles
0xD2: 8 HSE cycles
0xE1: 0.5 HSE cycles
Table 13: STM8S103K alternate function remapping bits for 32-pin devices
(1)
Option byte no. Description
OPT2
AFR7 Alternate function remapping option 7
Reserved.
AFR6 Alternate function remapping option 6
(2)
0: AFR6 remapping option inactive: Default alternate function .
1: Port D7 alternate function = TIM1_CH4.
AFR5 Alternate function remapping option 5
(2)
0: AFR5 remapping option inactive: Default alternate function .
(1)
Option byte no. Description
1: Port D0 alternate function = CLK_CCO.
AFR[4:2] Alternate function remapping options 4:2
Reserved.
AFR1 Alternate function remapping option 1
(2)
0: AFR1 remapping option inactive: Default alternate functions .
1: Port A3 alternate function = SPI_NSS; port D2 alternate function
= TIM2_CH3.
AFR0 Alternate function remapping option 0
Reserved.
(1)
Do not use more than one remapping option in the same port. It is forbidden to enable
both AFR1 and AFR0.
(2)
Refer to pinout description.
Table 14: STM8S103F alternate function remapping bits for 20-pin devices
Option byte no. Description
OPT2
AFR7 Alternate function remapping option 7
0: AFR7 remapping option inactive: Default alternate
(1)
functions .
1: Port C3 alternate function = TIM1_CH1N; port C4
alternate function = TIM1_CH2N.
AFR6 Alternate function remapping option 6
Reserved.
AFR5 Alternate function remapping option 5
Reserved.
AFR4 Alternate function remapping option 4
0: AFR4 remapping option inactive: Default alternate
(1)
functions .
1: Port B4 alternate function = ADC_ETR; port B5
alternate function = TIM1_BKIN.
AFR3 Alternate function remapping option 3
0: AFR3 remapping option inactive: Default alternate
(1)
function .
1: Port C3 alternate function = TLI.
AFR2 Alternate function remapping option 2
(1)
Refer to pinout description.
(2)
Do not use more than one remapping option in the same port. It is forbidden to enable
both AFR1 and AFR0.
9 Unique ID
The devices feature a 96-bit unique device identifier which provides a reference number that
is unique for any device and in any context. The 96 bits of the identifier can never be altered
by the user.
The unique device identifier can be read in single bytes and may then be concatenated using
a custom algorithm.
The unique device identifier is ideally suited:
• For use as serial numbers
• For use as security keys to increase the code security in the program memory while using
and combining this unique ID with software cryptograhic primitives and protocols before
programming the internal memory.
• To activate secure boot processes
Table 15: Unique ID registers (96 bits)
Address Content Unique ID bits
description 7 6 5 4 3 2 1 0
0x4865 X co-ordinate U_ID[7:0]
0x486A U_ID[47:40]
0x486B U_ID[55:48]
0x486C U_ID[63:56]
0x486E U_ID[79:72]
0x486F U_ID[87:80]
0x4870 U_ID[95:88]
10 Electrical characteristics
10.1 Parameter conditions
Unless otherwise specified, all voltages are referred to VSS.
STM8 PIN
50 pF
STM8 PIN
VIN
|VDDx - VDD| - 50
Variations between different power pins
|VSSx - VSS| mV
Variations between all the different ground - 50
pins
(1)
All power (VDD) and ground (VSS) pins must always be connected to the external power supply
(2)
IINJ(PIN) must never be exceeded. This is implicitly insured if VIN maximum is respected. If VIN maximum
cannot be respected, the injection current must be limited externally to the IINJ(PIN) value. A positive
injection is induced by VIN>VDD while a negative injection is induced by VIN<VSS. For true open-drain
pads, there is no positive injection current, and the corresponding VIN maximum must always be respected
(2) 80
IVSS Total current out of VSS ground lines (sink)
IIO 20
Output current sunk by any I/O and control pin
(5) ±4
Injected current on any other pin
(3)
ΣI INJ(PIN) (5) ± 20
Total injected current (sum of all I/O and control pins)
(1)
Data based on characterization results, not tested in production.
(2)
All power (VDD) and ground (VSS) pins must always be connected to the external supply.
(3)
IINJ(PIN) must never be exceeded. This is implicitly insured if VIN maximum is respected. If VIN maximum
cannot be respected, the injection current must be limited externally to the IINJ(PIN) value. A positive
injection is induced by VIN>VDD while a negative injection is induced by VIN<VSS. For true open-drain
pads, there is no positive injection current, and the corresponding VIN maximum must always be respected
(4)
ADC accuracy vs. negative injection current: Injecting negative current on any of the analog input pins
should be avoided as this significantly reduces the accuracy of the conversion being performed on
another analog input. It is recommended to add a Schottky diode (pin to ground) to standard analog pins
which may potentially inject negative current. Any positive injection current within the limits specified for
IINJ(PIN) and ΣIINJ(PIN) in the I/O port pin characteristics section does not affect the ADC accuracy.
(5)
When several inputs are submitted to a current injection, the maximum ΣIINJ(PIN) is the absolute sum
of the positive and negative injected currents (instantaneous values). These results are based on
characterization with ΣIINJ(PIN) maximum current injection on four I/O port pins of the device.
ESL of external
- 15 nH
capacitor
(3)
PD TSSOP20 - 238
SO20W - 220
UFQFPN32 - 526
SDIP32 - 330
mW
TSSOP20 - 59
SO20W - 55
UFQFPN32 - 132
SDIP32 - 83
(1)
Care should be taken when selecting the capacitor, due to its tolerance, as well as the parameter
dependency on temperature, DC bias and frequency in addition to other factors. The parameter maximum
value must be respected for the full application range.
(2)
This frequency of 1 MHz as a condition for VCAP parameters is given by design of internal regulator.
(3)
To calculate PDmax(TA), use the formula PDmax =(TJmax- TA)/ΘJA (see Thermal characteristics ) with the
value for TJmax given in the previous table and the value for ΘJA given in Thermal characteristics.
f
CPU (MHz)
Functionality
not 16
guaranteed
in this area 12 Functionality guaranteed
@TA-40 to 125 °C
8
4
0
2.95 4.0 5.0 5.5
Supply voltage
(1)
Reset is always generated after a tTEMP delay. The application must ensure that VDD is still above the
minimum ooperating voltage (VDD min) when the tTEMP delay has elapsed.
C ESL
ESR
RLeak
1. ESR is the equivalent series resistance and ESL is the equivalent inductance.
Table 21: Total current consumption with code execution in run mode at VDD = 5 V
Supply current fCPU = fMASTER/128 = HSE user ext. clock (16 MHz) 0.86 -
in run mode, 125 kHz
HSI RC osc. (16 MHz) 0.7 0.87
code executed
from RAM fCPU = fMASTER/128 =
IDD(RUN) HSI RC osc. (16 MHz/8) 0.46 0.58 mA
15.625 kHz
fCPU = fMASTER =
LSI RC osc. (128 kHz) 0.41 0.55
128 kHz
fCPU = fMASTER =
(2)
HSI RC osc. (16 MHz/8) 0.84 1.05
2 MHz
fCPU = fMASTER/128 =
Supply current 125 kHz HSI RC osc. (16 MHz) 0.72 0.9
in run mode,
IDD(RUN) mA
code executed f
CPU = fMASTER/128 =
from Flash HSI RC osc. (16 MHz/8) 0.46 0.58
15.625 kHz
fCPU = fMASTER =
LSI RC osc. (128 kHz) 0.42 0.57
128 kHz
(1)
Data based on characterization results, not tested in production.
(2)
Default clock configuration measured with all peripherals off.
Table 22: Total current consumption with code execution in run mode at VDD = 3.3 V
Symbol Parameter Conditions Typ (1) Unit
Max
Supply current fCPU = fMASTER/ HSE user ext. clock (16 MHz) 0.81 -
in run mode, 128 = 125 kHz
HSI RC osc. (16 MHz) 0.7 0.87
code executed
from RAM fCPU = fMASTER/
HSI RC osc. (16 MHz/8) 0.46 0.58
128 = 15.625 kHz
fCPU = fMASTER/
HSI RC osc. (16 MHz/8) 0.46 0.58
128 = 15.625 kHz
fCPU = fMASTER =
LSI RC osc. (128 kHz) 0.42 0.57
128 kHz
(1)
Data based on characterization results, not tested in production.
(2)
Default clock configuration measured with all peripherals off.
fCPU = fMASTER/128 =
Supply HSI RC osc. (16 MHz) 0.7 0.88
IDD(WFI) current in 125 kHz mA
wait mode
fCPU = fMASTER/128 =
(2)
HSI RC osc. (16 MHz/8) 0.45 0.57
15.625 kHz
fCPU = fMASTER =
LSI RC osc. (128 kHz) 0.4 0.54
128 kHz
(1)
Data based on characterization results, not tested in production.
(2)
Default clock configuration measured with all peripherals off.
HSI RC osc.
0.89 1.1
(16 MHz)
(1)
Data based on characterization results, not tested in production.
(2)
Default clock configuration measured with all peripherals off.
(1)
Data based on characterization results, not tested in production
(2)
Configured by the REGAH bit in the CLK_ICKR register.
(3)
Configured by the AHALT bit in the FLASH_CR1 register.
Table 26: Total current consumption in active halt mode at VDD = 3.3 V
Conditions
Max at Max at
Main
Symbol Parameter Typ 85 °C 125 °C Unit
voltage (3)
Flash mode Clock source (1) (1)
regulator
(2)
(MVR)
Supply current HSE crystal
IDD(AH) in active halt On Operating mode osc. (16 MHz) 550 - - μA
mode
LSI RC osc.
IDD(AH) Supply current Operating mode 200 260 290
(128 kHz)
in active halt
mode HSE crystal
IDD(AH) On 970 - -
osc. (16 MHz)
Power-down
mode LSI RC osc. μA
IDD(AH) 150 200 230
(128 kHz)
Supply current
IDD(AH) in active halt Operating mode LSI RC osc. 66 80 105
mode
Off Power-down (128 kHz)
IDD(AH) 10 18 35
mode
(1)
Data based on characterization results, not tested in production
(2)
Configured by the REGAH bit in the CLK_ICKR register.
(3)
Configured by the AHALT bit in the FLASH_CR1 register.
(1)
Data based on characterization results, not tested in production
(1)
Data based on characterization results, not tested in production
(1)
Data guaranteed by design, not tested in production.
(2)
tWU(WFI) = 2 x 1/fmaster + 6 x 1/fCPU.
(3)
Measured from interrupt event to interrupt vector fetch.
(4)
Configured by the REGAH bit in the CLK_ICKR register.
(5)
Configured by the AHALT bit in the FLASH_CR1 register.
(6)
Plus 1 LSI clock depending on synchronization.
(1)
Data guaranteed by design, not tested in production.
(2)
Characterized with all I/Os tied to VSS.
IDD(TIM4) (1) 50
TIM4 timer supply current
IDD(SPI) (2) 45
SPI supply current
IDD(I2C) 2 (2) 65
I C supply current
(1)
Data based on a differential IDD measurement between reset configuration and timer counter running
at 16 MHz. No IC/OC programmed (no I/O pads toggling). Not tested in production.
(2)
Data based on a differential IDD measurement between the on-chip peripheral when kept under reset
and not clocked and the on-chip peripheral when clocked and not kept under reset. No I/O pads toggling.
Not tested in production.
(3)
Data based on a differential IDD measurement between reset configuration and continuous A/D
conversions. Not tested in production.
Figure 12: Typ IDD(RUN) vs. VDD HSE user external clock, fCPU = 16 MHz
Figure 13: Typ IDD(RUN) vs. fCPU HSE user external clock, VDD = 5 V
Figure 14: Typ IDD(RUN) vs. VDD HSI RC osc, fCPU = 16 MHz
Figure 15: Typ IDD(WFI) vs. VDD HSE user external clock, fCPU = 16 MHz
Figure 16: Typ IDD(WFI) vs. fCPU HSE user external clock, VDD = 5 V
Figure 17: Typ IDD(WFI) vs. VDD HSI RC osc, fCPU = 16 MHz
ILEAK_HSE OSCIN input leakage current VSS < VIN < VDD -1 +1 μA
(1)
Data based on characterization results, not tested in production.
V
HSEH
V HSEL
fHSE
External clock
source
OSCIN
STM8
gm Oscillator
5 mA/V
transconductance
(4)
tSU(HSE) Startup time VDD is stabilized 1 ms
(1)
C is approximately equivalent to 2 x crystal Cload.
(2)
The oscillator selection can be optimized in terms of supply current using a high quality resonator with
small Rm value. Refer to crystal manufacturer for more details
(3)
Data based on characterization results, not tested in production.
(4)
tSU(HSE) is the start-up time measured from the moment it is enabled (by software) to a stabilized 16
MHz oscillation is reached. This value is measured for a standard crystal resonator and it can vary
significantly with the crystal manufacturer.
Rm
f HSE to core
CO
Lm RF
CL1
Cm OSCIN gm
Resonator
Consumption
control
Resonator
CL2 OSCOUT
STM8
(1)
Refer to application note.
(2)
Data based on characterization results, not tested in production.
(3)
Guaranteed by design, not tested in production.
(1)
Minimum supply voltage without losing data stored in RAM (in halt mode or under reset)
or in hardware registers (only in halt mode). Guaranteed by design, not tested in production.
(2)
Refer to the Operating conditions section for the value of VIT-max
(1)
Data based on characterization results, not tested in production.
(2)
The physical granularity of the memory is 4 bytes, so cycling is performed on 4 bytes
even when a write/erase operation addresses a single byte.
General characteristics
Subject to general operating conditions for VDD and TA unless otherwise specified. All unused
pins must be kept at a fixed voltage: using the output mode of the I/O for example or an
external pull-up or pull-down resistor.
Vhys (1)
- 700 - mV
Hysteresis
Load = 50 pF
(3)
Fast I/Os - - 20
Load = 20 pF
(1)
Hysteresis voltage between Schmitt trigger switching levels. Based on characterization results, not
tested in production.
(2)
Data based on characterisation results, not tested in production.
(3)
Data guaranteed by design.
(1)
Data based on characterization results, not tested in production
(1)
Data based on characterization results, not tested in production
IIO = 10 mA,
Output low level with 4 pins sunk - 1.0
(1)
VDD = 3.3 V
VOL
IIO = 20 mA,
Output low level with 4 pins sunk - 1.5
(1)
VDD = 5 V
IIO = 10 mA,
Output high level with 8 pins sourced 4.0 - V
VDD = 5 V
IIO = 10 mA,
VOH Output high level with 4 pins sourced 2.1
(1)
-
VDD = 3.3 V
IIO = 20 mA,
Output high level with 4 pins sourced 3.3
(1)
-
VDD = 5 V
(1)
Data based on characterization results, not tested in production
Figure 28: Typ. VOL @ VDD = 3.3 V (true open drain ports)
Figure 34: Typ. VDD - VOH@ VDD = 3.3 V (high sink ports)
VOL(NRST)
NRST output low
- - 0.5
(1)
level voltage
RPU(NRST)
NRST pull-up
30 55 80 kΩ
(2)
resistor
tI FP(NRST)
NRST input filtered
- - 75
(3)
pulse
ns
tIN FP(NRST)
NRST input not
500 - -
(3)
filtered pulse
tOP(NRST)
NRST output
20 - - μs
(3)
pulse
(1)
Data based on characterization results, not tested in production.
(2)
The RPU pull-up equivalent resistor is based on a resistive transistor
(3)
Data guaranteed by design, not tested in production.
The reset network shown in the following figure protects the device against parasitic resets.
The user must ensure that the level on the NRST pin can go below VIL(NRST) max. (see Table
38: I/O static characteristics ), otherwise the reset is not taken into account internally.
For power consumption sensitive applications, the external reset capacitor value can be
reduced to limit the charge/discharge current. If NRST signal is used to reset external circuitry,
attention must be taken to the charge/discharge time of the external capacitor to fulfill the
external devices reset timing conditions. Minimum recommended capacity is 100 nF.
VDD STM8
RPU
External
NRST Filter Internal reset
reset
circuit
0.1 μF
(optional)
(1)
Parameters are given by selecting 10 MHz I/O output frequency.
(2)
Data characterization in progress.
(3)
Values based on design simulation and/or characterization results, and not tested in
production.
(4)
Min time is for the minimum time to drive the output and the max time is for the maximum
time to validate the data.
(5)
Min time is for the minimum time to invalidate the output and the max time is for the
maximum time to put the data in Hi-Z.
NSS input
tSU(NSS) tc(SCK) th(NSS)
CPHA= 0
SCK Input
CPOL=0
tw(SCKH)
CPHA= 0 tw(SCKL)
CPOL=1
NSS input
tSU(NSS) tc(SCK) th(NSS)
CPHA=1
SCK Input
CPOL=0
tw(SCKH)
CPHA=1 tw(SCKL)
CPOL=1
ai14135
1. Measurement points are made at CMOS levels: 0.3 VDD and 0.7 VDD.
(1)
Figure 41: SPI timing diagram - master mode
High
NSS input
tc(SCK)
CPHA= 0
SCK intput
CPOL=0
CPHA= 0
CPOL=1
SCK output
CPHA=1
CPOL=0
CPHA=1
CPOL=1
tw(SCKH) tr(SCK)
tsu(MI) tw(SCKL) tf(SCK)
MISO
INP UT MS BIN BI T6 IN LSB IN
th(MI)
MOSI
M SB OUT B I T1 OUT LSB OUT
OUTUT
tv(MO) th(MO)
ai14136b
1. Measurement points are made at CMOS levels: 0.3 VDD and 0.7 VDD.
2
10.3.9 I C interface characteristics
2
Table 44: I C characteristics
Symbol Parameter 2 2 (1) Unit
Standard mode I C Fast mode I C
tr(SDA)
SDA and SCL rise time - 1000 - 300 ns
tr(SCL)
tf(SDA)
SDA and SCL fall time - 300 - 300
tf(SCL)
(1) 2
fMASTER, must be at least 8 MHz to achieve max fast I C speed (400kHz)
(2) 2
Data based on standard I C protocol requirement, not tested in production
(3)
The maximum hold time of the start condition has only to be met if the interface does not stretch the
low time
(4)
The device must internally provide a hold time of at least 300 ns for the SDA signal in order to bridge
the undefined region of the falling edge of SCL
2
Figure 42: Typical application with I C bus and timing diagram
VDD VDD
4.7kΩ 4.7kΩ
STM8S
100Ω SDA
REPEATED
START
START
tsu(STA) tw(STO:STA)
SDA
START
ai17490
1. Measurement points are made at CMOS levels: 0.3 x VDD and 0.7 x VDD.
(1) -
VAIN Conversion voltage range VSS VDD V
(1) - -
tS Minimum sampling time fADC = 4 MHz 0.75
μs
fADC = 6 MHz - 0.5 -
14 1/fADC
(1)
During the sample time the input capacitance CAIN (3 pF max) can be charged/discharged
by the external source. The internal resistance of the analog source must allow the
capacitance to reach its final voltage level within tS. After the end of the sample time tS,
changes of the analog input voltage have no effect on the conversion result. Values for the
sample clock tS depend on programming.
(2)
|ET| Total unadjusted error fADC = 2 MHz 1.6 3.5
(2)
|EO| Offset error fADC = 2 MHz 1.1 2.5
(1)
Symbol Parameter Conditions Typ Max Unit
(2)
|EG| Gain error fADC = 2 MHz 1.5 3
(2)
|ED| Differential linearity error fADC = 2 MHz 0.7 1.5
(2)
|EL| Integral linearity error fADC = 2 MHz 0.6 1.5
(1)
Data based on characterization results, not tested in production.
(2)
ADC accuracy vs. negative injection current: Injecting negative current on any of the
analog input pins should be avoided as this significantly reduces the accuracy of the
conversion being performed on another analog input. It is recommended to add a Schottky
diode (pin to ground) to standard analog pins which may potentially inject negative current.
Any positive injection current within the limits specified for IINJ(PIN) and ΣIINJ(PIN) in the I/O
port pin characteristics section does not affect the ADC accuracy.
Table 47: ADC accuracy with RAIN < 10 kΩ RAIN, VDD = 3.3 V
(1)
Symbol Parameter Conditions Typ Max Unit
(2)
|ET| Total unadjusted error fADC = 2 MHz 1.6 3.5
(2)
|EO| Offset error fADC = 2 MHz 1 2.5
(1)
Symbol Parameter Conditions Typ Max Unit
(2)
|EG| Gain error fADC = 2 MHz 1.3 3
fADC = 4 MHz 2 3
(2)
|ED| Differential linearity error fADC = 2 MHz 0.7 1
(2)
|EL| Integral linearity error fADC = 2 MHz 0.6 1.5
(1)
Data based on characterization results, not tested in production.
(2)
ADC accuracy vs. negative injection current: Injecting negative current on any of the
analog input pins should be avoided as this significantly reduces the accuracy of the
conversion being performed on another analog input. It is recommended to add a Schottky
diode (pin to ground) to standard analog pins which may potentially inject negative current.
Any positive injection current within the limits specified for IINJ(PIN) and ΣIINJ(PIN) in I/O port
pin characteristics does not affect the ADC accuracy.
VDD STM8
VT
VAIN RAIN 0.6 V
AINx 10-bit A/D
conversion
VT IL
CAIN CADC
0.6 V ± 1 µA
A device reset allows normal operations to be resumed. The test results are given in the table
below based on the EMS levels and classes defined in application note AN1709 (EMC design
guide for STMicrocontrollers).
Prequalification trials
Most of the common failures (unexpected reset and program counter corruption) can be
recovered by applying a low state on the NRST pin or the oscillator pins for 1 second.
To complete these trials, ESD stress can be applied directly on the device, over the range of
specification values. When unexpected behavior is detected, the software can be hardened
to prevent unrecoverable errors occurring. See application note AN1015 (Software techniques
for improving microcontroller EMC performance).
(1)
Data obtained with HSI clock configuration, after applying HW recommendations described
in AN2860 (EMC guidelines for STM8S microcontrollers).
Conditions
(1)
Max fHSE/fCPU
Symbol Parameter Unit
General Monitored
conditions frequency band 16 MHz/ 16 MHz/
8 MHz 16 MHz
Conditions
(1)
Max fHSE/fCPU
Symbol Parameter Unit
General Monitored
conditions frequency band 16 MHz/ 16 MHz/
8 MHz 16 MHz
SAE EMI
SAE EMI level 2.5 2.5
level
(1)
Data based on characterisation results, not tested in production.
VESD(HBM)
Electrostatic discharge TA = 25°C, conforming to
voltage JESD22-A114 A 4000
(Human body model)
V
VESD(CDM)
Electrostatic discharge TA LQFP32 package =
voltage 25°C, conforming to IV 1000
(Charge device model) SD22-C101
(1)
Data based on characterization results, not tested in production
This test conforms to the EIA/JESD 78 IC latch-up standard. For more details, refer to the
application note AN1181.
TA = 25 °C A
TA = 125 °C A
(1)
Class description: A Class is an STMicroelectronics internal specification. All its limits
are higher than the JEDEC specifications, that means when a device belongs to class A it
exceeds the JEDEC standard. B class strictly covers all the JEDEC criteria (international
standard).
11 Package information
In order to meet environmental requirements, ST offers these devices in different grades of
® ®
ECOPACK packages, depending on their level of environmental compliance. ECOPACK
®
specifications, grade definitions and product status are available at: www.st.com. ECOPACK
is an ST trademark.
ccc C
D
D1
D3 A
A2
24 17
16
25 L1
b
E3 E1 E
32
9
L
Pin 1 A1 K
identification 1 8 c
5V_ME
Table 52: 32-pin low profile quad flat package mechanical data
(1)
Dim. mm inches
A 1.600 0.0630
(1)
Dim. mm inches
D3 5.600 0.2205
E3 5.600 0.2205
e 0.800 0.0315
L1 1.000 0.0394
(1)
Values in inches are converted from mm and rounded to 4 decimal digits
AOB8_ME
Table 53: 32-lead, ultra thin, fine pitch quad flat no-lead package mechanical data
(1)
Dim. mm inches
A3 0.200 0.0079
(1)
Dim. mm inches
e 0.500 0.0197
(1)
Values in inches are converted from mm and rounded to 4 decimal digits.
Pin 1 E
TOP VIEW
L1
D ddd
L4
e
10 A3
L2
5 11 e
b
E
1 15
20 16
L3 A1
A
BOTTOM VIEW
SIDE VIEW
103_A0A5_ME
Table 54: 20-lead, ultra thin, fine pitch quad flat no-lead package (3 x 3) package
mechanical data
(1)
Dim. mm inches
Min Typ Max Min Typ Max
D 3.000 0.1181
E 3.000 0.1181
A3 0.152 0.0060
e 0.500 0.0197
L3 0.150 0.0059
L4 0.200 0.0079
(1)
Values in inches are converted from mm and rounded to 4 decimal digits.
Table 55: 32-lead shrink plastic DIP (400 ml) package mechanical data
(1)
Dim. mm inches
A1 0.508 0.0200
(1)
Dim. mm inches
e 1.778 0.0700
eA 10.160 0.4000
eB 12.700 0.5000
(1)
Values in inches are converted from mm and rounded to 4 decimal digits
20 11
c
E1 E
1 10
aaa CP
A1 L
A A2
L1
b e
YA_ME
A 1.200 0.0472
e 0.650 0.0256
L1 1.000 0.0394
(1)
Dim. mm inches
(1)
Values in inches are converted from mm and rounded to 4 decimal digits
D
20 11 h x 45°
C
E H
1 10
ddd
B e A1
A1 k L
Z7_ME
Table 57: 20-lead, plastic small outline (300 mils) mechanical data
(1)
Dim. mm inches
e 1.270 0.0500
(1)
Dim. mm inches
(1)
Values in inches are converted from mm and rounded to 4 decimal digits
0.5mm
0.8mm
[0.032"]
4mm
[0.157"]
0.5mm
4mm [0.157"]
ai15319
Bottom view
12 Thermal characteristics
The maximum chip junction temperature (TJ max) must never exceed the values given in
Operating conditions.
The maximum chip-junction temperature, TJmax, in degrees Celsius, may be calculated using
the following equation:
TJmax = TAmax + (PDmax x ΘJA)
Where:
• TAmax is the maximum ambient temperature in °C
• Θ is the package junction-to-ambient thermal resistance in °C/W
JA
• Ppower. is the product of I andV , expressed in Watts. This is the maximum chip internal
INTmax DD DD
Where: PI/Omax =Σ (VOL*IOL) + Σ((VDD-VOH)*IOH), taking into account the actual VOL/IOL and
VOH/IOH of the I/Os at low and high level in the application.
(1)
Thermal resistances are based on JEDEC JESD51-2 with 4-layer PCB in a natural
convection environment.
• Maximum 20 I/Os used at the same time in output at low level with
IOL = 8 mA, VOL= 0.4 V
PINTmax = 8 mA x 5 V = 400 mW
Amax
• PDmax = 400 mW + 64 mW
Thus: PDmax = 464 mW
TJmax for LQFP32 can be calculated as follows, using the thermal resistance ΘJA:
TJmax = 75 °C + (60 °C/W x 464 mW) = 75 °C + 27.8 °C = 102.8 °C
This is within the range of the suffix 6 version parts (-40 < TJ < 105 °C).
In this case, parts must be ordered at least with the temperature range suffix 6.
13 Ordering information
Figure 53: STM8S103x access line ordering information scheme
Product class
STM8 microcontroller
Family type
S = Standard
Sub-family type
10x = Access line
103 sub-family
Pin count
K = 32 pins
F = 20 pins
Package type 1
B = SDIP
T = LQFP
U = UFQFPN
P = TSSOP
M = SO
Temperature range
3 = -40 °C to 125 °C
6 = -40 °C to 85 °C
Package pitch
Blank = 0.5 or 0.65 mm(2)
C = 0.8 mm(3)
Packing
No character = Tray or tube
TR = Tape and reel
1. A dedicated ordring information scheme will be released if, in the future, memory
programming service (FastROM) is required The letter "P" will be added after STM8S.
Three unique letters identifying the customer application code will also be visible in the
codification. Example: STM8SP103K3MACTR.
2. UFQFPN, TSSOP, and SO packages.
3. LQFP package.
For a list of available options (e.g. memory size, package) and orderable part numbers or for
further information on any aspect of this device, please go to www.st.com or contact the ST
Sales Office nearest to you.
Customer .............................................................................................
Address .............................................................................................
Contact .............................................................................................
Phone no. .............................................................................................
a
Reference FASTROM code .............................................................................................
Temperature range
[ ] -40°C to +85°C or [ ] -40°C to +125°C
Padding value for unused program memory (check only one option)
a
FASTROM code name is assigned by STMicroelectronics.
UBC, bit0
[ ] 0: Reset
[ ] 1: Set
UBC bit1
[ ] 0: Reset
[ ] 1: Set
UBC bit2
[ ] 0: Reset
[ ] 1: Set
UBC bit3
[ ] 0: Reset
[ ] 1: Set
UBC bit4
[ ] 0: Reset
[ ] 1: Set
UBC bit5
[ ] 0: Reset
[ ] 1: Set
UBC bit6
[ ] 0: Reset
[ ] 1: Set
UBC bit7
[ ] 0: Reset
[ ] 1: Set
AFR0 Reserved
AFR1
[ ] 0: Remapping option inactive. Default alternate functions
(check only one option) used. Refer to pinout description
[ ] 1: Port A3 alternate function = SPI_NSS and port D2
alternate function = TIM2_CH3
AFR2 Reserved
AFR3 Reserved
AFR4 Reserved
AFR5
[ ] 0: Remapping option inactive. Default alternate functions
(check only one option) used. Refer to pinout description
[ ] 1: Port D0 alternate function = CLK_CCO
AFR6
[ ] 0: Remapping option inactive. Default alternate functions
(check only one option) used. Refer to pinout description
[ ] 1: Port D7 alternate function = TIM1_CH4
AFR7 Reserved
AFR0
[ ] 0: Remapping option inactive. Default alternate functions
(check only one option) used. Refer to pinout description
[ ] 1: Port C5 alternate function = TIM2_CH1, port C6 alternate
function = TIM1_CH1, and port C7 alternate function =
TIM1_CH2
AFR1
[ ] 0: Remapping option inactive. Default alternate functions
(check only one option) used. Refer to pinout description
[ ] 1: Port A3 alternate function = SPI_NSS and port D2 alternate
function = TIM2_CH3
AFR2
Reserved
AFR3
[ ] 0: Remapping option inactive. Default alternate functions
(check only one option) used. Refer to pinout description
[ ] 1: Port C3 alternate function = TLI
AFR4
[ ] 0: Remapping option inactive. Default alternate functions
(check only one option) used. Refer to pinout description
[ ] 1: Port B4 alternate function = ADC_ETR and port B5 alternate
function = TIM1_BKIN
AFR5 Reserved
AFR6 Reserved
AFR7
[ ] 0: Remapping option inactive. Default alternate functions
(check only one option) used. Refer to pinout description
[ ] 1: Port C3 alternate function = TIM1_CH1N and port C4
alternate function = TIM1_CH2N
OPT3 watchdog
WWDG_HALT
[ ] 0: No reset generated on halt if WWDG active
WWDG_HW
[ ] 0: WWDG activated by software
(check only one option)
[ ] 1: WWDG activated by hardware
IWDG_HW
[ ] 0: IWDG activated by software
(check only one option)
[ ] 1: IWDG activated by hardware
LSI_EN
[ ] 0: LSI clock is not available as CPU clock source
(check only one option)
[ ] 1: LSI clock is available as CPU clock source
HSITRIM
[ ] 0: 3-bit trimming supported in CLK_HSITRIMR register
(check only one option)
[ ] 1: 4-bit trimming supported in CLK_HSITRIMR register
OPT4 wakeup
PRSC
[ ] for 16 MHz to 128 kHz prescaler
(check only one option)
[ ] for 8 MHz to 128 kHz prescaler
[ ] for 4 MHz to 128 kHz prescaler
CKAWUSEL
[ ] LSI clock source selected for AWU
(check only one option)
[ ] HSE clock with prescaler selected as clock source for
for AWU
EXTCLK
[ ] External crystal connected to OSCIN/OSCOUT
(check only one option)
[ ] External clock signal on OSCIN
OPT6 is reserved
Comments: ...........................................................................................................
Supply operating range ...........................................................................................................
in the application:
Notes: ...........................................................................................................
Date: ...........................................................................................................
Signature: ...........................................................................................................
15 Revision history
Table 59: Document revision history
1
02-Mar-2009 Initial revision
2
10-Apr-2009 Added Table 2: Peripheral clock gating bit assignments in
CLK_PCKENR1/2 registers.
Updated Auto wakeup counter.
Modified description of PB4 and PB5 (removed X in PP column)
and added footnote concerning HS I/Os in VFQFPN32/LQFP32
pin description and STM8S103Kx UFQFPN32/LQFP32/SDIP32
pinout and pin description.
Removed TIM3 and UART from Table 10: Interrupt mapping.
Updated VCAP specifications in VCAP external capacitor.
Corrected block size in Table 37: Flash program memory/data
EEPROM memory.
Updated Electrical characteristics.
Updated Table 58: Thermal characteristics.
3
10-Jun-2009 Document status changed from “preliminary data” to
“datasheet”.
Replaced WFQFPN20 package with UFQFPN package.
Replaced ‘VFQFN’ with ‘VFQFPN’.
Added bullet point on the unique identifier to Features.
Updated Auto wakeup counter.
Updated wpu and PP status of PB5/12C_SDA and
PB4/12C_SCL pins in VFQFPN32/LQFP32 pin description and
STM8S103Fx TSSOP20/SO20/UFQFPN20 pin description.
Removed Table 7: Pin-to-pin comparison of pin 7 to 12 in 32-pin
access line devices.
Updated Figure 7: Memory map.
Updated reset status of port D CR1 register in Table 7: I/O port
hardware register map.
Updated alternate function remapping descriptions in Table
13: STM8S103K alternate function remapping bits for 32-pin
devices and Table 14: STM8S103F alternate function
remapping bits for 20-pin devices.
Added Unique ID.
4
16-Oct-2009 Replaced VFQFPN32 package by UFQFPN32 package.
Clock controller: replaced "TIM2" and "TIM3" with "reserved"
and "TIM2" respectively in "Peripheral clock gating bit
assignments in CLK_PCKENR1/2 registers" table.
Total current consumption in halt mode: changed the maximum
current consumption limit at 125 °C (and VDD = 5 V) from 35
µA to 55 µA.
Functional EMS (electromagnetic susceptibility) : "ESD"
changed to "FESD" (functional); added name of AN1709;
replaced "IEC 1000" with "IEC 61000".
Designing hardened software to avoid noise problems: replaced
"IEC 1000" with "IEC 61000", added title of AN1015, and added
footnote to EMS data table.
Electromagnetic interference (EMI): replaced "J 1752/3" with
"IEC 61967-2" and updated data of the EMI data table.
Selecting the product temperature range: changed the value
of LQFP32 7x7 mm thermal resistance from 59 °C/W to 60
°C/W.
Added STM8S103 FASTROM microcontroller option list.
22-Apr-2010 5
Added VFQFPN32 and SO20 packages.
Updated Px_IDR reset value in Table 7: I/O port hardware
register map.
Operating conditions: updated VCAP and ESR low limit, added
ESL parameter, and Note 1 below Table 19: General operating
conditions.
Updated ACCHSI in Table 34: HSI oscillator characteristics
table. Modified IDD(H) in Table 27: Total current consumption
in halt mode at VDD = 5 V and Table 28: Total current
consumption in halt mode at VDD = 3.3 V. Removed note 3
related to Accuracy of HSI oscillator.
09-Sep-2010 6
Removed VFQFPN32 package.
Removed internal reference voltage from Analog-to-digital
converter (ADC1).
Updated "reset state" of Table 4: Legend/abbreviations for
pinout tables in Pinout and pin description.
Added footnote to PD1/SWIM pin in STM8S103Kx
UFQFPN32/LQFP32/SDIP32 pinout and pin description.
Updated pins 14 and 19 (TSSOP20/SO20) / pins 11 and 16
(UFQFPN20) in STM8S103Fx TSSOP20/SO20/UFQFPN20
pin description.
General hardware register map : Standardized all reset state
values; updated the reset state values of the RST_SR,
CLK_SWCR, CLK_HSITRIMR, CLK_SWIMCCR, IWDG_KR,
and ADC_DRx registers in the "General hardware register
map" table.
Updated AFR2 description of OPT 2 in Table 14: STM8S103F
alternate function remapping bits for 20-pin devices.
Replaced 0.01 µF with 0.1 µf in Figure 38: Recommended
reset pin protection.
2
Added "Typical application with I C bus and timing diagram in
I2C interface characteristics.
Updated footnote 1 in Table 46: ADC accuracy with RAIN <
10 kΩ , VDD= 5 V and Table 47: ADC accuracy with RAIN <
10 kΩ RAIN, VDD = 3.3 V .
STM8S103 FASTROM microcontroller option list: updated
"special marking" section and AFR2 description of OPT2
alternate function remapping for STM8S103F.
32-lead UFQFPN package mechanical data: updated existing
footnote and added three additional footnotes.
12-Jul-2011 7
Updated note related to true open-drain outputs in Table 6:
STM8S103Fx pin description.
Remove CLK_CANCCR register from Table 8: General
hardware register map
04-Apr-2012 8
Updated notes related to VCAP in Table 19: General operating
conditions.
Added values of tR/tF for 50 pF load capacitance, and updated
note in Table 38: I/O static characteristics.
Updated typical and maximum values of RPU in Table 38: I/O
static characteristics and Table 42: NRST pin characteristics.
Changed SCK input to SCK output in SPI serial peripheral
interface
Modified Figure 47: 20-lead, ultra thin, fine pitch quad flat
no-lead package outline (3 x 3)to add package top view.
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries
(“ST”) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products
and services described herein at anytime, without notice.
All ST products are sold pursuant to ST’s terms and conditions of sale.
Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein,
and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described
herein.
No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document.
If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for
the use of such third party products or services, or any intellectual property contained therein or considered as a warranty
covering the use in any manner whatsoever of such third party products or services or any intellectual property contained
therein.
UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS
OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT
LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND
THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT,
COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document
shall immediately voidany warranty granted by ST for the ST product or service described herein and shall not create or
extend in any manner whatsoever, any liability of ST.
Information in this document supersedes and replaces all information previously supplied.
The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.
Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel
- Italy - Japan - Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom -
United States of America
www.st.com