Table 18.Total current consumption with code execution in run mode at V
Table 19.Total current consumption with code execution in run mode at V
Table 20.Total current consumption in wait mode at V
Table 21.Total current consumption in wait mode at V
Table 22.Total current consumption in active halt mode at V
Table 23.Total current consumption in active halt mode at V
Table 24.Total current consumption in halt mode at V
Table 25.Total current consumption in halt mode at V
Figure 14.Typical HSI frequency variation vs V
Figure 15.Typical LSI frequency variation vs V
Figure 16.Typical V
Figure 17.Typical pull-up resistance vs V
Figure 18.Typical pull-up current vs V
Figure 19.Typ. V
Figure 20.Typ. V
Figure 21.Typ. V
Figure 22.Typ. V
Figure 23.Typ. V
Figure 24.Typ. V
Figure 25.Typ. V
Figure 26.Typ. V
Figure 27.Typ. V
Figure 28.Typ. V
Figure 29.Typical NRST V
Figure 30.Typical NRST pull-up resistance vs V
Figure 31.Typical NRST pull-up current vs V
This datasheet contains the description of the STM8S007xx value line 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 and STM8A microcontroller families reference
manual (RM0016).
●For information on programming, erasing and protection of the internal Flash memory
please refer to the PM0051 (How to program STM8S and STM8A Flash program
memory and data EEPROM).
●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).
8/90Doc ID 022171 Rev 3
STM8S007C8Description
2 Description
The STM8S007xx value line 8-bit microcontrollers offer 64 Kbytes Flash program memory.
They are referred to as high-density devices in the STM8S microcontroller family reference
manual.
All devices of the STM8S007xx value line provide the following benefits: reduced system
cost, performance robustness, short development cycles, and product longevity.
The system cost is reduced thanks to a true data EEPROM for up to 100 k write/erase
cycles and a high system integration level with internal clock oscillators, watchdog, and
brown-out reset.
Device performance is ensured by 20 MIPS at 24 MHz CPU clock frequency and enhanced
characteristics which include robust I/O, independent watchdogs (with a separate clock
source), and a clock security system.
Short development cycles are guaranteed due to application scalability across a common
family product architecture with compatible pinout, memory map and modular peripherals.
Full documentation is offered with a wide choice of development tools.
Product longevity is ensured in the STM8S family thanks to their advanced core which is
made in a state-of-the art technology for applications with 2.95 V to 5.5 V operating supply.
Table 1.STM8S007xx value line features
FeaturesSTM8S007C8
Pin count48
Max. number of GPIOs (I/O)38
External interrupt pins35
Timer CAPCOM channels9
Timer complementary outputs3
A/D converter channels10
HIgh sink I/Os16
High density Flash program memory 64 Kbytes
Data EEPROM128 bytes
RAM6 Kbytes
Doc ID 022171 Rev 39/90
Block diagramSTM8S007C8
XTAL 1-24 MHz
RC int. 16 MHz
RC int. 128 kHz
STM8 core
Debug/SWIM
I
2
C
SPI
UART1
UART3
AWU ti mer
Reset block
Reset
POR
BOR
Clock controller
Detector
Clock to peripherals and core
10 Mbit/s
LIN master
16 channels
Address and data bus
Window WDG
64 Kbytes high
128 bytes
6 Kbytes RAM
Boot ROM
ADC2
Reset
400 Kbit/s
Master/slave
Single wire
autosynchro
debug interf.
SPI emul.
density program Flash
data EEPROM
16-bit general purpose
16-bit advanced control
timer (TIM1)
timers (TIM2, TIM3)
8-bit basic timer
(TIM4)
Beeper
1/2/4 kHz
beep
Independent WDG
4 CAPCOM
channels
Up to
5 CAPCOM
channels
Up to
+ 3 complementary
outputs
3 Block diagram
Figure 1.STM8S007xx value line block diagram
10/90Doc ID 022171 Rev 3
STM8S007C8Product overview
4 Product overview
The following section intends to give an overview of the basic features of the STM8S007xx
value line functional modules and peripherals.
For more detailed information please refer to the corresponding family reference manual
(RM0016).
4.1 Central processing unit STM8
The 8-bit STM8 core is designed for code efficiency and performance.
It contains 6 internal registers which are directly addressable in each execution context, 20
addressing modes including indexed indirect and relative addressing and 80 instructions.
Architecture and registers
●Harvard architecture
●3-stage pipeline
●32-bit wide program memory bus - single cycle fetching for most instructions
●X and Y 16-bit index registers - enabling indexed addressing modes with or without
offset and read-modify-write type data manipulations
●8-bit accumulator
●24-bit program counter - 16-Mbyte linear memory space
●16-bit stack pointer - access to a 64 K-level stack
●8-bit condition code register - 7 condition flags for the result of the last instruction
Addressing
●20 addressing modes
●Indexed indirect addressing mode for look-up tables located anywhere in the address
space
●Stack pointer relative addressing mode for local variables and parameter passing
Instruction set
●80 instructions with 2-byte average instruction size
●Standard data movement and logic/arithmetic functions
●8-bit by 8-bit multiplication
●16-bit by 8-bit and 16-bit by 16-bit division
●Bit manipulation
●Data transfer between stack and accumulator (push/pop) with direct stack access
●Data transfer using the X and Y registers or direct memory-to-memory transfers
Doc ID 022171 Rev 311/90
Product overviewSTM8S007C8
4.2 Single wire interface module (SWIM) and debug module (DM)
The single wire interface module and debug module permits non-intrusive, real-time incircuit 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 realtime 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)
●Nested interrupts with three software priority levels
●32 interrupt vectors with hardware priority
●Up to 33 external interrupts on six vectors including TLI
●Trap and reset interrupts
4.4 Flash program and data EEPROM memory
●64 Kbytes of high density Flash program single voltage Flash memory
●128 bytes true data EEPROM
●Read while write: Writing in data memory possible while executing code in program
memory.
●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 Figure 2.
12/90Doc ID 022171 Rev 3
STM8S007C8Product overview
Programmable area from 1 Kbyte
Data
UBC area
Program memory area
Data memory area (up to 2 Kbytes)
(2 first pages) up to 64 Kbytes
EEPROM
Remains write protected during IAP
memory
64 Kbytes
Flash
Write access possible for IAP
program
memory
(1 page steps)
Option bytes
The size of the UBC is programmable through the UBC option byte (Ta b le 1 2), in increments
of 1 page (512 bytes) by programming the UBC option byte in ICP mode.
This divides the program memory into two areas:
●Main program memory: 64 Kbytes minus UBC
●User-specific boot code (UBC): Configurable up to 64 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 organisation
Read-out protection (ROP)
The read-out protection blocks reading and writing the Flash program memory and data
EEPROM memory in ICP mode (and debug mode). Once the read-out protection is
activated, any attempt to toggle its status triggers a global erase of the program and data
memory. Even if no protection can be considered as totally unbreakable, the feature
provides a very high level of protection for a general purpose microcontroller.
Doc ID 022171 Rev 313/90
Product overviewSTM8S007C8
4.5 Clock controller
The clock controller distributes the system clock (f
MASTER)
coming from different oscillators
to the core and the peripherals. It also manages clock gating for low power modes and
ensures clock robustness.
Features
●Clock prescaler: To get the best compromise between speed and current
consumption the clock frequency to the CPU and peripherals can be adjusted by a
programmable prescaler.
●Safe clock switching: Clock sources can be changed safely on the fly in run mode
through a configuration register. 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 sources: Four different clock sources can be used to drive the master
clock:
–1-24 MHz high-speed external crystal (HSE)
–Up to 24 MHz high-speed user-external clock (HSE user-ext)
–16 MHz high-speed internal RC oscillator (HSI)
–128 kHz low-speed internal RC (LSI)
●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 main clock output (CCO): This outputs an external clock for use by the
application.
Table 2.Peripheral clock gating bit assignments in CLK_PCKENR1/2 registers
For efficent power management, the application can be put in one of four different low-power
modes. You can configure each mode to obtain the best compromise between lowest power
consumption, fastest start-up time and available wakeup sources.
●Wait mode: In this mode, the CPU is stopped, but peripherals are kept running. The
wakeup is performed by an internal or external interrupt or reset.
●Active halt mode with regulator on: In this mode, the CPU and peripheral clocks are
stopped. An internal wakeup is generated at programmable intervals by the auto wake
up unit (AWU). The main voltage regulator is kept powered on, so current consumption
is higher than in active halt mode with regulator off, but the wakeup time is faster.
Wakeup is triggered by the internal AWU interrupt, external interrupt or reset.
●Active halt mode with regulator off: This mode is the same as active halt with
regulator on, except that the main voltage regulator is powered off, so the wake up time
is slower.
●Halt mode: In this mode the microcontroller uses the least power. The CPU and
peripheral clocks are stopped, the main voltage regulator is powered off. Wakeup is
triggered by external event or reset.
4.7 Watchdog timers
The watchdog system is based on two independent timers providing maximum security to
the applications.
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.
Window watchdog timer
The window watchdog is used to detect the occurrence of a software fault, usually
generated by external interferences or by unexpected logical conditions, which cause the
application program to abandon its normal sequence.
The window function can be used to trim the watchdog behavior to match the application
perfectly.
The application software must refresh the counter before time-out and during a limited time
window.
A reset is generated in two situations:
1.Timeout: At 16 MHz CPU clock the time-out period can be adjusted between 75 µs up
to 64 ms.
2. Refresh out of window: The downcounter is refreshed before its value is lower than the
one stored in the window register.
Doc ID 022171 Rev 315/90
Product overviewSTM8S007C8
Independent watchdog timer
The independent watchdog peripheral can be used to resolve processor malfunctions due to
hardware or software failures.
It is clocked by the 128 kHZ LSI internal RC clock source, and thus stays active even in case
of a CPU clock failure
The IWDG time base spans from 60 µs to 1 s.
4.8 Auto wakeup counter
●Used for auto wakeup from active halt mode
●Clock source: Internal 128 kHz internal low frequency RC oscillator or external clock
●LSI clock can be internally connected to TIM3 input capture channel 1 for calibration
4.9 Beeper
The beeper function outputs a signal on the BEEP pin for sound generation. The signal is in
the range of 1, 2 or 4 kHz.
4.10 TIM1 - 16-bit advanced control timer
This is a high-end timer designed for a wide range of control applications. With its
complementary outputs, dead-time control and center-aligned PWM capability, the field of
applications is extended to motor control, lighting and half-bridge driver
●16-bit up, down and up/down autoreload counter with 16-bit prescaler
●Four independent capture/compare channels (CAPCOM) configurable as input
capture, output compare, PWM generation (edge and center aligned mode) and single
pulse mode output
●Synchronization module to control the timer with external signals
●Break input to force the timer outputs into a defined state
●Three complementary outputs with adjustable dead time
●Encoder mode
●Interrupt sources: 3 x input capture/output compare, 1 x overflow/update, 1 x break
4.11 TIM2, TIM3 - 16-bit general purpose timers
●16-bit autoreload (AR) up-counter
●15-bit prescaler adjustable to fixed power of 2 ratios 1…32768
●Timers with 3 or 2 individually configurable capture/compare channels
●PWM mode
●Interrupt sources: 2 or 3 x input capture/output compare, 1 x overflow/update
16/90Doc ID 022171 Rev 3
STM8S007C8Product overview
4.12 TIM4 - 8-bit basic timer
●8-bit autoreload, adjustable prescaler ratio to any power of 2 from 1 to 128
●Clock source: CPU clock
●Interrupt source: 1 x overflow/update
Table 3.TIM timer features
Counter
Timer
TIM1 16Any integer from 1 to 65536Up/down43Yes
TIM2 16Any power of 2 from 1 to 32768Up30No
TIM316Any power of 2 from 1 to 32768Up20No
TIM48Any power of 2 from 1 to 128Up00No
size
(bits)
Prescaler
Counting
mode
CAPCOM
channels
Complem.
outputs
4.13 Analog-to-digital converter (ADC2)
STM8S007xx value lineproducts contain a 10-bit successive approximation A/D converter
(ADC2) with up to 10 multiplexed input channels and the following main features:
●Input voltage range: 0 to V
●
Conversion time: 14 clock cycles
●Single and continuous modes
●External trigger input
●Trigger from TIM1 TRGO
●End of conversion (EOC) interrupt
DDA
Ext.
trigger
Timer
synchr-
onization/
chaining
No
4.14 Communication interfaces
The following communication interfaces are implemented:
2. (T) True open drain (P-buffer and protection diode to V
3. [ ] alternate function remapping option (If the same alternate function is shown twice, it indicates an exclusive choice not a
duplication of the function).
Doc ID 022171 Rev 321/90
not implemented).
DD
Pinouts and pin descriptionSTM8S007C8
Table 4.Legend/abbreviations for LQFP48 pin description table
Typ eI = input, O = output, S = power supply
floating
Input
wpu = weak pull-up
Ext. interrupt = external interrupt
HS = high sink
O1 = Slow (up to 2 MHz)
Speed
O3 = Fast/slow programmability with slow as default state after reset
Output
O4 = Fast/slow programmability with fast as default state after reset
OD = open drain
PP = push pull
Reset stateBold 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.
Table 5.LQFP48 pin description
InputOutput
Default
Pin number
Pin name
Typ e
wpu
floating
Ext. interrupt
High sink
OD
Speed
PP
Main function
alternate
function
(after reset)
1NRSTI/OXReset
2PA1/OSCINI/O XXO1XXPort A1
3PA2/OSCOUTI/O X
4V
SSIO_1
5V
SS
SI/O ground
SDigital ground
XXO1XXPort A2
Resonator/
crystal in
Resonator/
crystal out
6VCAPS1.8 V regulator capacitor
Alternate
function
after remap
[option bit]
7V
DD
8V
DDIO_1
SDigital power supply
SI/O power supply
9PA3/TIM2_CH3I/O XXXO1XXPort A3
(1)
10PA4/UART1_RX
I/O XXXHSO3XXPort A4 UART1 receive
11PA5/UART1_TXI/O XXXHSO3XXPort A5
12PA6/UART1_CKI/O X
13V
DDA
SAnalog power supply
XXHSO3XXPort A6
22/90Doc ID 022171 Rev 3
Timer 2 channel3
UART1
transmit
UART1
synchronous
clock
TIM3_CH1
[AFR1]
STM8S007C8Pinouts and pin description
Table 5.LQFP48 pin description (continued)
InputOutput
Alternate
function
after remap
[option bit]
Pin number
14V
Pin name
SSA
Typ e
wpu
floating
Speed
High sink
Ext. interrupt
OD
PP
Main function
SAnalog ground
15PB7/AIN7I/O XXXO1XXPort B7
Default
alternate
function
(after reset)
Analog
input 7
16PB6/AIN6I/O X
17PB5/AIN5I/O X
18PB4/AIN4I/O X
19PB3/AIN3I/O X
XXO1XXPort B6
XXO1XXPort B5
XXO1XXPort B4
XXO1XXPort B3
20PB2/AIN2I/O XXXO1XXPort B2
21PB1/AIN1I/O X
22PB0/AIN0I/O X
23PE7/AIN8I/O X
24PE6/AIN9I/O X
25PE5/SPI_NSSI/O X
26PC1/TIM1_CH1I/O X
27PC2/TIM1_CH2I/O X
XXO1XXPort B1
XXO1XXPort B0
XXO1XXPort E7 Analog input 8
XXO1XXPort E6 Analog input 9
XXO1XXPort E5
XXHSO3XXPort C1
XXHSO3XXPort C2
Analog
input 6
Analog
input 5
Analog
input 4
Analog
input 3
Analog
input 2
Analog
input 1
Analog
input 0
SPI
master/slave
select
Timer 1 channel 1
Timer 1channel 2
2
C_SDA
I
[AFR6]
2
C_SCL
I
[AFR6]
TIM1_ETR
[AFR5]
TIM1_
CH3N
[AFR5]
TIM1_
CH2N
[AFR5]
TIM1_
CH1N
[AFR5]
28PC3/TIM1_CH3I/O X
29PC4/TIM1_CH4I/O X
30PC5/SPI_SCKI/O X
31V
32V
SSIO_2
DDIO_2
SI/O ground
SI/O power supply
XXHSO3XXPort C3
XXHSO3XXPort C4
Timer 1 channel 3
Timer 1 channel 4
XXHSO3XXPort C5 SPI clock
Doc ID 022171 Rev 323/90
Pinouts and pin descriptionSTM8S007C8
Table 5.LQFP48 pin description (continued)
InputOutput
Alternate
function
after remap
[option bit]
Pin name
Pin number
Typ e
wpu
floating
Speed
High sink
Ext. interrupt
OD
PP
Main function
33PC6/SPI_MOSII/O XXXHSO3XXPort C6
Default
alternate
function
(after reset)
SPI master
out/
slave in
34PC7/SPI_MISOI/O XXXHSO3XXPort C7
35PG0 I/O XXO1XXPort G0
36PG1 I/O X
XO1XXPort G1
37PE3/TIM1_BKINI/O XXX O1XXPort E3
38PE2/I
39PE1/I
2
C_SDAI/O XXO1T
2
C_SCLI/O XXO1T
(2)
(2)
Port E2 I2C data
Port E1 I2C clock
40PE0/CLK_CCOI/O XXXHSO3XXPort E0
41PD0/TIM3_CH2I/O X
42PD1/SWIM
(3)
I/O XXXHSO4X XPort D1
43PD2/TIM3_CH1I/O X
44PD3/TIM2_CH2I/O X
PD4/TIM2_CH1/B
45
EEP
I/O X
46PD5/ UART3_TXI/O X
47
PD6/
UART3_RX
(1)
I/O XXXO1XXPor t D6
XXHSO3XXPort D0
XXHSO3XXPort D2
XXHSO3XXPort D3
XXHSO3XXPort D4
XXO1XXPort D5
SPI master in/
slave out
Timer 1 break input
Configurable
clock output
Timer 3 channel 2
SWIM data
interface
Timer 3 channel 1
Timer 2 channel 2
Timer 2 channel 1
UART3 data
transmit
UART3 data
receive
TIM1_BKIN
[AFR3]/
CLK_CCO
[AFR2]
TIM2_CH3
[AFR1]
ADC_ETR
[AFR0]
BEEP output
[AFR7]
48PD7/TLII/O X
1. The default state of UART1_RX and UART3_RX pins is controlled by the ROM bootloader. These pins are
pulled up as part of the bootloader activation process and returned to the floating state before a return from
the bootloader.
2. In the open-drain output column, ‘T’ defines a true open-drain I/O(P-buffer, weak pull-up, and protection
diode to V
3. The PD1 pin is in input pull-up during the reset phase and after the internal reset release.
are not implemented).
DD
XXO1XXPort D7
Top lev e l
interrupt
Note:The slope control of true open drain pins cannot be programmed and by default is limited to
2 MHz.
24/90Doc ID 022171 Rev 3
STM8S007C8Pinouts and pin description
5.1 Alternate function remapping
As shown in the rightmost column of the pin description table, some alternate functions can
be remapped at different I/O ports by programming one of eight AFR (alternate function
remap) option bits. Refer to Section 8: Option bytes. When the remapping option is active,
the default alternate function is no longer available.
To use an alternate function, the corresponding peripheral must be enabled in the peripheral
registers.
Alternate function remapping does not effect GPIO capabilities of the I/O ports (see the
GPIO section of the family reference manual, RM0016).
Doc ID 022171 Rev 325/90
Memory and register mapSTM8S007C8
0x0 0 000 0
0x
00 17 FF
0x
00 180 0
0x
00 400 0
0x
00 3F FF
0x
00 407F
0x
00 4080
0x
00 47FF
0x
00 480 0
0x
00 4 87F
0x
00 490 0
0x
00 500 0
0x
00 4F FF
0x
00 57 FF
0x
00 580 0
0x
00 600 0
0x
00 5F FF
0x
00 67 FF
0x
00 680 0
0x
00 7EFF
0x
00 7 F0 0
0x
00 7F FF
0x
00 800 0
0x
00 808 0
0x
00 8 07F
0 x01 7FFF
MS19412V1
(see Table 8 and Table 9)
GPIO and peripheral registers
Reserved
Reserved
Reserved
Reserved
Reserved
1024 bytes stack
128 bytes data EEPROM
Option bytes
RAM
(6 Kbytes)
2 Kbytes boot ROM
CPU/SWIM/debug/ITC
register (see Table 10)
32 interrupt vectors
Flash program memory
(64 Kbytes)
6 Memory and register map
6.1 Memory map
Figure 4.Memory map
26/90Doc ID 022171 Rev 3
STM8S007C8Memory and register map
Ta bl e 6 lists the boundary addresses for each memory size. The top of the stack is at the
RAM end address in each case.
Table 6.Flash, Data EEPROM and RAM boundary addresses
Memory areaSize (bytes)Start addressEnd address
Flash program memory64 K0x00 80000x01 7FFF
RAM6 K0x00 00000x00 17FF
Data EEPROM1280x00 40000x00 407F
6.2 Register map
Table 7.I/O port hardware register map
AddressBlockRegister labelRegister name
0x00 5000
PA_ODRPort A data output latch register0x00
Reset
status
0x00 5001PA_IDRPort A input pin value register0x00
0x00 5002PA_DDRPort A data direction register0x00
Por t A
0x00 5003PA_CR1Port A control register 10x00
0x00 5004PA_CR2Port A control register 20x00
0x00 5005
PB_ODRPort B data output latch register0x00
0x00 5006PB_IDRPort B input pin value register0x00
0x00 5007PB_DDRPort B data direction register0x00
Por t B
0x00 5008PB_CR1Port B control register 10x00
0x00 5009PB_CR2Port B control register 20x00
0x00 500A
PC_ODRPort C data output latch register0x00
0x00 500BPB_IDRPort C input pin value register0x00
0x00 500CPC_DDRPort C data direction register0x00
Por t C
0x00 500DPC_CR1Port C control register 10x00
0x00 500EPC_CR2Port C control register 20x00
0x00 500F
PD_ODRPort D data output latch register0x00
0x00 5010PD_IDRPort D input pin value register0x00
0x00 5011PD_DDRPort D data direction register0x00
Por t D
0x00 5012PD_CR1Port D control register 10x02
0x00 5013PD_CR2Port D control register 20x00
Doc ID 022171 Rev 327/90
Loading...
+ 63 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.