The ST10F276E is a derivative of the STMicroelectronics ST10 family of 16-bit single-chip
CMOS microcontrollers. It combines high CPU performance (up to 32 million instructions
per second) with high peripheral functionality and enhanced I/O-capabilities. It also provides
on-chip high-speed single voltage Flash memory, on-chip high-speed RAM, and clock
generation via PLL.
ST10F276E is processed in 0.18µm CMOS technology. The MCU core and the logic is
supplied with a 5V to 1.8V on-chip voltage regulator. The part is supplied with a single 5V
supply and I/Os work at 5V.
The device is upward compatible with the ST10F269 device, with the following set of
differences:
●Flash control interface is now based on STMicroelectronics third generation of stand-
alone Flash memories (M29F400 series), with an embedded Program/Erase Controller.
This completely frees up the CPU during programming or erasing the Flash.
●Only one supply pin (ex DC1 in ST10F269, renamed into V
is used for decoupling the internally generated 1.8V core logic supply. Do not connect
this pin to 5.0V external supply. Instead, this pin should be connected to a decoupling
capacitor (ceramic type, typical value 10nF, maximum value 100nF).
●The AC and DC parameters are modified due to a difference in the maximum CPU
frequency.
●A new V
●EA pin assumes a new alternate functionality: it is also used to provide a dedicated
power supply (see V
the main Power Supply of the device (V
V
) is turned off for low power mode, allowing data retention. V
18
pin replaces DC2 of ST10F269.
DD
) to maintain biased a portion of the XRAM (16 Kbytes) when
STBY
and consequently the internally generated
DD
the range 4.5-5.5 Volt, and a dedicated embedded low power voltage regulator is in
charge to provide the 1.8V for the RAM, the low-voltage section of the 32 kHz oscillator
and the Real-Time Clock module when not disabled. It is allowed to exceed the upper
limit up to 6V for a very short period of time during the global life of the device, and
exceed the lower limit down to 4V when RTC and 32kHz on-chip oscillator are not
used.
●A second SSC mapped on the XBUS is added (SSC of ST10F269 becomes here
SSC0, while the new one is referred as XSSC or simply SSC1). Note that some
restrictions and functional differences due to the XBUS peculiarities are present
between the classic SSC, and the new XSSC.
●A second ASC mapped on the XBUS is added (ASC0 of ST10F269 remains ASC0,
while the new one is referred as XASC or simply as ASC1). Note that some restrictions
and functional differences due to the XBUS peculiarities are present between the
classic ASC, and the new XASC.
●A second PWM mapped on the XBUS is added (PWM of ST10F269 becomes here
PWM0, while the new one is referred as XPWM or simply as PWM1). Note that some
restrictions and functional differences due to the XBUS peculiarities are present
between the classic PWM, and the new XPWM.
●An I
●CLKOUT function can output either the CPU clock (like in ST10F269) or a software
2
C interface on the XBUS is added (see X-I2C or simply I2C interface).
programmable prescaled value of the CPU clock.
) on the QFP144 package
18
voltage shall be in
STBY
13/231
IntroductionST10F276E
●Embedded memory size has been significantly increased (both Flash and RAM).
●PLL multiplication factors have been adapted to new frequency range.
A/D Converter is not fully compatible versus ST10F269 (timing and programming
model). Formula for the conversion time is still valid, while the sampling phase
programming model is different.
Besides, additional 8 channels are available on P1L pins as alternate function: the
accuracy reachable with these extra channels is reduced with respect to the standard
Port5 channels.
●External Memory bus potential limitations on maximum speed and maximum
capacitance load could be introduced (under evaluation): ST10F276E will probably not
be able to address an external memory at 64MHz with 0 wait states (under evaluation).
●XPERCON register bit mapping modified according to new peripherals implementation
(not fully compatible with ST10F269).
●Bondout chip for emulation (ST10R201) cannot achieve more than 50MHz at room
temperature (so no real-time emulation possible at maximum speed).
●Input section characteristics are different. The threshold programmability is extended to
all port pins (additional XPICON register); it is possible to select standard TTL (with up
to 500mV of hysteresis) and standard CMOS (with up to 800mV of hysteresis).
●Output transition is not programmable.
●CAN module is enhanced: ST10F276E implements two C-CAN modules, so the
programming model is slightly different. Besides, the possibility to map in parallel the
two CAN modules is added (on P4.5/P4.6).
●On-chip main oscillator input frequency range has been reshaped, reducing it from 1-
25MHz down to 4-12MHz. This is a high performance oscillator amplifier, providing a
very high negative resistance and wide oscillation amplitude: when this on-chip
amplifier is used as reference for Real-Time Clock module, the Power-down
consumption is dominated by the consumption of the oscillator amplifier itself. A metal
option is added to offer a low power oscillator amplifier working in the range of 4-8MHz:
this will allow a power consumption reduction when Real-Time Clock is running in
Power Down mode using as reference the on-chip main oscillator clock.
●A second on-chip oscillator amplifier circuit (32kHz) is implemented for low power
modes: it can be used to provide the reference to the Real-Time Clock counter (either
in Power Down or Stand-by mode). Pin XTAL3 and XTAL4 replace a couple of V
DD/VSS
pins of ST10F269.
●Possibility to re-program internal XBUS chip select window characteristics (XRAM2 and
8-bit bidirectional I/O port, bit-wise programmable for input or output via direction
bit. Programming an I/O pin as input forces the corresponding output driver to
P6.0 - P6.7
1 - 8I/O
1OP6.0CS0
...............
5OP6.4CS4 Chip select 4 output
6
7
high impedance state. Port 6 outputs can be configured as push-pull or open
drain drivers. The input threshold of Port 6 is selectable (TTL or CMOS). The
following Port 6 pins have alternate functions:
8-bit bidirectional I/O port, bit-wise programmable for input or output via direction
bit. Programming an I/O pin as input forces the corresponding output driver to
9-16I/O
high impedance state. Port 8 outputs can be configured as push-pull or open
drain drivers. The input threshold of Port 8 is selectable (TTL or CMOS).
The following Port 8 pins have alternate functions:
OTxD1ASC1: Clock / Data output (Asynchronous/Synchronous)
17/231
Pin dataST10F276E
Table 1.Pin description (continued)
SymbolPinTypeFunction
8-bit bidirectional I/O port, bit-wise programmable for input or output via direction
bit. Programming an I/O pin as input forces the corresponding output driver to
39IP5.10T6EUDGPT2: timer T6 external up/down control input
40IP5.11T5EUDGPT2: timer T5 external up/down control input
41IP5.12T6INGPT2: timer T6 count input
42IP5.13T5INGPT2: timer T5 count input
43IP5.14T4EUDGPT1: timer T4 external up/down control input
high impedance state. Port 7 outputs can be configured as push-pull or open
drain drivers. The input threshold of Port 7 is selectable (TTL or CMOS).
The following Port 7 pins have alternate functions:
16-bit input-only port with Schmitt-Trigger characteristics. The pins of Port 5 can
be the analog input channels (up to 16) for the A/D converter, where P5.x equals
I
ANx (Analog input channel x), or they are timer inputs. The input threshold of
I
Port 5 is selectable (TTL or CMOS). The following Port 5 pins have alternate
functions:
P2.0 - P2.7
P2.8 - P2.15
44IP5.15T2EUDGPT1: timer T2 external up/down control input
16-bit bidirectional I/O port, bit-wise programmable for input or output via
direction bit. Programming an I/O pin as input forces the corresponding output
I/O
driver to high impedance state. Port 2 outputs can be configured as push-pull or
open drain drivers. The input threshold of Port 2 is selectable (TTL or CMOS).
The following Port 2 pins have alternate functions:
IEX0INFast external interrupt 0 input
IEX7INFast external interrupt 7 input
IT7INCAPCOM2: timer T7 count input
18/231
ST10F276EPin data
Table 1.Pin description (continued)
SymbolPinTypeFunction
15-bit (P3.14 is missing) bidirectional I/O port, bit-wise programmable for input or
65-70,
73-80,
81
65IP3.0T0INCAPCOM1: timer T0 count input
66OP3.1T6OUTGPT2: timer T6 toggle latch output
67IP3.2CAPINGPT2: register CAPREL capture input
68OP3.3T3OUTGPT1: timer T3 toggle latch output
69IP3.4T3EUDGPT1: timer T3 external up/down control input
I/O
output via direction bit. Programming an I/O pin as input forces the
I/O
corresponding output driver to high impedance state. Port 3 outputs can be
I/O
configured as push-pull or open drain drivers. The input threshold of Port 3 is
selectable (TTL or CMOS). The following Port 3 pins have alternate functions:
P3.0 - P3.5
P3.6 - P3.13,
P3.15
70IP3.5T4INGPT1; timer T4 input for count/gate/reload/capture
73IP3.6T3INGPT1: timer T3 count/gate input
74IP3.7T2INGPT1: timer T2 input for count/gate/reload / capture
System clock output (programmable divider on CPU
clock)
19/231
Pin dataST10F276E
Table 1.Pin description (continued)
SymbolPinTypeFunction
Port 4 is an 8-bit bidirectional I/O port. It is bit-wise programmable for input or
output via direction bit. Programming an I/O pin as input forces the
corresponding output driver to high impedance state. The input threshold is
85-92I/O
85OP4.0A16Segment address line
86OP4.1A17Segment address line
87OP4.2A18Segment address line
88OP4.3A19Segment address line
89OP4.4A20Segment address line
P4.0 –P4.7
90OP4.5A21Segment address line
91OP4.6A22Segment address line
selectable (TTL or CMOS). Port 4.4, 4.5, 4.6 and 4.7 outputs can be configured
as push-pull or open drain drivers.
In case of an external bus configuration, Port 4 can be used to output the
segment address lines:
ICAN2_RxD CAN2: receive data input
I/OSCL
I2C Interface: serial clock
ICAN1_RxD CAN1: receive data input
ICAN2_RxD CAN2: receive data input
92OP4.7A23Most significant segment address line
RD95O
/WRL96O
WR
READY/
READY
97I
ALE98O
OCAN1_TxDCAN1: transmit data output
OCAN2_TxDCAN2: transmit data output
OCAN2_TxDCAN2: transmit data output
I/OSDA
External memory read strobe. RD
I2C Interface: serial data
is activated for every external instruction or
data read access.
External memory write strobe. In WR
external data write access. In WRL
-mode this pin is activated for every
mode this pin is activated for low byte data
write accesses on a 16-bit bus, and for every data write access on an 8-bit bus.
See WRCFG in the SYSCON register for mode selection.
Ready input. The active level is programmable. When the ready function is
enabled, the selected inactive level at this pin, during an external memory
access, will force the insertion of waitstate cycles until the pin returns to the
selected active level.
Address latch enable output. In case of use of external addressing or of
multiplexed mode, this signal is the latch command of the address lines.
20/231
ST10F276EPin data
Table 1.Pin description (continued)
SymbolPinTypeFunction
External access enable pin.
A low level applied to this pin during and after Reset forces the ST10F276E to
start the program from the external memory space. A high level forces
ST10F276E to start in the internal memory space. This pin is also used (when
DD
DD
turned
EA / V
STBY
P0L.0 -P0L.7,
P0H.0
P0H.1 - P0H.7
99I
100-107,
108,
111-117
Stand-by mode is entered, that is ST10F276E under reset and main V
off) to bias the 32 kHz oscillator amplifier circuit and to provide a reference
voltage for the low-power embedded voltage regulator which generates the
internal 1.8V supply for the RTC module (when not disabled) and to retain data
inside the Stand-by portion of the XRAM (16 Kbyte).
It can range from 4.5 to 5.5V (6V for a reduced amount of time during the device
life, 4.0V when RTC and 32 kHz on-chip oscillator amplifier are turned off). In
running mode, this pin can be tied low during reset without affecting 32 kHz
oscillator, RTC and XRAM activities, since the presence of a stable V
guarantees the proper biasing of all those modules.
Two 8-bit bidirectional I/O ports P0L and P0H, bit-wise programmable for input or
output via direction bit. Programming an I/O pin as input forces the
corresponding output driver to high impedance state. The input threshold of
Port 0 is selectable (TTL or CMOS).
In case of an external bus configuration, PORT0 serves as the address (A) and
as the address / data (AD) bus in multiplexed bus modes and as the data (D) bus
in demultiplexed bus modes.
Demultiplexed bus modes
Data path width8-bit16-bi
I/O
P0L.0 – P0L.7:D0 – D7D0 - D7
P0H.0 – P0H.7:I/OD8 - D15
P1L.0 - P1L.7
P1H.0 - P1H.7
Multiplexed bus modes
Data path width8-bit16-bi
P0L.0 – P0L.7:AD0 – AD7AD0 - AD7
P0H.0 – P0H.7:A8 – A15AD8 - AD15
Two 8-bit bidirectional I/O ports P1L and P1H, bit-wise programmable for input or
output via direction bit. Programming an I/O pin as input forces the
corresponding output driver to high impedance state. PORT1 is used as the 16bit address bus (A) in demultiplexed bus modes: if at least BUSCONx is
118-125
128-135
configured such the demultiplexed mode is selected, the pis of PORT1 are not
available for general purpose I/O function. The input threshold of Port 1 is
I/O
selectable (TTL or CMOS).
The pins of P1L also serve as the additional (up to 8) analog input channels for
the A/D converter, where P1L.x equals ANy (Analog input channel y,
where y = x + 16). This additional function have higher priority on demultiplexed
bus function. The following PORT1 pins have alternate functions:
132IP1H.4 CC24IOCAPCOM2: CC24 capture input
133IP1H.5 CC25IOCAPCOM2: CC25 capture input
134IP1H.6 CC26IOCAPCOM2: CC26 capture input
135IP1H.7 CC27IOCAPCOM2: CC27 capture input
21/231
Pin dataST10F276E
Table 1.Pin description (continued)
SymbolPinTypeFunction
XTAL1138IXTAL1 Main oscillator amplifier circuit and/or external clock input.
XTAL2137OXTAL2 Main oscillator amplifier circuit output.
To clock the device from an external source, drive XTAL1 while leaving XTAL2
unconnected. Minimum and maximum high / low and rise / fall times specified in
the AC Characteristics must be observed.
When 32 kHz oscillator amplifier is not used, to avoid spurious consumption,
XTAL3 shall be tied to ground while XTAL4 shall be left open. Besides, bit OFF32
in RTCCON register shall be set. 32 kHz oscillator can only be driven by an
external crystal, and not by a different clock source.
Reset Input with CMOS Schmitt-Trigger characteristics. A low level at this pin for
a specified duration while the oscillator is running resets the ST10F276E. An
RSTIN
RSTOUT
NMI
140I
141O
142I
internal pull-up resistor permits power-on reset using only a capacitor connected
. In bidirectional reset mode (enabled by setting bit BDRSTEN in
to V
SS
SYSCON register), the RSTIN
line is pulled low for the duration of the internal
reset sequence.
Internal Reset Indication Output. This pin is driven to a low level during
hardware, software or watchdog timer reset.
RSTOUT
remains low until the EINIT
(end of initialization) instruction is executed.
Non-Maskable Interrupt Input. A high to low transition at this pin causes the CPU
to vector to the NMI trap routine. If bit PWDCFG = ‘0’ in SYSCON register, when
the PWRDN (power down) instruction is executed, the NMI pin must be low in
order to force the ST10F276E to go into power down mode. If NMI is high and
PWDCFG = ‘0’, when PWRDN is executed, the part will continue to run in
normal mode.
If not used, pin NMI
should be pulled high externally.
V
AREF
V
AGND
RPD84-
V
DD
37-A/D converter reference voltage and analog supply
38-A/D converter reference and analog ground
Timing pin for the return from interruptible power down mode and synchronous /
asynchronous reset selection.
17, 46,
72,82,93,
109, 126,
136
Digital supply voltage = + 5V during normal operation, idle and power down
-
modes.
It can be turned off when Stand-by RAM mode is selected.
18,45,
55,71,
V
SS
83,94,
-Digital ground
110, 127,
139
V
18
56-
1.8V decoupling pin: a decoupling capacitor (typical value of 10nF, max 100nF)
must be connected between this pin and nearest V
22/231
SS
pin.
ST10F276EFunctional description
3 Functional description
The architecture of the ST10F276E combines advantages of both RISC and CISC
processors and an advanced peripheral subsystem. The block diagram gives an overview of
the different on-chip components and the high bandwidth internal bus structure of the
ST10F276E.
Figure 3.Block diagram
XFLASH
16
16
8
16
16
16
16 16
16 16
16 16
16
16
IFLASH
512 KB
XPWM
XCAN2
Controller
External Bus
320 KB
XRAM
48 KB
XRAM
16 KB
(STBY)
XRAM
2 KB
(PEC)
XI2C
XCAN1
Por t 0Por t 1Po rt 4
Por t 6
81615 8 8
XRTC
XASC
XSSC
16
16
Por t 5
32
CPU-Core and MAC Unit
Interrupt Controller
10-bit ADC
GPT1 / GPT2
BRGBRG
Port 3Port 7Por t 8
ASC0
SSC0
PEC
PWM
16
16
CAPCOM2
IRAM
2 KB
Watchdog
Oscillator
32 kHz
Oscillator
PLL
5V-1.8V
Vol tag e
Regulator
CAPCOM1
16
Por t 2
23/231
Internal Flash memoryST10F276E
4 Internal Flash memory
4.1 Overview
The on-chip Flash is composed of two matrix modules, each one containing one array
divided in two banks that can be read and modified independently of one another: one bank
can be read while another bank is under modification.
Figure 4.Flash modules structure
IFLASH (Module I)
Bank 1: 128 Kbyte
program memory
Bank 0: 384 Kbyte
program memory
8 Kbyte test-Flash
+
I-BUS interface
The write operations of the four banks are managed by an embedded Flash program/erase
controller (FPEC). The high voltages needed for program/erase operations are internally
generated.
The data bus is 32-bit wide. Due to ST10 core architecture limitation, only the first
512 Kbytes are accessed at 32-bit (internal Flash bus, see I-BUS), while the remaining
320 Kbytes are accessed at 16-bit (see X-BUS).
4.2 Functional description
Control section
HV and Ref.
generator
Program/erase
controller
XFLASH (Module X)
Bank 3: 128 Kbyte
Bank 2: 192 Kbyte
X-BUS interface
program memory
program memory
4.2.1 Structure
Ta bl e 2 shows the address space reserved to the Flash module.
Table 2.Flash modules absolute mapping
DescriptionAddressesSize
IFLASH sectors0x00 0000 to 0x08 FFFF512 Kbyte
XFLASH sectors0x09 0000 to 0x0D FFFF320 Kbyte
Registers and Flash internal reserved area0x0E 0000 to 0x0E FFFF64 Kbyte
4.2.2 Modules structure
The IFLASH module is composed of two banks. Bank 0 contains 384 Kbyte of program
memory divided in 10 sectors. Bank 0 contains also a reserved sector named test-Flash.
24/231
ST10F276EInternal Flash memory
Bank 1 contains 128 Kbyte of program memory or parameter divided in two sectors
(64 Kbyte each).
The XFLASH module is composed of two banks as well. Bank 2 contains 192 Kbyte of
program memory divided in three sectors. Bank 3 contains 128 Kbyte of program memory
or parameter divided in two sectors (64 Kbyte each).
Addresses from 0x0E 0000 to 0x0E FFFF are reserved for the control register interface and
other internal service memory space used by the Flash program/erase controller.
The following tables show the memory mapping of the Flash when it is accessed in read
mode (Ta bl e 3 ), and when accessed in write or erase mode (Ta bl e 2 ): note that with this
second mapping, the first three banks are remapped into code segment 1 (same as
obtained when setting bit ROMS1 in SYSCON register).
Bank 0 Flash 0 (B0F0)0x0000 0000 - 0x0000 1FFF8 KB
Bank 0 Flash 1 (B0F1)0x0000 2000 - 0x0000 3FFF8 KB
Bank 0 Flash 2 (B0F2)0x0000 4000 - 0x0000 5FFF8 KB
Bank 0 Flash 3 (B0F3)0x0000 6000 - 0x0000 7FFF8 KB
B0
B1
B2
B3
Bank 0 Flash 4 (B0F4)0x0001 8000 - 0x0001 FFFF32 KB
Bank 0 Flash 5 (B0F5)0x0002 0000 - 0x0002 FFFF64 KB
Bank 0 Flash 6 (B0F6)0x0003 0000 - 0x0003 FFFF64 KB
Bank 0 Flash 7 (B0F7)0x0004 0000 - 0x0004 FFFF64 KB
Bank 0 Flash 8 (B0F8)0x0005 0000 - 0x0005 FFFF64 KB
Bank 0 Flash 9 (B0F9)0x0006 0000 - 0x0006 FFFF64 KB
Bank 1 Flash 0 (B1F0)0x0007 0000 - 0x0007 FFFF64 KB
Bank 1 Flash 1 (B1F1)0x0008 0000 - 0x0008 FFFF64 KB
Bank 2 Flash 0 (B2F0)0x0009 0000 - 0x0009 FFFF64 KB
Bank 2 Flash 1 (B2F1)0x000A 0000 - 0x000A FFFF64 KB
Bank 2 Flash 2 (B2F2)0x000B 0000 - 0x000B FFFF64 KB
Bank 3 Flash 0 (B3F0)0x000C 0000 - 0x000C FFFF64 KB
Bank 3 Flash 1 (B3F1)0x000D 0000 - 0x000D FFFF64 KB
ST10 bus
size
32-bit (I-BUS)
16-bit
(X-BUS)
25/231
Internal Flash memoryST10F276E
Table 4.Flash modules sectorization (write operations or with ROMS1 = ‘1’)
BankDescriptionAddressesSize
Bank 0 Test-Flash (B0TF)0x0000 0000 - 0x0000 1FFF8 KB
Bank 0 Flash 0 (B0F0)0x0001 0000 - 0x0001 1FFF8 KB
Bank 0 Flash 1 (B0F1)0x0001 2000 - 0x0001 3FFF8 KB
Bank 0 Flash 2 (B0F2)0x0001 4000 - 0x0001 5FFF8 KB
Bank 0 Flash 3 (B0F3)0x0001 6000 - 0x0001 7FFF8 KB
B0
B1
B2
B3
Bank 0 Flash 4 (B0F4)0x0001 8000 - 0x0001 FFFF32 KB
Bank 0 Flash 5 (B0F5)0x0002 0000 - 0x0002 FFFF64 KB
Bank 0 Flash 6 (B0F6)0x0003 0000 - 0x0003 FFFF64 KB
Bank 0 Flash 7 (B0F7)0x0004 0000 - 0x0004 FFFF64 KB
Bank 0 Flash 8 (B0F8)0x0005 0000 - 0x0005 FFFF64 KB
Bank 0 Flash 9 (B0F9)0x0006 0000 - 0x0006 FFFF64 KB
Bank 1 Flash 0 (B1F0)0x0007 0000 - 0x0007 FFFF64 KB
Bank 1 Flash 1 (B1F1)0x0008 0000 - 0x0008 FFFF64 KB
Bank 2 Flash 0 (B2F0)0x0009 0000 - 0x0009 FFFF64 KB
Bank 2 Flash 1 (B2F1)0x000A 0000 - 0x000A FFFF64 KB
Bank 2 Flash 2 (B2F2)0x000B 0000 - 0x000B FFFF64 KB
Bank 3 Flash 0 (B3F0)0x000C 0000 - 0x000C FFFF64 KB
Bank 3 Flash 1 (B3F1)0x000D 0000 - 0x000D FFFF64 KB
ST10 Bus
size
32-bit (I-BUS)
16-bit
(X-BUS)
Ta bl e 4 above refers to the configuration when bit ROMS1 of SYSCON register is set. When
Bootstrap mode is entered:
●Test-Flash is seen and available for code fetches (address 00’0000h)
●User IFlash is only available for read and write accesses
●Write accesses must be made with addresses starting in segment 1 from 01'0000h,
whatever ROMS1 bit in SYSCON value
●Read accesses are made in segment 0 or in segment 1 depending of ROMS1 value.
In Bootstrap mode, by default ROMS1 = 0, so the first 32 Kbytes of IFlash are mapped in
segment 0.
Example: In default configuration, to program address 0, user must put the value 01'0000h
in the FARL and FARH registers, but to verify the content of the address 0 a read to
00'0000h must be performed.
Ta bl e 5 shows the control register interface composition: this set of registers can be
addressed by the CPU.
26/231
ST10F276EInternal Flash memory
Table 5.Control register interface
BankDescriptionAddressesSize
FCR1-0Flash control registers 1-00x000E 0000 - 0x000E 00078 byte
FDR1-0Flash data registers 1-00x000E 0008 - 0x000E 000F8 byte
XFICRXFlash interface control register0x000E E000 - 0x000E E0012 byte
Flash non-volatile protection
X register
Flash non-volatile protection
I register
Flash non-volatile access
protection register 0
Flash non-volatile access
protection register 1
0x000E DFB0 - 0x000E DFB34 byte
0x000E DFB4 - 0x000E DFB74 byte
0x000E DFB8 - 0x000E DFB92 byte
0x000E DFBC - 0x000E DFBF4 byte
ST10
bus size
16-bit
(X-BUS)
4.2.3 Low power mode
The Flash modules are automatically switched off executing PWRDN instruction. The
consumption is drastically reduced, but exiting this state can require a long time (t
Note:Recovery time from Power Down mode for the Flash modules is anyway shorter than the
main oscillator start-up time. To avoid any problem in restarting to fetch code from the Flash,
it is important to size properly the external circuit on RPD pin.
PD
).
Power-off Flash mode is entered only at the end of the eventually running Flash write
operation.
4.2.4 Write operation
The Flash modules have one single register interface mapped in the memory space of the
XFlash module (0x0E 0000 to 0x0E 0013). All the operations are enabled through four 16-bit
control registers: Flash Control Register 1-0 High/Low (FCR1H/L-FCR0H/L). Eight other 16bit registers are used to store Flash Address and Data for Program operations (FARH/L and
FDR1H/L-FDR0H/L) and Write Operation Error flags (FERH/L). All registers are accessible
with 8 and 16-bit instructions (since mapped on ST10 XBUS).
Note:Before accessing the XFlash module (and consequently also the Flash register to be used
for program/erasing operations), bit XFLASHEN in XPERCON register and bit XPEN in
SYSCON register shall be set.
The four banks have their own dedicated sense amplifiers, so that any bank can be read
while any other bank is written. However simultaneous write operations (“write” means
either Program or Erase) on different banks are forbidden: when there is a write operation
on going (Program or Erase) anywhere in the Flash, no other write operation can be
performed.
During a Flash write operation any attempt to read the bank under modification will output
invalid data (software trap 009Bh). This means that the Flash bank is not fetchable when a
write operation is active: the write operation commands must be executed from another
27/231
Internal Flash memoryST10F276E
bank, or from the other module or again from another memory (internal RAM or external
memory).
Note:During a Write operation, when bit LOCK of FCR0 is set, it is forbidden to write into the
Flash Control Registers.
4.2.5 Power supply drop
If during a write operation the internal low voltage supply drops below a certain internal
voltage threshold, any write operation running is suddenly interrupted and the modules are
reset to Read mode. At following Power-on, an interrupted Flash write operation must be
repeated.
4.3 Registers description
4.3.1 Flash control register 0 low
The Flash control register 0 low (FCR0L) together with the Flash control register 0 high
(FCR0H) is used to enable and to monitor all the write operations for both the Flash
modules. The user has no access in write mode to the test-Flash (B0TF). Besides, testFlash block is seen by the user in Bootstrap mode only.
FCR0L (0x0E 0000)FCRReset value: 0000h
1514131211109876543210
ReservedBSY1 BSY0 LOCK Res. BSY3 BSY2 Res.
RRRRR
Table 6.Flash control register 0 low
BitFunction
Bank 3:2 Busy (XFLASH)
These bits indicate that a write operation is running on the corresponding bank of
XFLASH. They are automatically set when bit WMS is set. Setting Protection
operation sets bit BSY2 (since protection registers are in the Block B2). When these
BSY(3:2)
bits are set every read access to the corresponding bank will output invalid data
(software trap 009Bh), while every write access to the bank will be ignored. At the end
of the write operation or during a Program or Erase Suspend these bits are
automatically reset and the bank returns to read mode. After a Program or Erase
Resume these bits are automatically set again.
28/231
ST10F276EInternal Flash memory
Table 6.Flash control register 0 low (continued)
BitFunction
Flash registers access locked
When this bit is set, it means that the access to the Flash Control Registers FCR0H/-
FCR1H/L, FDR0H/L-FDR1H/L, FARH/L and FER is locked by the FPEC: any read
access to the registers will output invalid data (software trap 009Bh) and any write
LOCK
BSY(1:0)
access will be ineffective. LOCK bit is automatically set when the Flash bit WMS is set.
This is the only bit the user can always access to detect the status of the Flash: once it
is found low, the rest of FCR0L and all the other Flash registers are accessible by the
user as well.
Note that FER content can be read when LOCK is low, but its content is updated only
when also BSY bits are reset.
Bank 1:0 Busy (IFLASH)
These bits indicate that a write operation is running in the corresponding bank of
IFLASH. They are automatically set when bit WMS is set. When these bits are set
every read access to the corresponding bank will output invalid data (software trap
009Bh), while every write access to the bank will be ignored. At the end of the write
operation or during a Program or Erase Suspend these bits are automatically reset
and the bank returns to read mode. After a Program or Erase Resume these bits are
automatically set again.
4.3.2 Flash control register 0 high
The Flash control register 0 high (FCR0H) together with the Flash control register 0 Low
(FCR0L) is used to enable and to monitor all the write operations for both the Flash
modules. The user has no access in write mode to the Test-Flash (B0TF). Besides, testFlash block is seen by the user in Bootstrap mode only.
FCR0H (0x0E 0002)FCRReset value: 0000h
1514131211109876543210
WMS SUSP WPG DWPG SERReservedSPR SMODReserved
RWRWRWRWRWRWRW
Table 7.Flash control register 0 high
BitFunction
Select module
SMOD
SPR
If this bit is reset, the Write Operation is performed on XFLASH Module; if this bit is
set, the Write Operation is performed on IFLASH Module. SMOD bit is automatically
reset at the end of the Write operation.
Set protection
This bit must be set to select the Set Protection operation. The Set Protection
operation allows to program 0s in place of 1s in the Flash Non-volatile Protection
Registers. The Flash Address in which to program must be written in the FARH/L
registers, while the Flash Data to be programmed must be written in the FDR0H/L
before starting the execution by setting bit WMS. A sequence error is flagged by bit
SEQER of FER if the address written in FARH/L is not in the range 0x0EDFB00x0EDFBF. SPR bit is automatically reset at the end of the Set Protection operation.
29/231
Internal Flash memoryST10F276E
Table 7.Flash control register 0 high (continued)
BitFunction
Sector erase
This bit must be set to select the Sector Erase operation in the Flash modules. The
Sector Erase operation allows to erase all the Flash locations to 0xFF. From 1 to all the
SER
DWPG
WPG
SUSP
WMS
sectors of the same bank (excluded Test-Flash for Bank B0) can be selected to be
erased through bits BxFy of FCR1H/L registers before starting the execution by setting
bit WMS. It is not necessary to pre-program the sectors to 0x00, because this is done
automatically. SER bit is automatically reset at the end of the Sector Erase operation.
Double word program
This bit must be set to select the Double Word (64 bits) Program operation in the Flash
modules. The Double Word Program operation allows to program 0s in place of 1s.
The Flash Address in which to program (aligned with even words) must be written in
the FARH/L registers, while the 2 Flash Data to be programmed must be written in the
FDR0H/L registers (even word) and FDR1H/L registers (odd word) before starting the
execution by setting bit WMS. DWPG bit is automatically reset at the end of the
Double Word Program operation.
Word program
This bit must be set to select the Word (32 bits) Program operation in the Flash
modules. The Word Program operation allows to program 0s in place of 1s. The Flash
Address to be programmed must be written in the FARH/L registers, while the Flash
Data to be programmed must be written in the FDR0H/L registers before starting the
execution by setting bit WMS. WPG bit is automatically reset at the end of the Word
Program operation.
Suspend
This bit must be set to suspend the current Program (Word or Double Word) or Sector
Erase operation in order to read data in one of the sectors of the bank under
modification or to program data in another bank. The Suspend operation resets the
Flash bank to normal read mode (automatically resetting bits BSYx). When in
Program Suspend, the two Flash modules accept only the following operations: Read
and Program Resume. When in Erase Suspend the modules accept only the following
operations: Read, Erase Resume and Program (Word or Double Word; Program
operations cannot be suspended during Erase Suspend). To resume the suspended
operation, the WMS bit must be set again, together with the selection bit
corresponding to the operation to resume (WPG, DWPG, SER).
Note: It is forbidden to start a new Write operation with bit SUSP already set.
Write mode start
This bit must be set to start every write operation in the Flash modules. At the end of
the write operation or during a Suspend, this bit is automatically reset. To resume a
suspended operation, this bit must be set again. It is forbidden to set this bit if bit ERR
of FER is high (the operation is not accepted). It is also forbidden to start a new write
(program or erase) operation (by setting WMS high) when bit SUSP of FCR0 is high.
Resetting this bit by software has no effect.
30/231
ST10F276EInternal Flash memory
4.3.3 Flash control register 1 low
The Flash control register 1 low (FCR1L), together with Flash control register 1 high
(FCR1H), is used to select the sectors to erase, or during any write operation to monitor the
status of each sector of the module selected by SMOD bit of FCR0H. First diagram shows
FCR1L meaning when SMOD = 0; the second one when SMOD = 1.
Bank 2 XFLASH sector 2:0 status
These bits must be set during a Sector Erase operation to select the sectors to erase
B2F(2:0)
in Bank 2. Besides, during any erase operation, these bits are automatically set and
give the status of the three sectors of Bank 2 (B2F2-B2F0). The meaning of B2Fy bit
for sector y of Bank 2 is given by Ta bl e 10 . These bits are automatically reset at the
end of a write operation if no errors are detected.
SMOD = 1 (IFLASH selected)
Bank 0 IFLASH sector 9:0 status
These bits must be set during a Sector Erase operation to select the sectors to erase
B0F(9:0)
in Bank 0. Besides, during any erase operation, these bits are automatically set and
give the status of the 10 sectors of Bank 0 (B0F9-B0F0). The meaning of B0Fy bit for
sector y of Bank 0 is given by Ta bl e 10 . These bits are automatically reset at the end of
a Write operation if no errors are detected.
31/231
Internal Flash memoryST10F276E
4.3.4 Flash control register 1 high
The Flash control register 1 high (FCR1H), together with Flash control register 1 low
(FCR1L), is used to select the sectors to erase, or during any write operation to monitor the
status of each sector and each bank of the module selected by SMOD bit of FCR0H. First
diagram shows FCR1H meaning when SMOD = 0; the second one when SMOD = 1.
FCR1H (0x0E 0006) SMOD = 0FCRReset value: 0000h
1514131211109876543210
ReservedB3S B2SReservedB3F1 B3F0
RSRSRSRS
FCR1H (0x0E 0006) SMOD = 1FCRReset value: 0000h
1514131211109876543210
ReservedB1S B0SReservedB1F1 B1F0
-RSRSRSRS
Table 9.Flash control register 1 high
BitFunction
SMOD = 0 (XFLASH selected)
Bank 3 XFLASH sector 1:0 status
During any erase operation, these bits are automatically set and give the status of the
B3F(1:0)
two sectors of Bank 3 (B3F1-B3F0). The meaning of B3Fy bit for sector y of Bank 1 is
given by Ta bl e 1 0 . These bits are automatically reset at the end of a erase operation if
no errors are detected.
Bank 3-2 status (XFLASH)
During any erase operation, these bits are automatically modified and give the status
B(3:2)S
of the two banks (B3-B2). The meaning of BxS bit for bank x is given in Tab l e 1 0 .
These bits are automatically reset at the end of a erase operation if no errors are
detected.
SMOD = 1 (IFLASH selected)
Bank 1 IFLASH sector 1:0 status
During any erase operation, these bits are automatically set and give the status of the
B1F(1:0)
two sectors of Bank 1 (B1F1-B1F0). The meaning of B1Fy bit for sector y of Bank 1 is
given by Ta bl e 1 0 . These bits are automatically reset at the end of a erase operation if
no errors are detected.
Bank 1-0 status (IFLASH)
During any erase operation, these bits are automatically modified and give the status
B(1:0)S
of the two banks (B1-B0). The meaning of BxS bit for bank x is given in Tab l e 1 0 .
These bits are automatically reset at the end of a erase operation if no errors are
detected.
During any erase operation, these bits are automatically set and give the status of the two
sectors of Bank 1 (B1F1-B1F0). The meaning of B1Fy bit for sector y of Bank 1 is given by
Ta bl e 1 0. These bits are automatically reset at the end of a erase operation if no errors are
detected.
32/231
ST10F276EInternal Flash memory
Table 10.Banks (BxS) and sectors (BxFy) status bits meaning
ERRSUSPBxS = 1 meaningBxFy = 1 meaning
1-Erase error in bank xErase error in sector y of bank x
01Erase suspended in bank xErase suspended in sector y of bank x
00Don’t careDon’t care
4.3.5 Flash data register 0 low
The Flash address registers (FARH/L) and the Flash data registers (FDR1H/L-FDR0H/L)
are used during the program operations to store Flash Address in which to program and
data to program.
These bits must be written with the data to program the Flash with the following
operations: word program (32-bit), double word program (64-bit) and set protection.
These bits must be written with the data to program the Flash with the following
operations: word program (32-bit), double word program (64-bit) and set protection.
These bits must be written with the Data to program the Flash with the following
operations: Word Program (32-bit), Double Word Program (64-bit) and Set Protection.
These bits must be written with the data to program the Flash with the following
operations: word program (32-bit), double word program (64-bit) and set protection.
These bits must be written with the address of the Flash location to program in the
following operations: word program (32-bit) and double word program (64-bit). In
double word program bit ADD2 must be written to ‘0’.
34/231
ST10F276EInternal Flash memory
4.3.10 Flash address register high
FARH (0x0E 0012)FCRReset value: 0000h
1514131211109876543210
ReservedADD20 ADD19 ADD18 ADD17 ADD16
RWRWRWRWRW
Table 16.Flash address register high
BitFunction
Address 20:16
ADD(20:16)
These bits must be written with the address of the Flash location to program in the
following operations: word program and double word program.
4.3.11 Flash error register
Flash error register, as well as all the other Flash registers, can be properly read only once
LOCK bit of register FCR0L is low. Nevertheless, its content is updated when also BSY bits
are reset as well; for this reason, it is definitively meaningful reading FER register content
only when LOCK bit and all BSY bits are cleared.
FER (0xE 0014h)FCRReset value: 0000h
1514131211109876543210
ReservedWPF RESERSEQERReserved10ER PGER ERER ERR
RCRCRCRCRCRCRC
Table 17.Flash error register
BitFunction
Write error
ERR
This bit is automatically set when an error occurs during a Flash write operation or
when a bad write operation setup is done. Once the error has been discovered and
understood, ERR bit must be software reset.
Erase error
This bit is automatically set when an erase error occurs during a Flash write operation.
ERER
This error is due to a real failure of a Flash cell, that can no more be erased. This kind
of error is fatal and the sector where it occurred must be discarded. This bit has to be
software reset.
Program error
This bit is automatically set when a program error occurs during a Flash write
PGER
operation. This error is due to a real failure of a Flash cell, that can no more be
programmed. The word where this error occurred must be discarded. This bit has to
be software reset.
1 over 0 error
This bit is automatically set when trying to program at 1 bits previously set at 0 (this
10ER
does not happen when programming the protection bits). This error is not due to a
failure of the Flash cell, but only flags that the desired data has not been written. This
bit has to be software reset.
35/231
Internal Flash memoryST10F276E
Table 17.Flash error register (continued)
BitFunction
Sequence error
SEQER
This bit is automatically set when the control registers (FCR1H/L-FCR0H/L, FARH/L,
FDR1H/L-FDR0H/L) are not correctly filled to execute a valid write operation. in this
case no write operation is executed. This bit has to be software reset.
Resume error
RESER
This bit is automatically set when a suspended program or erase operation is not
resumed correctly due to a protocol error. In this case the suspended operation is
aborted. This bit has to be software reset.
Write protection flag
This bit is automatically set when trying to program or erase in a sector write
WPF
protected. In case of multiple sector erase, the not protected sectors are erased, while
the protected sectors are not erased and bit WPF is set. This bit has to be software
reset.
4.3.12 XFlash interface control register
This register is used to configure the XFLASH interface behavior on the XBUS. It allows to
set the number of wait states introduced on the XBUS before the internal READY
given to the ST10 bus master.
XFICR (0xE E000h)XBUSReset value: 000Fh
1514131211109876543210
signal is
ReservedWS3WS2 WS1WS0
Table 18.XFlash interface control register
BitFunction
Wait state setting
These three bits are the binary coding of the number of wait states introduced by the
XFLASH interface through the XBUS internal READY
WS(3:0)
is 1111, that is the up to 15 wait states are set. The following recommendations for the
ST10F276E are hereafter reported:
For f
For f
> 40MHz1 Wait-StateWS(3:0) = ‘0001’
CPU
≤ 40MHz0 Wait-StateWS(3:0) = ‘0000’
CPU
RWRWRWRW
signal. Default value after reset
36/231
ST10F276EInternal Flash memory
4.4 Protection strategy
The protection bits are stored in non-volatile Flash cells inside XFLASH module, that are
read once at reset and stored in 7 Volatile registers. Before they are read from the nonvolatile cells, all the available protections are forced active during reset.
The protections can be programmed using the Set Protection operation (see Flash Control
Registers paragraph), that can be executed from all the internal or external memories
except from the Flash Bank B2.
Two kind of protections are available: write protections to avoid unwanted writings and
access protections to avoid piracy. In next paragraphs all different level of protections are
shown, and architecture limitations are highlighted as well.
4.4.1 Protection registers
The seven non-volatile protection registers are one time programmable for the user.
Four registers (FNVWPXRL/H-FNVWPIRL/H) are used to store the Write Protection fuses
respectively for each sector of the XFLASH Module (see X) and IFLASH module (see I). The
other three Registers (FNVAPR0 and FNVAPR1L/H) are used to store the Access
Protection fuses (common to both Flash modules even though with some limitations).
4.4.2 Flash non-volatile write protection X register low
FNVWPXRL (0x0E DFB0)NVRDelivery value: FFFFh
1514131211109876543210
W2PPR
RWRWRWRW
Table 19.Flash non-volatile write protection X register low
BitFunction
Write Protection Bank 2 sectors 2-0 (XFLASH)
W2P(2:0)
W2PPR
These bits, if programmed at 0, disable any write access to the sectors of Bank 2
(XFLASH).
Write Protection Bank 2 non-volatile cells
This bit, if programmed at 0, disables any write access to the non-volatile cells of Bank
2. Since these non-volatile cells are dedicated to Protection registers, once W2PPR bit
is set, the configuration of protection setting is frozen, and can only be modified
executing a Temporary Write Unprotection operation.
ReservedW2P2W2P1W2P0
37/231
Internal Flash memoryST10F276E
4.4.3 Flash non-volatile write protection X register high
FNVWPXRH (0x0E DF B2)NVRDelivery value: FFFFh
1514131211109876543210
ReservedW3P1W3P0
RWRW
Table 20.Flash non-volatile write protection X register high
BitFunction
Write Protection Bank 3 / Sectors 1-0 (XFLASH)
W3P(1:0)
These bits, if programmed at 0, disable any write access to the sectors of Bank 3
(XFLASH).
4.4.4 Flash non-volatile write protection I register low
This bit, if programmed at 0, disables any access (read/write) to data mapped inside
IFlash Module address space, unless the current instruction is fetched from one of the
two Flash modules.
Debug Protection
This bit, if erased at 1, allows to by-pass all the protections using the Debug features
DBGP
through the Test Interface. If programmed at 0, on the contrary, all the debug features,
the Test Interface and all the Flash Test Modes are disabled. Even STMicroelectronics
will not be able to access the device to run any eventual failure analysis.
Protections Disable 15-0
If bit PDSx is programmed at 0 and bit PENx is erased at 1, the action of bit ACCP is
PDS(15:0)
disabled. Bit PDS0 can be programmed at 0 only if bits DBGP and ACCP have already
been programmed at 0. Bit PDSx can be programmed at 0 only if bit PENx-1 has
already been programmed at 0.
39/231
Internal Flash memoryST10F276E
4.4.8 Flash non-volatile access protection register 1 high
Table 25.Flash non-volatile access protection register 1 high
BitFunction
Protections Enable 15-0
PEN15-0
If bit PENx is programmed at 0 and bit PDSx+1 is erased at 1, the action of bit ACCP
is enabled again. Bit PENx can be programmed at 0 only if bit PDSx has already been
programmed at 0.
4.4.9 Access protection
The Flash modules have one level of access protection (access to data both in Reading and
Writing): if bit ACCP of FNVAPR0 is programmed at 0, the IFlash module become access
protected: data in the IFlash module can be read/written only if the current execution is from
the IFlash module itself.
Protection can be permanently disabled by programming bit PDS0 of FNVAPR1H, in order
to analyze rejects. Allowing PDS0 bit programming only when ACCP bit is programmed,
guarantees that only an execution from the Flash itself can disable the protections.
Protection can be permanently enabled again by programming bit PEN0 of FNVAPR1L. The
action to disable and enable again Access Protections in a permanent way can be executed
a maximum of 16 times.
Trying to write into the access protected Flash from internal RAM will be unsuccessful.
Trying to read into the access protected Flash from internal RAM will output a dummy data.
When the Flash module is protected in access, also the data access through PEC of a
peripheral is forbidden. To read/write data in PEC mode from/to a protected bank, first it is
necessary to temporary unprotect the Flash module.
Due to ST10 architecture, the XFLASH is seen as external memory: this makes impossible
to access protect it from real external memory or internal RAM. Ta b le 2 6 summarizes all
levels of possible Access protection: in particular, supposing to enable all possible access
protections, when fetching from a memory as listed in the first column, what is possible and
what is not possible to do (see column headers) is shown in the table.
Table 26.Summary of access protection level
Read IFLASH/
Memory fetch source
Fetching from IFLASHYes / YesYes / YesYesYes
Fetching from XFLASHNo / YesYes / YesYesNo
Fetching from IRAMNo / YesYes / YesYesNo
Jump to
IFLASH
Read XFLASH/
Jump to
XFLASH
Read FLASH
Registers
Write FLASH
Registers
40/231
ST10F276EInternal Flash memory
Table 26.Summary of access protection level (continued)
Read IFLASH/
Memory fetch source
Fetching from XRAMNo / YesYes / YesYesNo
Fetching from External
Memory
4.4.10 Write protection
The Flash modules have one level of Write Protections: each sector of each bank of each
Flash Module can be Software Write Protected by programming at 0 the related bit WyPx of
FNVWPXRH/L-FNVWPIRH/L registers.
4.4.11 Temporary unprotection
Bits WyPx of FNVWPXRH/L-FNVWPIRH/L can be temporary unprotected by executing the
Set Protection operation and writing 1 into these bits.
Bit ACCP can be temporary unprotected by executing the Set Protection operation and
writing 1 into these bits, but only if these write instructions are executed from the Flash
Modules.
To restore the write and access protection bits it is necessary to reset the microcontroller or
to execute a Set Protection operation and write 0 into the desired bits.
Read XFLASH/
Jump to
IFLASH
N o / Ye sYe s / Ye sYesN o
Jump to
XFLASH
Read FLASH
Registers
Write FLASH
Registers
It is not necessary to temporary unprotect an access protected Flash in order to update the
code: it is, in fact, sufficient to execute the updating instructions from another Flash bank.
In reality, when a temporary unprotection operation is executed, the corresponding volatile
register is written to 1, while the non-volatile registers bits previously written to 0 (for a
protection set operation), will continue to maintain the 0. For this reason, the User software
must be in charge to track the current protection status (for instance using a specific RAM
area), it is not possible to deduce it by reading the non-volatile register content (a temporary
unprotection cannot be detected).
41/231
Internal Flash memoryST10F276E
4.5 Write operation examples
In this section, examples for each kind of Flash write operation are presented.
Word program
Example: 32-bit Word Program of data 0xAAAAAAAA at address 0x0C5554 in XFLASH
Module.
FCR0H|= 0x2000; /*Set WPG in FCR0H*/
FARL = 0x5554; /*Load Add in FARL*/
FARH = 0x000C; /*Load Add in FARH*/
FDR0L = 0xAAAA; /*Load Data in FDR0L*/
FDR0H = 0xAAAA; /*Load Data in FDR0H*/
FCR0H|= 0x8000; /*Operation start*/
Double word program
Example: Double Word Program (64-bit) of data 0x55AA55AA at address 0x095558 and
data 0xAA55AA55 at address 0x09555C in IFLASH Module.
FCR0H|= 0x1080; /*Set DWPG, SMOD*/
FARL = 0x5558; /*Load Add in FARL*/
FARH = 0x0009; /*Load Add in FARH*/
FDR0L = 0x55AA; /*Load Data in FDR0L*/
FDR0H = 0x55AA; /*Load Data in FDR0H*/
FDR1L = 0xAA55; /*Load Data in FDR1L*/
FDR1H = 0xAA55; /*Load Data in FDR1H*/
FCR0H|= 0x8000; /*Operation start*/
Double Word Program is always performed on the Double Word aligned on a even Word: bit
ADD2 of FARL is ignored.
Sector erase
Example: Sector Eraseof sectors B3F1 and B3F0 of Bank 3 in XFLASH Module.
FCR0H|= 0x0800; /*Set SER in FCR0H*/
FCR1H|= 0x0003; /*Set B3F1, B3F0*/
FCR0H|= 0x8000; /*Operation start*/
Suspend and resume
Word Program, Double Word Program, and Sector Erase operations can be suspended in
the following way:
FCR0H|= 0x4000; /*Set SUSP in FCR0H*/
Then the operation can be resumed in the following way:
FCR0H|= 0x0800; /*Set SER in FCR0H*/
FCR0H|= 0x8000; /*Operation resume*/
Before resuming a suspended Erase, FCR1H/FCR1L must be read to check if the Erase is
already completed (FCR1H = FCR1L = 0x0000 if Erase is complete). Original setup of
Select Operation bits in FCR0H/L must be restored before the operation resume, otherwise
the operation is aborted and bit RESER of FER is set.
42/231
ST10F276EInternal Flash memory
Erase suspend, program and resume
A Sector Erase operation can be suspended in order to program (Word or Double Word)
another sector.
Example: Sector Erase of sector B3F1 of Bank 3 in XFLASH Module.
FCR0H|= 0x0800;/*Set SER in FCR0H*/
FCR1H|= 0x0002;/*Set B3F1*/
FCR0H|= 0x8000;/*Operation start*/
Example: Sector Erase Suspend.
FCR0H|= 0x4000;/*Set SUSP in FCR0H*/
do /*Loop to wait for LOCK=0 and WMS=0*/
{tmp1 = FCR0L;
tmp2 = FCR0H;
} while ((tmp1 && 0x0010) || (tmp2 && 0x8000));
Example: Word Program of data 0x5555AAAA at address 0x0C5554 in XFLASH module.
FCR0H&= 0xBFFF;/*Rst SUSP in FCR0H*/
FCR0H|= 0x2000;/*Set WPG in FCR0H*/
FARL = 0x5554; /*Load Add in FARL*/
FARH = 0x000C; /*Load Add in FARH*/
FDR0L = 0xAAAA; /*Load Data in FDR0L*/
FDR0H = 0x5555; /*Load Data in FDR0H*/
FCR0H|= 0x8000; /*Operation start*/
Once the Program operation is finished, the Erase operation can be resumed in the
following way:
FCR0H|= 0x0800;/*Set SER in FCR0H*/
FCR0H|= 0x8000;/*Operation resume*/
Notice that during the Program Operation in Erase suspend, bits SER and SUSP are low. A
Word or Double Word Program during Erase Suspend cannot be suspended.
To summarize:
●A Sector Erase can be suspended by setting SUSP bit
●To perform a Word Program operation during Erase Suspend, firstly bits SUSP and
SER must be reset, then bit WPG and WMS can be set
●To resume the Sector Erase operation bit SER must be set again
●In any case it is forbidden to start any write operation with SUSP bit already set
Set protection
Example 1: Enable Write Protection of sectors B0F3-0 of Bank 0 in IFLASH module.
FCR0H|= 0x0100;/*Set SPR in FCR0H*/
FARL = 0xDFB4;/*Load Add of register FNVWPIRL in FARL*/
FARH = 0x000E;/*Load Add of register FNVWPIRL in FARH*/
FDR0L = 0xFFF0;/*Load Data in FDR0L*/
FDR0H = 0xFFFF;/*Load Data in FDR0H*/
FCR0H|= 0x8000;/*Operation start*/
Notice that bit SMOD of FCR0H must not be set, since Write Protection bits of IFLASH
Module are stored in Test-Flash (XFLASH Module).
43/231
Internal Flash memoryST10F276E
Example 2: Enable Access and Debug Protection.
FCR0H|= 0x0100;/*Set SPR in FCR0H*/
FARL = 0xDFB8;/*Load Add of register FNVAPR0 in FARL*/
FARH = 0x000E;/*Load Add of register FNVAPR0 in FARH*/
FDR0L = 0xFFFC;/*Load Data in FDR0L*/
FCR0H|= 0x8000;/*Operation start*/
Example 3: Disable in a permanent way Access and Debug Protection.
FCR0H|= 0x0100;/*Set SPR in FCR0H*/
FARL = 0xDFBC;/*Load Add of register FNVAPR1L in FARL*/
FARH = 0x000E;/*Load Add of register FNVAPR1L in FARH*/
FDR0L = 0xFFFE; /*Load Data in FDR0L for clearing PDS0*/
FCR0H|= 0x8000;/*Operation start*/
Example 4: Enable again in a permanent way Access and Debug Protection, after having
disabled them.
FCR0H|= 0x0100;/*Set SPR in FCR0H*/
FARL = 0xDFBC;/*Load Add register FNVAPR1H in FARL*/
FARH = 0x000E;/*Load Add register FNVAPR1H in FARH*/
FDR0H = 0xFFFE;/*Load Data in FDR0H for clearing PEN0*/
FCR0H|= 0x8000;/*Operation start*/
Disable and re-enable of Access and Debug Protection in a permanent way (as shown by
examples 3 and 4) can be done for a maximum of 16 times.
4.6 Write operation summary
In general, each write operation is started through a sequence of three steps:
1.The first instruction is used to select the desired operation by setting its corresponding
selection bit in the Flash Control Register 0. This instruction is also used to select in
which Flash Module to apply the Write Operation (by setting/resetting bit SMOD).
2. The second step is the definition of the Address and Data for programming or the
Sectors or Banks to erase.
3. The last instruction is used to start the write operation, by setting the start bit WMS in
the FCR0.
Once selected, but not yet started, one operation can be canceled by resetting the operation
selection bit.
A summary of the available Flash Module Write Operations is shown in Tab le 2 7 .
Table 27.Flash write operations
OperationSelect bitAddress and dataStart bit
Word Program (32-bit)WPG
FARL /FARH
FDR0L/FDR0H
WMS
Double Word Program (64-bit)DWPG
Sector EraseSERFCR1L/FCR1HWMS
44/231
FARL /FARH
FDR0L/FDR0H
FDR1L/FDR1H
WMS
ST10F276EInternal Flash memory
Table 27.Flash write operations (continued)
OperationSelect bitAddress and dataStart bit
Set ProtectionSPRFDR0L/FDR0HWMS
Program/Erase SuspendSUSPNoneNone
45/231
Bootstrap loaderST10F276E
5 Bootstrap loader
ST10F276E implements innovative boot capabilities in order to
●support a user defined bootstrap (see Alternate bootstrap loader);
●support bootstrap via UART or bootstrap via CAN for the standard bootstrap.
5.1 Selection among user-code, standard or alternate bootstrap
The selection among user-code, standard bootstrap or alternate bootstrap is made by
special combinations on Port0L[5...4] during the time the reset configuration is latched from
Por t0.
The alternate boot mode is triggered with a special combination set on Port0L[5...4]. Those
signals, as other configuration signals, are latched on the rising edge of RSTIN
The alternate boot function is divided in two functional parts (which are independent from
each other):
Part 1: Selection of reset sequence according to the Port0 configuration: User mode and
alternate mode signatures
●Decoding of reset configuration (P0L.5 = 1, P0L.4 = 1) selects the normal mode and
the user Flash to be mapped from address 00’0000h.
●Decoding of reset configuration (P0L.5 = 1, P0L.4 = 0) selects ST10 standard bootstrap
mode (Test-Flash is active and overlaps user Flash for code fetches from address
00'0000h; user Flash is active and available for read and program).
●Decoding of reset configuration (P0L.5 = 0, P0L.4 = 1) activates new verifications to
select which bootstrap software to execute:
–if the user mode signature in the user Flash is programmed correctly, then a
software reset sequence is selected and the user code is executed;
–if the user mode signature is not programmed correctly but the alternate mode
signature in the user Flash is programmed correctly, then the alternate boot mode
is selected;
–if both the user and the alternate mode signatures are not programmed correctly in
the user Flash, then the user key location is read again. Its value will determine
the behavior of the selected bootstrap loader.
pin.
Part 2: Running of user selected reset sequence
●Standard bootstrap loader: Jump to a predefined memory location in Test-Flash
(controlled by ST)
●Alternate boot mode: Jump to address 09’0000h
●Selective bootstrap loader: Jump to a predefined location in Test-Flash (controlled by
ST) and check which communication channel is selected
●User code: Make a software reset and jump to 00’0000h
46/231
ST10F276EBootstrap loader
Table 28.ST10F276E boot mode selection
P0.5P0.4ST10 decoding
11User mode: User Flash mapped at 00’0000h
10
01Alternate boot mode: Flash mapping depends on signatures integrity check
00Reserved
Standard bootstrap loader: User Flash mapped from 00’0000h; code fetches
redirected to Test-Flash at 00’0000h
5.2 Standard bootstrap loader
The built-in bootstrap loader of the ST10F276E provides a mechanism to load the startup
program, which is executed after reset, via the serial interface. In this case no external
(ROM) memory or an internal ROM is required for the initialization code starting at location
00’0000
transfer data via the serial interface into an external RAM using a second level loader
routine. ROM memory (internal or external) is not necessary. However, it may be used to
provide lookup tables or may provide “core-code”, that is, a set of general purpose
subroutines, such asfor I/O operations, number crunching or system initialization.
. The bootstrap loader moves code/data into the IRAM but it is also possible to
H
The Bootstrap Loader can load
●the complete application software into ROMless systems,
●temporary software into complete systems for testing or calibration,
●a programming routine for Flash devices.
The BSL mechanism may be used for standard system start-up as well as for only special
occasions like system maintenance (firmware update) or end-of-line programming or
testing.
5.2.1 Entering the standard bootstrap loader
As with the old ST10 bootstrap mode, the ST10F276E enters BSL mode if pin P0L.4 is
sampled low at the end of a hardware reset. In this case, the built-in bootstrap loader is
activated independently of the selected bus mode. The bootstrap loader code is stored in a
special Test-Flash; no part of the standard Flash memory area is required for this.
After entering BSL mode and the respective initialization, the ST10F276E scans the RxD0
line and the CAN1_RxD line to receive either a valid dominant bit from the CAN interface or
a start condition from the UART line.
Start condition on UART RxD: The ST10F276E starts the standard bootstrap loader. This
bootstrap loader is identical to other ST10 devices (Examples: ST10F269, ST10F168). See
Section 5.3 for details.
Valid dominant bit on CAN1 RxD: The ST10F276E starts bootstrapping via CAN1; the
bootstrapping method is new and is described in Section 5.4. Figure 5 shows the program
flow of the new bootstrap loader. It clearly illustrates how the new functionalities are
implemented:
●UART: UART has priority over CAN after a falling edge on CAN1_RxD until the first
valid rising edge on CAN1_RxD;
●CAN: Pulses on CAN1_RxD shorter than 20*CPU-cycles are filtered.
47/231
Bootstrap loaderST10F276E
5.2.2 ST10 configuration in BSL
When the ST10F276E has entered BSL mode, the configuration shown in Tab l e 29 is
automatically set (values that deviate from the normal reset values are marked in bold).
Table 29.ST10 configuration in BSL mode
Function or registerAccessNotes
Watchdog TimerDisabled
Register SYSCON
0404H
Context Pointer CPFA00
Register STKUNFC00
Stack Pointer SPFA40
Register STKOVFA00
Register BUSCON0
acc. to startup config.
Register S0CON8011
(1)
H
H
H
H
H
XPEN bit set for Bootstrap via CAN or
Alternate Boot Mode
(2)
Initialized only if Bootstrap via UART
Register S0BGacc. to ‘00’ byteInitialized only if Bootstrap via UART
P3.10 / TXD0‘1’Initialized only if Bootstrap via UART
DP3.10‘1’Initialized only if Bootstrap via UART
CAN1 Status/Control
Register
0000
H
Initialized only if Bootstrap via CAN
CAN1 Bit Timing Registeracc. to ‘0’ frameInitialized only if Bootstrap via CAN
XPERCON042D
H
XRAM1-2, XFlash, CAN1 and XMISC
enabled. Initialized only if Bootstrap via CAN
P4.6 / CAN1_TxD‘1’Initialized only if Bootstrap via CAN
DP4.6‘1’Initialized only if Bootstrap via CAN
1. In Bootstrap modes (standard or alternate) ROMEN, bit 10 of SYSCON, is always set regardless of EA pin
level. BYTDIS, bit 9 of SYSCON, is set according to data bus width selection via Port0 configuration.
2. BUSCON0 is initialized with 0000h, external bus disabled, if pin EA is high during reset. If pin EA is low
during reset, BUSACT0, bit 10, and ALECTL0, bit 9, are set enabling the external bus with lengthened ALE
signal. BTYP field, bit 7 and 6, is set according to Port0 configuration.
48/231
ST10F276EBootstrap loader
Figure 5.ST10F276E new standard bootstrap loader program flow
START
Falling-edge on
UART0 RxD?
UART BOOT
Start timer T6
No
UART0 RxD = 1?
Stop timer T6
Initialize UART
Send acknowledge
Address = FA40h
No
No
Byte received?
[Address] = S0RBUF
Address = Address + 1
Address = FA60h?
No
Ye s
Falling-edge on
CAN1 RxD?
Start timer PT0
UART RxD = 0?
CAN1 RxD = 1?
PT0 > 20?
Count = 1
CAN RxD = 0?
CAN1 RxD = 1?
No
No
No
CAN BOOT
No
No
Glitch on CAN1 RxD
Stop timer PT0
Clear timer PT0
Message received?
No
UART BOOT
Count += 1
Count = 5?
Stop timer PT0
Initialize CAN
Address = FA40h
No
[Address] = MO15_data0
Address = Address + 1
Address = FAC0h?
CAN BOOT
No
Jump to address FA40h
Other than after a normal reset the watchdog timer is disabled, so the bootstrap loading
sequence is not time limited. Depending on the selected serial link (UART0 or CAN1), pin
TxD0 or CAN1_TxD is configured as output, so the ST10F276E can return the acknowledge
byte. Even if the internal IFLASH is enabled, a code cannot be executed from it.
49/231
Bootstrap loaderST10F276E
5.2.3 Booting steps
As Figure 6 shows, booting ST10F276E with the boot loader code occurs in a minimum of
four steps:
1.The ST10F276E is reset with P0L.4 low.
2. The internal new bootstrap code runs on the ST10 and a first level user code is
downloaded from the external device, via the selected serial link (UART0 or CAN1).
The bootstrap code is contained in the ST10F276E Test-Flash and is automatically run
when ST10F276E is reset with P0L.4 low. After loading a preselected number of bytes,
ST10F276E begins executing the downloaded program.
3. The first level user code runs on ST10F276E. Typically, this first level user code is
another loader that downloads the application software into the ST10F276E.
4. The loaded application software is now running.
Figure 6.Booting steps for ST10F276E
Step 1
Entering bootstrap
Loading first level user code
Step 2
Step 3
Loading the application
and exiting BSL
Step 4
5.2.4 Hardware to activate BSL
The hardware that activates the BSL during reset may be a simple pull-down resistor on
P0L.4 for systems that use this feature at every hardware reset. For systems that use the
bootstrap loader only temporarily, it may be preferable to use a switchable solution (via
jumper or an external signal).
External device
External device
External device
External device
Download
First level user code
Download
Application
ST10F276E
Link
Serial
ST10F276E
Link
Serial
Run bootstrap code
from Test-Flash
ST10F276E
Link
Serial
Run first level code
from DPRAM @ FA40h
ST10F276E
Link
Serial
Run application code
Note:CAN alternate function on Port4 lines is not activated if the user has selected eight address
segments (Port4 pins have three functions: I/O port, address segment and CAN). Boot via
CAN requires that four or less address segments are selected.
50/231
ST10F276EBootstrap loader
Figure 7.Hardware provisions to activate the BSL
External
signal
Normal boot
P0L.4
R
P0L.4
8kΩ max.
P0L.4
BSL
R
P0L.4
8kΩ max.
Circuit 1
5.2.5 Memory configuration in bootstrap loader mode
The configuration (that is, the accessibility) of the ST10F276E’s memory areas after reset in
Bootstrap Loader mode differs from the standard case. Pin EA
is selected to enable or to not enable the external bus:
●If EA = 1, the external bus is disabled (BUSACT0 = 0 in BUSCON0 register);
●If EA = 0, the external bus is enabled (BUSACT0 = 1 in BUSCON0 register).
Moreover, while in BSL mode, accesses to the internal IFLASH area are partially redirected:
●All code accesses are made from the special Test-Flash seen in the range 00’0000h to
00’01FFFh;
●User IFLASH is only available for read and write accesses (Test-Flash cannot be read
or written);
●Write accesses must be made with addresses starting in segment 1 from 01'0000h,
regardless of the value of ROMS1 bit in SYSCON register;
●Read accesses are made in segment 0 or in segment 1 depending on the ROMS1
value;
●In BSL mode, by default, ROMS1 = 0, so the first 32 Kbytes of IFlash are mapped in
segment 0.
Example:
In default configuration, to program address 0, the user must put the value 01'0000h in
the FARL and FARH registers but to verify the content of the address 0 a read to
00'0000h must be performed.
User IFLASH accessUser IFLASH accessUser IFLASH access
Note:As long as ST10F276E is in BSL, the user’s software should not try to execute code from
the internal IFlash, as the fetches are redirected to the Test-Flash.
5.2.6 Loading the start-up code
After the serial link initialization sequence (see following chapters), the BSL enters a loop to
receive 32 bytes (boot via UART) or 128 bytes (boot via CAN).
These bytes are stored sequentially into ST10F276E Dual-Port RAM from location
00’FA40h.
To execute the loaded code, the BSL then jumps to location 00’FA40h. The bootstrap
sequence running from the Test-Flash is now terminated; however, the microcontroller
remains in BSL mode.
Most probably, the initially loaded routine, being the first level user code, will load additional
code and data. This first level user code may use the pre-initialized interface (UART or CAN)
to receive data and a second level of code, and store it in arbitrary user-defined locations.
This second level of code may be
●the final application code
●another, more sophisticated, loader routine that adds a transmission protocol to
enhance the integrity of the loaded code or data
●a code sequence to change the system configuration and enable the bus interface to
store the received data into external memory
In all cases, the ST10F276E still runs in BSL mode, that is, with the watchdog timer disabled
and limited access to the internal IFLASH area.
52/231
ST10F276EBootstrap loader
5.2.7 Exiting bootstrap loader mode
To execute a program in normal mode, the BSL mode must first be terminated. The
ST10F276E exits BSL mode at a software reset (level on P0L.4 is ignored) or a hardware
reset (P0L.4 must be high in this case). After the reset, the ST10F276E starts executing
from location 00’0000
programmed via pin EA
of the internal Flash (User Flash) or the external memory, as
H
.
Note:If a bidirectional software reset is executed and external memory boot is selected (EA
a degeneration of the software reset event into a hardware reset can occur (refer to
Section 19.3: Synchronous reset (warm reset) for details). This implies that P0L.4 becomes
transparent, so to exit from Bootstrap mode it would be necessary to release pin P0L.4 (it is
no longer ignored).
5.2.8 Hardware requirements
Although the new bootstrap loader is designed to be compatible with the old bootstrap
loader, there are a few hardware requirements relative to the new bootstrap loader:
–External Bus configuration: Must have four or less segment address lines (keep
CAN I/Os available);
–Usage of CAN pins (P4.5 and P4.6): Even in bootstrap via UART, P4.5
(CAN1_RxD) can be used as Port input but not as output. The pin P4.6
(CAN1_TxD) can be used as input or output.
–Level on UART RxD and CAN1_RxD during the bootstrap phase (see Figure 6 -
Step 2): Must be 1 (external pull-ups recommended).
5.3 Standard bootstrap with UART (RS232 or K-Line)
5.3.1 Features
ST10F276E bootstrap via UART has the same overall behavior as the old ST10 bootstrap
via UART:
●Same bootstrapping steps
●Same bootstrap method: Analyze the timing of a predefined byte, send back an
acknowledge byte, load a fixed number of bytes and run
●Same functionalities: Boot with different crystals and PLL ratios
=0),
53/231
Bootstrap loaderST10F276E
Figure 9.UART bootstrap loader sequence
RSTIN
P0L.4
(1)
(2)
RxD0
TxD0
CSP:IP
(6)
Int. Boot ROM / Test-Flash BSL-routine
1. BSL initialization time, > 1ms @ f
2. Zero byte (1 start bit, eight ‘0’ data bits, 1 stop bit), sent by host
3. Acknowledge byte, sent by ST10F276E
4. 32 bytes of code / data, sent by host
5. Caution: TxD0 is only driven a certain time after reception of the zero byte (1.3ms @ f
6. Internal Boot ROM / Test-Flash
= 40 MHz
CPU
5.3.2 Entering bootstrap via UART
The ST10F276E enters BSL mode if pin P0L.4 is sampled low at the end of a hardware
reset. In this case, the built-in bootstrap loader is activated independently of the selected
bus mode. The bootstrap loader code is stored in a special Test-Flash; no part of the
standard mask ROM or Flash memory area is required for this.
(4)
(3)
(5)
32 bytes
user software
= 40 MHz).
CPU
After entering BSL mode and the respective initialization, the ST10F276E scans the RxD0
line to receive a zero byte, that is, 1 start bit, eight ‘0’ data bits and 1 stop bit. From the
duration of this zero byte, it calculates the corresponding baud rate factor with respect to the
current CPU clock, initializes the serial interface ASC0 accordingly and switches pin TxD0 to
output. Using this baud rate, an acknowledge byte is returned to the host that provides the
loaded data.
The acknowledge byte is D5h for the ST10F276E.
54/231
ST10F276EBootstrap loader
5.3.3 ST10 Configuration in UART BSL (RS232 or K-Line)
When the ST10F276E enters BSL mode on UART, the configuration shown in Ta bl e 3 0 is
automatically set (values that deviate from the normal reset values are marked in bold).
Table 30.ST10 configuration in UART BSL mode (RS232 or K-line)
Function or registerAccessNotes
Watchdog timerDisabled
Register SYSCON0400
Context Pointer CPFA00
Register STKUNFA00
Stack Pointer SPFA40
Register STKOVFC00
Register BUSCON0acc. to startup config.
(1)
H
H
H
H
H
(2)
Register S0CON8011
Register S0BGacc. to ‘00’ byteInitialized only if Bootstrap via UART
P3.10 / TXD0‘1’Initialized only if Bootstrap via UART
DP3.10‘1’Initialized only if Bootstrap via UART
1. In Bootstrap modes (standard or alternate) ROMEN, bit 10 of SYSCON, is always set regardless of EA pin
level. BYTDIS, bit 9 of SYSCON, is set according to data bus width selection via Port0 configuration.
2. BUSCON0 is initialized with 0000h, external bus disabled, if pin EA is high during reset. If pin EA is low
during reset, BUSACT0, bit 10, and ALECTL0, bit 9, are set enabling the external bus with lengthened ALE
signal. BTYP field, bit 7 and 6, is set according to Port0 configuration.
Other than after a normal reset, the watchdog timer is disabled, so the bootstrap loading
sequence is not time limited. Pin TxD0 is configured as output, so the ST10F276E can
return the acknowledge byte. Even if the internal IFLASH is enabled, a code cannot be
executed from it.
5.3.4 Loading the start-up code
After sending the acknowledge byte, the BSL enters a loop to receive 32 bytes via ASC0.
These bytes are stored sequentially into locations 00’FA40
allowing up to 16 instructions to be placed into the RAM area. To execute the loaded code
the BSL then jumps to location 00’FA40H, that is, the first loaded instruction. The bootstrap
loading sequence is now terminated; however, the ST10F276E remains in BSL mode. The
initially loaded routine will most probably load additional code or data, as an average
application is likely to require substantially more than 16 instructions. This second receive
loop may directly use the pre-initialized interface ASC0 to receive data and store it in
arbitrary user-defined locations.
H
Initialized only if Bootstrap via UART
through 00’FA5FH of the IRAM,
H
This second level of loaded code may be
●the final application code
●another, more sophisticated, loader routine that adds a transmission protocol to
enhance the integrity of the loaded code or data
●a code sequence to change the system configuration and enable the bus interface to
store the received data into external memory
55/231
Bootstrap loaderST10F276E
This process may go through several iterations or may directly execute the final application.
In all cases the ST10F276E still runs in BSL mode, that is, with the watchdog timer disabled
and limited access to the internal Flash area. All code fetches from the internal IFLASH area
(01’0000
...08’FFFFH) are redirected to the special Test-Flash. Data read operations
H
access the internal Flash of the ST10F276E.
5.3.5 Choosing the baud rate for the BSL via UART
The calculation of the serial baud rate for ASC0 from the length of the first zero byte that is
received allows the operation of the bootstrap loader of the ST10F276E with a wide range of
baud rates. However, the upper and lower limits must be kept to ensure proper data transfer.
Equation 1
f
CPU
B
ST10F276E
The ST10F276E uses timer T6 to measure the length of the initial zero byte. The
quantization uncertainty of this measurement implies the first deviation from the real baud
rate; the next deviation is implied by the computation of the S0BRL reload value from the
timer contents. The formula below shows the association:
------------------------------------------ -
=
32S0BRL 1
+()⋅
Equation 2
For a correct data transfer from the host to the ST10F276E, the maximum deviation
between the internal initialized baud rate for ASC0 and the real baud rate of the host should
be below 2.5%. The deviation (F
baud rate can be calculated using the formula below:
Equation 3
Note:Function (F
the serial communication.
This baud rate deviation is a nonlinear function depending on the CPU clock and the baud
rate of the host. The maxima of the function (F
the smaller baud rate prescaler factors and the implied higher quantization error (see
Figure 10).
f
CPU
S0BRL
F
B
) does not consider the tolerances of oscillators and other devices supporting
B
T6 36–
------------------- -=
, in percent) between host baud rate and ST10F276E
B
B
ContrBHost
--------------------------------------- -
B
Contr
72
,
–
B
9
--
T6
---------------
⋅=
B
4
Host
%
100⋅=
,
FB2.5≤
%
) increases with the host baud rate due to
56/231
ST10F276EBootstrap loader
Figure 10. Baud rate deviation between host and ST10F276E
F
B
2.5%
B
Low
The minimum baud rate (B
of timer T6, when measuring the zero byte, that is, it depends on the CPU clock. Using the
maximum T6 count 2
16
B
High
in Figure 10) is determined by the maximum count capacity
Low
in the formula the minimum baud rate is calculated. The lowest
standard baud rate in this case would be 1200 baud. Baud rates below B
I
B
II
would cause
Low
HOST
T6 to overflow. In this case, ASC0 cannot be initialized properly.
The maximum baud rate (B
still does not exceed the limit, that is, all baud rates between B
in Figure 10) is the highest baud rate where the deviation
High
Low
and B
are below the
High
deviation limit. The maximum standard baud rate that fulfills this requirement is 19200 baud.
Higher baud rates, however, may be used as long as the actual deviation does not exceed
the limit. A certain baud rate (marked “I” in Figure 10) may, for example, violate the deviation
limit, while an even higher baud rate (marked “II” in Figure 10) stays well below it. This
depends on the host interface.
5.4 Standard bootstrap with CAN
5.4.1 Features
The bootstrap via CAN has the same overall behavior as the bootstrap via UART:
●Same bootstrapping steps;
●Same bootstrap method: Analyze the timing of a predefined frame, send back an
acknowledge frame BUT only on request
●Same functionalities: Boot with different crystals and PLL ratios.
, load a fixed number of bytes and run;
57/231
Bootstrap loaderST10F276E
Figure 11. CAN bootstrap loader sequence
RSTIN
P0L.4
CAN1_RxD
CAN1_TxD
CSP:IP
1. BSL initialization time, > 1ms @ f
2. Zero frame (CAN message: standard ID = 0, DLC = 0), sent by host
3. CAN message (standard ID = E6h, DLC = 3, Data0 = D5h, Data1-Data2 = IDCHIP_low-high), sent by
ST10F276E on request
4. 128 bytes of code / data, sent by host
5. Caution: CAN1_TxD is only driven a certain time after reception of the zero byte (1.3ms @ f
6. Internal Boot ROM / Test-Flash
(1)
(2)
(3)
(5)
Int. Boot ROM / Test-Flash BSL-routine
(6)
= 40 MHz
CPU
(4)
128 bytes
user software
= 40 MHz).
CPU
The Bootstrap Loader can load
●the complete application software into ROM-less systems,
●temporary software into complete systems for testing or calibration,
●a programming routine for Flash devices.
The BSL mechanism may be used for standard system start-up as well as for only special
occasions like system maintenance (firmware update) or end-of-line programming or
testing.
5.4.2 Entering the CAN bootstrap loader
The ST10F276E enters BSL mode if pin P0L.4 is sampled low at the end of a hardware
reset. In this case, the built-in bootstrap loader is activated independently of the selected
bus mode. The bootstrap loader code is stored in a special Test-Flash; no part of the
standard mask ROM or Flash memory area is required for this.
After entering BSL mode and the respective initialization, the ST10F276E scans the
CAN1_TxD line to receive the following initialization frame:
● Standard identifier = 0h
● DLC = 0h
As all the bits to be transmitted are dominant bits, a succession of 5 dominant bits and 1
stuff bit on the CAN network is used. From the duration of this frame, it calculates the
corresponding baud rate factor with respect to the current CPU clock, initializes the CAN1
interface accordingly, switches pin CAN1_TxD to output and enables the CAN1 interface to
take part in the network communication. Using this baud rate, a Message Object is
58/231
ST10F276EBootstrap loader
configured in order to send an acknowledge frame. The ST10F276E will not send this
Message Object but the host can request it by sending a remote frame.
The acknowledge frame is the following for the ST10F276E:
–Standard identifier = E6h
–DLC = 3h
–Data0 = D5h, that is, generic acknowledge of the ST10 devices
–Data1 = IDCHIP least significant byte
–Data2 = IDCHIP most significant byte
For the ST10F276E, IDCHIP = 114Xh.
Note:Two behaviors can be distinguished in ST10 acknowledging to the host. If the host is
behaving according to the CAN protocol, as at the beginning the ST10 CAN is not
configured, the host is alone on the CAN network and does not receive an acknowledge. It
automatically resends the zero frame. As soon as the ST10 CAN is configured, it
acknowledges the zero frame. The “acknowledge frame” with identifier 0xE6 is configured,
but the Transmit Request is not set. The host can request this frame to be sent and therefore
obtains the IDCHIP by sending a remote frame.
Hint: As the IDCHIP is sent in the acknowledge frame, Flash programming software now
can immediately identify the exact type of device to be programmed.
59/231
Bootstrap loaderST10F276E
5.4.3 ST10 configuration in CAN BSL
When the ST10F276E enters BSL mode via CAN, the configuration shown in Ta bl e 3 1 is
automatically set (values that deviate from the normal reset values are marked in bold).
Table 31.ST10 configuration in CAN BSL
Function or registerAccessNotes
Watchdog timerDisabled
Register SYSCON
Context pointer CPFA00
Register STKUNFA00
Stack pointer SPFA40
Register STKOVFC00
Register BUSCON0
CAN1 Status/Control register 0000
CAN1 Bit timing registeracc. to ‘0’ frameInitialized only if Bootstrap via CAN
XPERCON042D
P4.6 / CAN1_TxD‘1’Initialized only if Bootstrap via CAN
(1)
0404H
H
H
H
H
acc. to startup
(2)
config.
H
H
XPEN bit set
Initialized only if Bootstrap via CAN
XRAM1-2, XFlash, CAN1 and XMISC enabled
DP4.6‘1’Initialized only if Bootstrap via CAN
1. In Bootstrap modes (standard or alternate) ROMEN, bit 10 of SYSCON, is always set regardless of EA pin
level. BYTDIS, bit 9 of SYSCON, is set according to data bus width selection via Port0 configuration.
2. BUSCON0 is initialized with 0000h, external bus disabled, if pin EA is high during reset. If pin EA is low
during reset, BUSACT0, bit 10, and ALECTL0, bit 9, are set enabling the external bus with lengthened ALE
signal. BTYP field, bit 7 and 6, is set according to Port0 configuration.
Other than after a normal reset, the watchdog timer is disabled, so the bootstrap loading
sequence is not time limited. Pin CAN1_TxD1 is configured as output, so the ST10F276E
can return the identification frame. Even if the internal IFLASH is enabled, a code cannot be
executed from it.
5.4.4 Loading the start-up code via CAN
After sending the acknowledge byte, the BSL enters a loop to receive 128 bytes via CAN1.
Hint: The number of bytes loaded when booting via the CAN interface has been extended to
128 bytes to allow the reconfiguration of the CAN Bit Timing Register with the best timings
(synchronization window, ...). This can be achieved by the following sequence of
instructions:
ReconfigureBaud rate:
MOVR1,#041h
MOVDPP3:0EF00h,R1; Put CAN in Init, enable Configuration Change
MOVR1,#01600h
MOVDPP3:0EF06h,R1; 1MBaud at Fcpu = 20 MHz
These 128 bytes are stored sequentially into locations 00’FA40
IRAM, allowing up to 64 instructions to be placed into the RAM area. To execute the loaded
code the BSL then jumps to location 00’FA40
bootstrap loading sequence is now terminated; however, the ST10F276E remains in BSL
60/231
through 00’FABFH of the
H
, that is, the first loaded instruction. The
H
ST10F276EBootstrap loader
mode. Most probably the initially loaded routine will load additional code or data, as an
average application is likely to require substantially more than 64 instructions. This second
receive loop may directly use the pre-initialized CAN interface to receive data and store it in
arbitrary user-defined locations.
This second level of loaded code may be
●the final application code
●another, more sophisticated, loader routine that adds a transmission protocol to
enhance the integrity of the loaded code or data
●a code sequence to change the system configuration and enable the bus interface to
store the received data into external memory
This process may go through several iterations or may directly execute the final application.
In all cases the ST10F276E still runs in BSL mode, that is, with the watchdog timer disabled
and limited access to the internal Flash area. All code fetches from the internal Flash area
(01’0000
...08’FFFFH) are redirected to the special Test-Flash. Data read operations will
H
access the internal Flash of the ST10F276E.
5.4.5 Choosing the baud rate for the BSL via CAN
The Bootstrap via CAN acts the same way as in the UART bootstrap mode. When the
ST10F276E is started in BSL mode, it polls the RxD0 and CAN1_RxD lines. When polling a
low level on one of these lines, a timer is launched that is stopped when the line returns to
high level.
For CAN communication, the algorithm is made to receive a zero frame, that is, the standard
identifier is 0x0, DLC is 0. This frame produces the following levels on the network: 5D, 1R,
5D, 1R, 5D, 1R, 5D, 1R, 5D, 1R, 4D, 1R, 1D, 11R. The algorithm lets the timer run until the
detection of the 5
bit times: This minimizes the error introduced by the polling
th
recessive bit. This way the bit timing is calculated over the duration of 29
.
Figure 12. Bit rate measurement over a predefined zero-frame
StartStuff bitStuff bitStuff bitStuff bit
........
Measured time
61/231
Bootstrap loaderST10F276E
Error induced by the polling
The code used for the polling is the following:
WaitCom:
JNBP4.5,CAN_Boot; if SOF detected on CAN, then go to
CAN
; loader
JBP3.11,WaitCom; Wait for start bit at RxD0
BSET T6R; Start Timer T6
....
CAN_Boot:
BSET PWMCON0.0; Start PWM Timer0
; (resolution is 1 CPU clk cycle)
JMPR cc_UC,WaitRecessiveBit
WaitDominantBit:
JBP4.5,WaitDominantBit; wait for end of stuff bit
WaitRecessiveBit:
JNBP4.5,WaitRecessiveBit; wait for 1st dominant bit = Stuff
bit
CMPI1R1,#5; Test if 5th stuff bit detected
JMPR cc_NE,WaitDominantBit; No, go back to count more
BCLR PWMCON.0; Stop timer
; here the 5th stuff bit is detected:
; PT0 = 29 Bit_Time (25D and 4R)
Therefore the maximum error at the detection of the communication on CAN pin is:
(1 not taken + 1 taken jumps) + 1 taken jump + 1 bit set: (6) + 6 CPU clock cycles
The error at the detection for the 5
th
recessive bit is:
(1 taken jump) + 1 not taken jump + 1 compare + 1 bit clear: (4) + 6 CPU cycles
In the worst case, the induced error is 6 CPU clock cycles, so the polling could induce an
error of 6 timer ticks.
Error induced by the baud rate calculation
The content of the timer PT0 counter corresponds to 29 bit times, resulting in the following
equation:
PT0 = 58 x (BRP + 1) X (1 + Tseg1 + Tseg2)
where BRP, Tseg1 and Tseg2 are the field of the CAN Bit Timing register.
The CAN protocol specification recommends to implement a bit time composed of at least 8
time quanta (tq). This recommendation is applied here. Moreover, the maximum bit time
length is 25 tq. To ensure precision, the aim is to have the smallest Bit Rate Prescaler (BRP)
and the maximum number of tq in a bit time.
This gives the following ranges for PT0 according to BRP:
8 ≤ 1 + Tseg1 + Tseg2 ≤ 25
464 x (1 + BRP) ≤ PT0 ≤ 1450 x (1 + BRP)
62/231
ST10F276EBootstrap loader
Table 32.BRP and PT0 values
BRPPT0_minPT0_maxComments
04641450
114512900
229014350
343515800
458017250
572518700
......
432041663800
442088065250
452134466700Possible timer overflow
......
63XX
The error coming from the measurement of the 29 bit is:
e
= 6 / [PT0]
1
It is maximal for the smallest BRP value and the smallest number of ticks in PT0. Therefore:
e
= 1.29%
1 Max
To improve precision, the aim is to have the smallest BRP so that the time quantum is the
smallest possible. Thus, an error on the calculation of time quanta in a bit time is minimal.
In order to do so, the value of PT0 is divided into ranges of 1450 ticks. In the algorithm, PT0
is divided by 1451 and the result is BRP.
The calculated BRP value is then used to divide PT0 in order to have the value of (1 + Tseg1 + Tseg2). A table is made to set the values for Tseg1 and Tseg2 according to the
value of (1 + Tseg1 + Tseg2). These values of Tseg1 and Tseg2 are chosen in order to
reach a sample point between 70% and 80% of the bit time.
During the calculation of (1 + Tseg1 + Tseg2), an error e
can be introduced by the division.
2
This error is of 1 time quantum maximum.
To compensate for any possible error on bit rate, the (Re)Synchronization Jump Width is
fixed to 2 time quanta.
63/231
Bootstrap loaderST10F276E
5.4.6 Computing the baud rate error
Considering the following conditions, a computation of the error is given as an example.
●CPU frequency: 20 MHz
●Target Bit Rate: 1 Mbit/s
In these conditions, the content of PT0 timer for 29 bits should be:
PT0[]
29Fcpu×
-------------------------- BitRate
2920×6×
---------------------------- -580===
110
×
6
Therefore:
574 < [PT0] < 586
This gives:
BRP = 0
tq = 100 ns
Computation of 1 + Tseg1 + Tseg2: Considering the equation:
[PT0] = 58 x (1 + BRP) x (1 + Tseg1 + Tseg2)
Thus:
574
--------- -
9
Tseg1Tseg2
58
586
----------10=≤+≤=
58
In the algorithm, a rounding up to the superior value is made if the remainder of the division
is greater than half of the divisor. This would have been the case if the PT0 content was 574.
Thus, in this example the result is 1 + Tseg1 + Tseg2 = 10, giving a bit time of exactly 1µs
=> no error in bit rate.
Note:In most cases (24 MHz, 32 MHz, 40 MHz of CPU frequency and 125, 250, 500 or 1Mb/s of
bit rate), there is no error. Nevertheless, it is better to check for an error with the real
application parameters.
The content of the bit timing register is: 0x1640. This gives a sample point at 80%.
Note:The (Re)Synchronization Jump Width is fixed to 2 time quanta.
5.4.7 Bootstrap via CAN
After the bootstrap phase, the ST10F276E CAN module is configured as follows:
●The pin P4.6 is configured as output (the latch value is ‘1’ = recessive) to assume
CAN1_TxD function.
●The MO2 is configured to output the acknowledge of the bootstrap with the standard
identifier E6h, a DLC of 3 and Data0 = D5h, Data1 and 2 = IDCHIP.
●The MO1 is configured to receive messages with the standard identifier 5h. Its
acceptance mask is set to ensure that all bits match. The DLC received is not checked:
The ST10 expects only 1 byte of data at a time.
No other message is sent by the ST10F276E after the acknowledge.
Note:The CAN boot waits for 128 bytes of data instead of 32 bytes (see UART boot). This is done
to allow the User to reconfigure the CAN bit rate as soon as possible.
64/231
ST10F276EBootstrap loader
5.5 Comparing the old and the new bootstrap loader
Ta bl e 3 3 and Ta bl e 3 4 summarize the differences between the old ST10 (boot via UART
only) bootstrap and the new one (boot via UART or CAN).
5.5.1 Software aspects
As the CAN1 is needed, XPERCON register is configured by the bootstrap loader code and
bit XPEN of SYSCON is set. However, as long as the EINIT instruction is not executed (and
it is not in the bootstrap loader code), the settings can be modified. To do this, perform the
following steps:
1.Disable the XPeripherals by clearing XPEN in SYSCON register. Attention: If this part
of the code is located in XRAM, it will be disabled.
2. Enable the needed XPeripherals by writing the correct value in XPERCON register.
3. Set XPEN bit in SYSCON.
Table 33.Software topics summary
Former bootstrap loaderNew bootstrap loaderComments
For compatibility between boot
Uses only 32 bytes in Dual-Port
RAM from 00’FA40h
Loads 32 bytes from UART
Uses up to 128 bytes in DualPort RAM from 00’FA40h
Loads 32 bytes from UART
(boot via UART mode)
via UART and boot via CAN1,
please avoid loading the
application software in the
00’FA60h/00’FABFh range.
Same files can be used for boot
via UART.
User selected Xperipherals can
be enabled during boot (Step 3
or Step 4).
5.5.2 Hardware aspects
Although the new bootstrap loader is designed to be compatible with the old bootstrap
loader, there are a few hardware requirements for the new bootstrap loader as summarized
in Ta bl e 3 4.
Table 34.Hardware topics summary
Former bootstrap loaderNew bootstrap loaderComments
P4.5 can be used as output in
BSL mode.
Level on CAN1_RxD can
change during boot Step 2.
Xperipherals selection is fixed.
P4.5 cannot be used as user
output in BSL mode, but only as
CAN1_RxD or input or address
segments.
Level on CAN1_RxD must be
stable at ‘1’ during boot Step 2.
User can change the
Xperipherals selections through
a specific code.
-
External pull-up on P4.5
needed.
65/231
Bootstrap loaderST10F276E
5.6 Alternate boot mode (ABM)
5.6.1 Activation
Alternate boot is activated with the combination ‘01’ on Port0L[5..4] at the rising edge of
RSTIN
5.6.2 Memory mapping
The ST10F276E has the same memory mapping for standard boot mode and for alternate
boot mode:
●Test-Flash: Mapped from 00’0000h. The Standard Bootstrap Loader can be started by
●User Flash: The User Flash is divided in two parts: The IFLASH, visible only for
●All ST10F276E XRAM and Xperipherals modules can be accessed if enabled in
Note:The alternate boot mode can be used to reprogram the whole content of the ST10F276E
User Flash (except Block 0 in Bank 2, where the alternate boot is mapped into).
.
executing a jump to the address of this routine (JMPS 00’xxxx; address to be defined).
memory reads and memory writes (no code fetch) and the XFLASH, visible for any
ST10 access (memory read, memory write and code fetch).
XPERCON register.
5.6.3 Interrupts
The ST10 interrupt vector table is always mapped from address 00’0000h.
As a consequence, interrupts are not allowed in Alternate Boot Mode; all maskable and nonmaskable interrupts must be disabled.
5.6.4 ST10 configuration in alternate boot mode
When the ST10F276E enters BSL mode via CAN, the configuration shown in Ta bl e 3 5 is
automatically set (values that deviate from the normal reset values are marked in bold).
Table 35.ST10 configuration in alternate boot mode
Function or registerAccessNotes
Watchdog timerDisabled
Register SYSCON0404H
Context pointer CPFA00
Register STKUNFA00
Stack pointer SPFA40
Register STKOVFC00
Register BUSCON0
XPERCON002D
1. In Bootstrap modes (standard or alternate) ROMEN, bit 10 of SYSCON, is always set regardless of EA pin
level. BYTDIS, bit 9 of SYSCON, is set according to data bus width selection via Port0 configuration.
2. BUSCON0 is initialized with 0000h, external bus disabled, if pin EA is high during reset. If pin EA is low
during reset, BUSACT0, bit 10, and ALECTL0, bit 9, are set enabling the external bus with lengthened ALE
signal. BTYP field, bit 7 and 6, is set according to Port0 configuration.
(1)
H
H
H
H
acc. to startup config.
H
XPEN bit set
(2)
XRAM1-2, XFlash, CAN1 enabled
66/231
ST10F276EBootstrap loader
Even if the internal IFLASH is enabled, a code cannot be executed from it.
As the XFlash is needed, XPERCON register is configured by the ABM loader code and bit
XPEN of SYSCON is set. However, as long as the EINIT instruction is not executed (and it is
not in the bootstrap loader code), the settings can be modified. To do this, perform the
following steps:
1.Copy in DPRAM a function that will
a) disable the XPeripherals by clearing XPEN in SYSCON register,
b) enable the needed XPeripherals by writing the correct value in XPERCON
register,
c) set XPEN bit in SYSCON,
d) return to calling address.
2. Call the function from XFlash
The changing of the XPERCON value cannot be executed from the XFlash because the
XFlash is disabled by the clearing of XPEN bit in SYSCON.
5.6.5 Watchdog
As for standard boot, the Watchdog timer remains disabled during Alternate Boot Mode. In
case a Watchdog reset occurs, a software reset is generated.
Note:See note from Section 5.2.7 concerning software reset.
5.6.6 Exiting alternate boot mode
Once the ABM mode is entered, it can be exited only with a software or hardware reset.
Note:See note from Section 5.2.7 concerning software reset.
5.6.7 Alternate boot user software
If the rules described previously are respected (that is, mapping of variables, disabling of
interrupts, exit conditions, predefined vectors in Block 0 of Bank 2, Watchdog usage), then
users can write the software they want to execute in this mode starting from 09’0000h.
The behavior of the Alternate Boot Mode is based on the computing of a signature between
the content of two memory locations and a comparison with a reference signature. This
requires that users who use Alternate Boot have reserved and programmed the Flash
memory locations according to:
User mode signature
00'0000h: memory address of operand0 for the signature computing
00’1FFCh: memory address of operand1 for the signature computing
00’1FFEh: memory address for the signature reference
Alternate mode signature
09'0000h: memory address of operand0 for the signature computing
09’1FFCh: memory address of operand1 for the signature computing
09’1FFEh: memory address for the signature reference
67/231
Bootstrap loaderST10F276E
The values for operand0, operand1 and the signature should be such that the sequence
shown in the figure below is successfully executed.
MOVRx, CheckBlock1Addr; 00’0000h for standard reset
ADDRx, CheckBlock2Addr; 00’1FFCh for standard reset
CPLBRLx; 1s complement of the lower
; byte of the sum
CMP Rx, CheckBlock3Addr; 00’1FFEh for standard reset
5.6.9 Alternate boot user software aspects
User defined alternate boot code must start at 09’0000h. A new SFR created on the
ST10F276E indicates that the device is running in Alternate Boot Mode: Bit 5 of EMUCON
(mapped at 0xFE0Ah) is set when the alternate boot is selected by the reset configuration.
All the other bits are ignored when checking the content of this register to read the value of
bit 5.
This bit is a read-only bit. It remains set until the next software or hardware reset.
5.6.10 EMUCON register
EMUCON (FE0Ah / 05h)SFRReset value: - xxh:
1514131211109876543210
-ABM
-R-
Table 36.ABM bit description
BitFunction
ABM Flag (or TMOD3)
ABM
0: Alternate Boot Mode is not selected by reset configuration on P0L[5..4]
1: Alternate Boot Mode is selected by reset configuration on P0L[5..4]: This bit is
set if P0L[5..4] = ‘01’ during hardware reset.
5.6.11 Internal decoding of test modes
The test mode decoding logic is located inside the ST10F276E Bus Controller.
The decoding is as follows:
●Alternate Boot Mode decoding: (P0L.5 & P0L.4)
●Standard Bootstrap decoding: (P0L.5 & P0L.4)
●Normal operation: (P0L.5 & P0L.4)
The other configurations select ST internal test modes.
68/231
ST10F276EBootstrap loader
5.6.12 Example
In the following example, Alternate Boot Mode works as follows:
–On rising edge of RSTIN
●If Bootstrap Loader mode is not enabled (P0L[5..4] = ‘11’), ST10F276E hardware
pin, the reset configuration is latched.
proceeds with a standard hardware reset procedure.
●If standard Bootstrap Loader is enabled (P0L[5..4] = ‘10’), the standard ST10 Bootstrap
Loader is enabled and a variable is cleared to indicate that ABM is not enabled.
●If Alternate Boot Mode is selected (P0L[5..4] = ‘01’), then, depending on signatures
integrity checks, a predefined reset sequence is activated.
5.7 Selective boot mode
The selective boot is a subcase of the Alternate Boot Mode. When none of the signatures
are correct, instead of executing the standard bootstrap loader (triggered by P0L.4 low at
reset), an additional check is made.
Address 00’1FFCh is read again with the following behavior:
●If value is 0000h or FFFFh, a jump is performed to the standard bootstrap loader.
●Otherwise:
–High byte is disregarded.
–Low byte bits select which communication channel is enabled.
Table 37.Selective boot
BitFunction
UART selection
0
1
2..7
0: UART is not watched for a Start condition.
1: UART is watched for a Start condition.
CAN1 selection
0: CAN1 is not watched for a Start condition.
1: CAN1 is watched for a Start condition.
Reserved
For upward compatibility, must be programmed to ‘0’
Therefore a value:
●0xXX03 configures the Selective Bootstrap Loader to poll for RxD0 and CAN1_RxD.
●0xXX01 configures the Selective Bootstrap Loader to poll only RxD0 (no boot via CAN).
●0xXX02 configures the Selective Bootstrap Loader to poll only CAN1_RxD (no boot via
UART).
●Other values allow the ST10F276E to execute an endless loop into the Test-Flash.
69/231
Bootstrap loaderST10F276E
Figure 13. Reset boot sequence
RSTIN 0 to 1
Standard start
Yes (P0L[5..4] = ‘01’)
Boot mode?
Yes (P0L[5..4] = ‘10’)
No (P0L[5..4] = ‘11’)
No (P0L[5..4] = ‘other config.’)
ST test modes
Software checks
user reset vector
(K1 is OK?)
K1 is not OK
Software Checks
alternate reset vector
(K2 is OK?)
K2 is OK
Long jump to
09’0000h
ABM / User Flash
Start at 09’0000h
Selective Bootstrap Loader
K1 is OK
K2 is not OK
Read 00’1FFCh
Jump to Test-Flash
SW RESET
Running from test Flash
Std. Bootstrap Loader
Jump to Test-Flash
User Mode / User Flash
Start at 00’0000h
70/231
ST10F276ECentral processing unit (CPU)
6 Central processing unit (CPU)
The CPU includes a 4-stage instruction pipeline, a 16-bit arithmetic and logic unit (ALU) and
dedicated SFRs. Additional hardware has been added for a separate multiply and divide
unit, a bit-mask generator and a barrel shifter.
Most of the ST10F276E’s instructions can be executed in one instruction cycle which
requires 31.25ns at 64 MHz CPU clock. For example, shift and rotate instructions are
processed in one instruction cycle independent of the number of bits to be shifted.
Multiple-cycle instructions have been optimized: branches are carried out in 2 cycles, 16 x
16-bit multiplication in 5 cycles and a 32/16-bit division in 10 cycles.
The jump cache reduces the execution time of repeatedly performed jumps in a loop, from
2 cycles to 1 cycle.
The CPU uses a bank of 16 word registers to run the current context. This bank of General
Purpose Registers (GPR) is physically stored within the on-chip Internal RAM (IRAM) area.
A Context Pointer (CP) register determines the base address of the active register bank to
be accessed by the CPU.
The number of register banks is only restricted by the available Internal RAM space. For
easy parameter passing, a register bank may overlap others.
A system stack of up to 2048 bytes is provided as a storage for temporary data. The system
stack is allocated in the on-chip RAM area, and it is accessed by the CPU via the stack
pointer (SP) register.
Two separate SFRs, STKOV and STKUN, are implicitly compared against the stack pointer
value upon each stack access for the detection of a stack overflow or underflow.
Figure 14. CPU Block Diagram (MAC Unit not included)
16
512 Kbyte
Flash
memory
32
SP
STKOV
STKUN
Exec. Unit
Instr. Ptr
4-Stage
Pipeline
PSW
SYSCON
BUSCON 0
BUSCON 1
BUSCON 2
BUSCON 3
BUSCON 4
Data Pg. Ptrs
CPU
MDH
MDL
Mul./Div.-HW
Bit-Mask Gen.
ALU
16-Bit
Barrel-Shift
CP
ADDRSEL 1
ADDRSEL 2
ADDRSEL 3
ADDRSEL 4
Code Seg. Ptr.
R15
General
Purpose
Registers
R0
16
2Kbyte
Internal
RAM
Bank
n
Bank
i
Bank
0
71/231
Central processing unit (CPU)ST10F276E
6.1 Multiplier-accumulator unit (MAC)
The MAC coprocessor is a specialized coprocessor added to the ST10 CPU Core in order to
improve the performances of the ST10 Family in signal processing algorithms.
The standard ST10 CPU has been modified to include new addressing capabilities which
enable the CPU to supply the new coprocessor with up to 2 operands per instruction cycle.
This new coprocessor (so-called MAC) contains a fast multiply-accumulate unit and a repeat
unit.
The coprocessor instructions extend the ST10 CPU instruction set with multiply, multiplyaccumulate, 32-bit signed arithmetic operations.
Figure 15. MAC unit architecture
Operand 2Operand 1
16
16 x 16
Multiplier
40
Mux
40
GPR Pointers *
IDX0 Pointer
IDX1 Pointer
QR0 GPR Offset Register
QR1 GPR Offset Register
QX0 IDX Offset Register
QX1 IDX Offset Register
Interrupt
Controller
ST10 CPU
MRW
Repeat Unit
MCW
signed/unsigned
Concatenation
3232
Mux
Sign Extend
Scaler
0h0h08000h
4040
40
Mux
40
AB
40-bit Signed Arithmetic Unit
16
40
Control Unit
72/231
MSW
Flags MAE
40
MAHMAL
40
8-bit Left/Right
Shifter
ST10F276ECentral processing unit (CPU)
6.2 Instruction set summary
Ta bl e 3 8 lists the instructions of the ST10F276E. The detailed description of each
instruction can be found in the “ST10 Family Programming Manual”.
Table 38.Standard instruction set summary
MnemonicDescriptionBytes
ADD(B)Add word (byte) operands2 / 4
ADDC(B)Add word (byte) operands with Carry2 / 4
SUB(B)Subtract word (byte) operands2 / 4
SUBC(B)Subtract word (byte) operands with Carry2 / 4
MUL(U)(Un)Signed multiply direct GPR by direct GPR (16-16-bit)2
DIV(U)(Un)Signed divide register MDL by direct GPR (16-/16-bit)2
DIVL(U)(Un)Signed long divide reg. MD by direct GPR (32-/16-bit)2
CPL(B)Complement direct word (byte) GPR2
NEG(B)Negate direct word (byte) GPR2
AND(B)Bit-wise AND, (word/byte operands)2 / 4
OR(B)Bit-wise OR, (word/byte operands)2 / 4
XOR(B)Bit-wise XOR, (word/byte operands)2 / 4
BCLRClear direct bit2
BSETSet direct bit2
BMOV(N)Move (negated) direct bit to direct bit4
BAND, BOR, BXORAND/OR/XOR direct bit with direct bit4
BCMPCompare direct bit to direct bit4
BFLDH/L
CMP(B)Compare word (byte) operands2 / 4
CMPD1/2Compare word data to GPR and decrement GPR by 1/22 / 4
CMPI1/2Compare word data to GPR and increment GPR by 1/22 / 4
PRIOR
SHL / SHRShift left/right direct word GPR2
ROL / RORRotate left/right direct word GPR2
ASHRArithmetic (sign bit) shift right direct word GPR2
MOV(B)Move word (byte) data2 / 4
MOVBSMove byte operand to word operand with sign extension2 / 4
Bit-wise modify masked high/low byte of bit-addressable direct word
memory with immediate data
Determine number of shift cycles to normalize direct word GPR and
store result in direct word GPR
4
2
MOVBZMove byte operand to word operand with zero extension2 / 4
JMPA, JMPI, JMPRJump absolute/indirect/relative if condition is met4
JMPSJump absolute to a code segment4
73/231
Central processing unit (CPU)ST10F276E
Table 38.Standard instruction set summary (continued)
MnemonicDescriptionBytes
J(N)BJump relative if direct bit is (not) set4
JBCJump relative and clear bit if direct bit is set4
JNBSJump relative and set bit if direct bit is not set4
CALLA, CALLI,
CALLR
CALLSCall absolute subroutine in any code segment4
PCALL
TRAPCall interrupt service routine via immediate trap number2
PUSH, POPPush/pop direct word register onto/from system stack2
Call absolute/indirect/relative subroutine if condition is met4
Push direct word register onto system stack and call absolute
subroutine
In demultiplexed bus modes addresses are output on PORT1 and data is input / output on
PORT0 or P0L, respectively. In the multiplexed bus modes both addresses and data use
PORT0 for input / output.
Timing characteristics of the external bus interface (memory cycle time, memory tri-state
time, length of ALE and read / write delay) are programmable giving the choice of a wide
range of memories and external peripherals.
Up to four independent address windows may be defined (using register pairs ADDRSELx /
BUSCONx) to access different resources and bus characteristics.
These address windows are arranged hierarchically where BUSCON4 overrides BUSCON3
and BUSCON2 overrides BUSCON1.
All accesses to locations not covered by these four address windows are controlled by
BUSCON0. Up to five external CS
signals (four windows plus default) can be generated in
order to save external glue logic. Access to very slow memories is supported by a ‘Ready’
function.
A HOLD
/ HLDA protocol is available for bus arbitration which shares external resources
with other bus masters.
The bus arbitration is enabled by setting bit HLDEN in register PSW. After setting HLDEN
once, pins P6.7...P6.5 (BREQ
master mode (default after reset) the HLDA
slave mode is selected where pin HLDA
, HLDA, HOLD) are automatically controlled by the EBC. In
pin is an output. By setting bit DP6.7 to ‘1’ the
is switched to input. This directly connects the slave
controller to another master controller without glue logic.
For applications which require less external memory space, the address space can be
restricted to 1 Mbyte, 256 Kbytes or to 64 Kbytes. Port 4 outputs all eight address lines if an
address space of 16M Bytes is used, otherwise four, two or no address lines.
Chip select timing can be made programmable. By default (after reset), the CSx
lines
change half a CPU clock cycle after the rising edge of ALE. With the CSCFG bit set in the
SYSCON register the CSx
lines change with the rising edge of ALE.
The active level of the READY pin can be set by bit RDYPOL in the BUSCONx registers.
When the READY function is enabled for a specific address window, each bus cycle within
the window must be terminated with the active level defined by bit RDYPOL in the
associated BUSCON register.
76/231
ST10F276EInterrupt system
8 Interrupt system
The interrupt response time for internal program execution is from 78ns to 187.5ns at
64 MHz CPU clock.
The ST10F276E architecture supports several mechanisms for fast and flexible response to
service requests that can be generated from various sources (internal or external) to the
microcontroller. Any of these interrupt requests can be serviced by the Interrupt Controller or
by the Peripheral Event Controller (PEC).
In contrast to a standard interrupt service where the current program execution is
suspended and a branch to the interrupt vector table is performed, just one cycle is ‘stolen’
from the current CPU activity to perform a PEC service. A PEC service implies a single Byte
or Word data transfer between any two memory locations with an additional increment of
either the PEC source or destination pointer. An individual PEC transfer counter is implicitly
decremented for each PEC service except when performing in the continuous transfer
mode. When this counter reaches zero, a standard interrupt is performed to the
corresponding source related vector location. PEC services are very well suited to perform
the transmission or the reception of blocks of data. The ST10F276E has 8 PEC channels,
each of them offers such fast interrupt-driven data transfer capabilities.
An interrupt control register which contains an interrupt request flag, an interrupt enable flag
and an interrupt priority bit-field is dedicated to each existing interrupt source. Thanks to its
related register, each source can be programmed to one of sixteen interrupt priority levels.
Once starting to be processed by the CPU, an interrupt service can only be interrupted by a
higher prioritized service request. For the standard interrupt processing, each of the
possible interrupt sources has a dedicated vector location.
Software interrupts are supported by means of the ‘TRAP’ instruction in combination with an
individual trap (interrupt) number.
Fast external interrupt inputs are provided to service external interrupts with high precision
requirements. These fast interrupt inputs feature programmable edge detection (rising edge,
falling edge or both edges).
Fast external interrupts may also have interrupt sources selected from other peripherals; for
example the CANx controller receive signals (CANx_RxD) and I
2
C serial clock signal can be
used to interrupt the system.
Ta bl e 4 0 shows all the available ST10F276E interrupt sources and the corresponding
hardware-related interrupt flags, vectors, vector locations and trap (interrupt) numbers:
Hardware traps are exceptions or error conditions that arise during run-time. They cause
immediate non-maskable system reaction similar to a standard interrupt service (branching
to a dedicated vector table location).
The occurrence of a hardware trap is additionally signified by an individual bit in the trap flag
register (TFR). Except when another higher prioritized trap service is in progress, a
hardware trap will interrupt any other program execution. Hardware trap services cannot not
be interrupted by standard interrupt or by PEC interrupts.
8.1 X-Peripheral interrupt
The limited number of X-Bus interrupt lines of the present ST10 architecture, imposes some
constraints on the implementation of the new functionality. In particular, the additional XPeripherals SSC1, ASC1, I
and PEC transfer capabilities. For this reason, a multiplexed structure for the interrupt
management is proposed. In Figure 16, the principle is explained through a simple diagram,
which shows the basic structure replicated for each of the four X-interrupt available vectors
(XP0INT, XP1INT, XP2INT and XP3INT).
It is based on a set of 16-bit registers XIRxSEL (x=0,1,2,3), divided in two portions each:
●Byte HighXIRxSEL[15:8]Interrupt Enable bits
●Byte LowXIRxSEL[7:0]Interrupt Flag bits
When different sources submit an interrupt request, the enable bits (Byte High of XIRxSEL
register) define a mask which controls which sources will be associated with the unique
2
C, PWM1 and RTC need some resources to implement interrupt
79/231
Interrupt systemST10F276E
available vector. If more than one source is enabled to issue the request, the service routine
will have to take care to identify the real event to be serviced. This can easily be done by
checking the flag bits (Byte Low of XIRxSEL register). Note that the flag bits can also
provide information about events which are not currently serviced by the interrupt controller
(since masked through the enable bits), allowing an effective software management also in
absence of the possibility to serve the related interrupt request: a periodic polling of the flag
bits may be implemented inside the user application.
Figure 16. X-Interrupt basic structure
70
Flag[7:0]
IT Source 7
IT Source 6
IT Source 5
IT Source 4
IT Source 3
IT Source 2
IT Source 1
IT Source 0
XIRxSEL[7:0] (x = 0, 1, 2, 3)
XPxIC.XPxIR (x = 0, 1, 2, 3)
Enable[7:0]
158
XIRxSEL[15:8] (x = 0, 1, 2, 3)
Ta bl e 4 1 summarizes the mapping of the different interrupt sources which share the four X-
interrupt vectors.
Table 41.X-Interrupt detailed mapping
Interrupt sourceXP0INTXP1INTXP2INTXP3INT
CAN1 Interruptxx
CAN2 Interruptxx
I2C Receivexxx
I2C Transmitxxx
I2C Errorx
SSC1 Receivexxx
SSC1 Transmitxxx
SSC1 Errorx
ASC1 Receivexxx
ASC1 Transmitxxx
ASC1 Transmit Bufferxxx
ASC1 Errorx
PLL Unlock / OWDx
PWM1 Channel 3...0xx
80/231
ST10F276EInterrupt system
8.2 Exception and error traps list
Ta bl e 4 2 shows all of the possible exceptions or error conditions that can arise during run-
Class A Hardware Traps:
Non-Maskable Interrupt
Stack Overflow
Stack Underflow
NMI
STKOF
STKUF
NMITRAP
STOTRAP
STUTRAP
00’0008h
00’0010h
00’0018h
02h
04h
06h
Class B Hardware Traps:
Undefined Opcode
MAC Interruption
Protected Instruction Fault
Illegal word Operand Access
Illegal Instruction Access
Illegal External Bus Access
1. All the class B traps have the same trap number (and vector) and the same lower priority compare to the
class A traps and to the resets.
Each class A trap has a dedicated trap number (and vector). They are prioritized in the second priority
level.
The resets have the highest priority level and the same trap number.
The PSW.ILVL CPU priority is forced to the highest level (15) when these exceptions are serviced.
Any
0000h – 01FCh
in steps of 4h
Any
[00h - 7Fh]
Current
CPU
Priority
81/231
Capture / compare (CAPCOM) unitsST10F276E
9 Capture / compare (CAPCOM) units
The ST10F276E has two 16-channel CAPCOM units which support generation and control
of timing sequences on up to 32 channels with a maximum resolution of 125ns at 64 MHz
CPU clock.
The CAPCOM units are typically used to handle high speed I/O tasks such as pulse and
waveform generation, pulse width modulation (PMW), Digital to Analog (D/A) conversion,
software timing, or time recording relative to external events.
Four 16-bit timers (T0/T1, T7/T8) with reload registers provide two independent time bases
for the capture/compare register array.
The input clock for the timers is programmable to several prescaled values of the internal
system clock, or may be derived from an overflow/underflow of timer T6 in module GPT2.
This provides a wide range of variation for the timer period and resolution and allows precise
adjustments to application specific requirements. In addition, external count inputs for
CAPCOM timers T0 and T7 allow event scheduling for the capture/compare registers
relative to external events.
Each of the two capture/compare register arrays contain 16 dual purpose capture/compare
registers, each of which may be individually allocated to either CAPCOM timer T0 or T1 (T7
or T8, respectively), and programmed for capture or compare functions. Each of the 32
registers has one associated port pin which serves as an input pin for triggering the capture
function, or as an output pin to indicate the occurrence of a compare event.
When a capture/compare register has been selected for capture mode, the current contents
of the allocated timer will be latched (captured) into the capture/compare register in
response to an external event at the port pin which is associated with this register. In
addition, a specific interrupt request for this capture/compare register is generated.
Either a positive, a negative, or both a positive and a negative external signal transition at
the pin can be selected as the triggering event. The contents of all registers which have
been selected for one of the five compare modes are continuously compared with the
contents of the allocated timers.
When a match occurs between the timer value and the value in a capture / compare
register, specific actions will be taken based on the selected compare mode.
The input frequencies f
, for the timer input selector Tx, are determined as a function of the
Tx
CPU clocks. The timer input frequencies, resolution and periods which result from the
selected pre-scaler option in TxI when using a 40 MHz and 64 MHz CPU clock are listed in
the Ta bl e 4 4 and Tab le 4 5 respectively.
The numbers for the timer periods are based on a reload value of 0000h. Note that some
numbers may be rounded to three significant figures.
Table 43.Compare modes
Compare modesFunction
Mode 0Interrupt-only compare mode; several compare interrupts per timer period are possible
Mode 1Pin toggles on each compare match; several compare events per timer period are possible
Mode 2Interrupt-only compare mode; only one compare interrupt per timer period is generated
82/231
ST10F276ECapture / compare (CAPCOM) units
Table 43.Compare modes (continued)
Compare modesFunction
Mode 3
Double Register
Mode
Table 44.CAPCOM timer input frequencies, resolutions and periods at 40 MHz
Pin set ‘1’ on match; pin reset ‘0’ on compare time overflow; only one compare event per timer
period is generated
Two registers operate on one pin; pin toggles on each compare match; several compare events
per timer period are possible.
The GPT unit is a flexible multifunctional timer/counter structure which is used for time
related tasks such as event timing and counting, pulse width and duty cycle measurements,
pulse generation, or pulse multiplication. The GPT unit contains five 16-bit timers organized
into two separate modules GPT1 and GPT2. Each timer in each module may operate
independently in several different modes, or may be concatenated with another timer of the
same module.
10.1 GPT1
Each of the three timers T2, T3, T4 of the GPT1 module can be configured individually for
one of four basic modes of operation: timer, gated timer, counter mode and incremental interface mode.
In timer mode, the input clock for a timer is derived from the CPU clock, divided by a
programmable prescaler.
In counter mode, the timer is clocked in reference to external events.
Pulse width or duty cycle measurement is supported in gated timer mode where the
operation of a timer is controlled by the ‘gate’ level on an external input pin. For these
purposes, each timer has one associated port pin (TxIN) which serves as gate or clock
input.
Ta bl e 4 6 and Ta bl e 4 7 list the timer input frequencies, resolution and periods for each pre-
scaler option at 40 MHz and 64 MHz CPU clock respectively.
In Incremental Interface Mode, the GPT1 timers (T2, T3, T4) can be directly connected to
the incremental position sensor signals A and B by their respective inputs TxIN and TxEUD.
Direction and count signals are internally derived from these two input signals so that the
contents of the respective timer Tx corresponds to the sensor position. The third position
sensor signal TOP0 can be connected to an interrupt input.
Timer T3 has output toggle latches (TxOTL) which changes state on each timer over flow /
underflow. The state of this latch may be output on port pins (TxOUT) for time out monitoring
of external hardware components, or may be used internally to clock timers T2 and T4 for
high resolution of long duration measurements.
In addition to their basic operating modes, timers T2 and T4 may be configured as reload or
capture registers for timer T3.
Table 46.GPT1 timer input frequencies, resolutions and periods at 40 MHz
Period maximum8.2ms16.4ms32.8ms65.5ms131.1ms262.1ms524.3ms1.049s
Figure 17. Block diagram of GPT1
T2EUD
CPU Clock
T2IN
2n n=3...10
T2
Mode
Control
Reload
Capture
U/D
GPT1 Timer T2
Interrupt
Request
CPU Clock
T3IN
T3EUD
T4IN
CPU Clock
T4EUD
2n n=3...10
2n n=3...10
T3
Mode
Control
T4
Mode
Control
GPT1 Timer T3
U/D
Capture
Reload
GPT1 Timer T4
U/D
T3OTL
T3OUT
Interrupt
Request
Interrupt
Request
85/231
General purpose timer unitST10F276E
10.2 GPT2
The GPT2 module provides precise event control and time measurement. It includes two
timers (T5, T6) and a capture/reload register (CAPREL). Both timers can be clocked with an
input clock which is derived from the CPU clock via a programmable prescaler or with
external signals. The count direction (up/down) for each timer is programmable by software
or may additionally be altered dynamically by an external signal on a port pin (TxEUD).
Concatenation of the timers is supported via the output toggle latch (T6OTL) of timer T6
which changes its state on each timer overflow/underflow.
The state of this latch may be used to clock timer T5, or it may be output on a port pin
(T6OUT). The overflow / underflow of timer T6 can additionally be used to clock the
CAPCOM timers T0 or T1, and to cause a reload from the CAPREL register. The CAPREL
register may capture the contents of timer T5 based on an external signal transition on the
corresponding port pin (CAPIN), and timer T5 may optionally be cleared after the capture
procedure. This allows absolute time differences to be measured or pulse multiplication to
be performed without software overhead.
The capture trigger (timer T5 to CAPREL) may also be generated upon transitions of GPT1
timer T3 inputs T3IN and/or T3EUD. This is advantageous when T3 operates in Incremental
Interface Mode.
Ta bl e 4 8 and Ta bl e 4 9 list the timer input frequencies, resolution and periods for each pre-
scaler option at 40 MHz and 64 MHz CPU clock respectively.
Table 48.GPT2 timer input frequencies, resolutions and periods at 40 MHz
Period maximum4.1ms8.2ms16.4ms32.8ms65.5ms131.1ms262.1ms524.3ms
000b001b010b011b100b101b110b111b
Timer input selection T5I / T6I
000b001b010b011b100b101b110b111b
86/231
ST10F276EGeneral purpose timer unit
Figure 18. Block diagram of GPT2
T5EUD
CPU Clock
T5IN
2n n=2...9
T5
Mode
Control
Clear
U/D
GPT2 Timer T5
Interrupt
Request
CAPIN
T6IN
CPU Clock
T6EUD
2n n=2...9
T6
Mode
Control
Capture
GPT2 CAPREL
Reload
GPT2 Timer T6
U/D
Toggle FF
T60TL
Interrupt
Request
Interrupt
Request
T6OUT
to CAPCOM
Timers
87/231
PWM modulesST10F276E
11 PWM modules
Two pulse width modulation modules are available on ST10F276E: standard PWM0 and
XBUS PWM1. They can generate up to four PWM output signals each, using edge-aligned
or centre-aligned PWM. In addition, the PWM modules can generate PWM burst signals and
single shot outputs. Tab le 5 0 and Tab le 5 1 show the PWM frequencies for different
resolutions. The level of the output signals is selectable and the PWM modules can
generate interrupt requests.
Figure 19. Block diagram of PWM module
PPx Period Register
Comparator
Clock 1
Clock 2
1. User readable / writeable register
Table 50.PWM unit frequencies and resolutions at 40 MHz CPU clock
Mode
CPU clock
divided by
Input
Control
Run
16-bit Up/Down Counter
PWx Pulse Width Register
Resolution8-bit10-bit12-bit14-bit16-bit
PTx
Comparator
Shadow Register
(1)
Match
(1)
Match
(1)
Up/Down/
Clear Control
Output Control
Write Control
125ns156.25 kHz39.1 kHz9.77 kHz2.44 Hz610 Hz
0
641.6µs2.44 kHz610 Hz152.6 Hz38.15 Hz9.54 Hz
125ns78.12 kHz19.53 kHz4.88 kHz1.22 kHz305.2 Hz
1
641.6µs1.22 kHz305.17 Hz76.29 Hz19.07 Hz4.77 Hz
Table 51.PWM unit frequencies and resolutions at 64 MHz CPU clock
Enable
POUTx
Mode
CPU clock
divided by
Resolution8-bit10-bit12-bit14-bit16-bit
115.6ns250 kHz62.5 kHz15.63 kHz3.91 Hz977 Hz
0
641.0µs3.91 kHz976.6 Hz244.1Hz61.01 Hz15.26 Hz
115.6ns125 kHz31.25 kHz7.81 kHz1.95 kHz488.3 Hz
1
641.0µs1.95 kHz488.28 Hz122.07 Hz30.52 Hz7.63 Hz
88/231
ST10F276EParallel ports
12 Parallel ports
12.1 Introduction
The ST10F276E MCU provides up to 111 I/O lines with programmable features. These
capabilities bring very flexible adaptation of this MCU to wide range of applications.
ST10F276E has nine groups of I/O lines gathered as follows:
●Port 0 is a two time 8-bit port named P0L (Low as less significant byte) and P0H (high
as most significant byte)
●Port 1 is a two time 8-bit port named P1L and P1H
●Port 2 is a 16-bit port
●Port 3 is a 15-bit port (P3.14 line is not implemented)
●Port 4 is a 8-bit port
●Port 5 is a 16-bit port input only
●Port 6, Port 7 and Port 8 are 8-bit ports
These ports may be used as general purpose bidirectional input or output, software
controlled with dedicated registers.
For example, the output drivers of six of the ports (2, 3, 4, 6, 7, 8) can be configured (bitwise) for push-pull or open drain operation using ODPx registers.
The input threshold levels are programmable (TTL/CMOS) for all the ports. The logic level of
a pin is clocked into the input latch once per state time, regardless whether the port is
configured for input or output. The threshold is selected with PICON and XPICON registers
control bits.
A write operation to a port pin configured as an input causes the value to be written into the
port output latch, while a read operation returns the latched state of the pin itself. A readmodify-write operation reads the value of the pin, modifies it, and writes it back to the output
latch.
Writing to a pin configured as an output (DPx.y=‘1’) causes the output latch and the pin to
have the written value, since the output buffer is enabled. Reading this pin returns the value
of the output latch. A read-modify-write operation reads the value of the output latch,
modifies it, and writes it back to the output latch, thus also modifying the level at the pin.
I/O lines support an alternate function which is detailed in the following description of each
port.
12.2 I/O’s special features
12.2.1 Open drain mode
Some of the I/O ports of ST10F276E support the open drain capability. This programmable
feature may be used with an external pull-up resistor, in order to get an AND wired logical
function.
This feature is implemented for ports P2, P3, P4, P6, P7 and P8 (see respective sections),
and is controlled through the respective Open Drain Control Registers ODPx.
89/231
Parallel portsST10F276E
12.2.2 Input threshold control
The standard inputs of the ST10F276E determine the status of input signals according to
TTL levels. In order to accept and recognize noisy signals, CMOS input thresholds can be
selected instead of the standard TTL thresholds for all the pins. These CMOS thresholds
are defined above the TTL thresholds and feature a higher hysteresis to prevent the inputs
from toggling while the respective input signal level is near the thresholds.
The Port Input Control registers PICON and XPICON are used to select these thresholds for
each Byte of the indicated ports, this means the 8-bit ports P0L, P0H, P1L, P1H, P4, P7 and
P8 are controlled by one bit each while ports P2, P3 and P5 are controlled by two bits each.
All options for individual direction and output mode control are available for each pin,
independent of the selected input threshold.
12.3 Alternate port functions
Each port line has one associated programmable alternate input or output function.
●PORT0 and PORT1 may be used as address and data lines when accessing external
memory. Besides, PORT1 provides also:
–Input capture lines
–8 additional analog input channels to the A/D converter
●Port 2, Port 7 and Port 8 are associated with the capture inputs or compare outputs of
the CAPCOM units and/or with the outputs of the PWM0 module, of the PWM1 module
and of the ASC1.
Port 2 is also used for fast external interrupt inputs and for timer 7 input.
●Port 3 includes the alternate functions of timers, serial interfaces, the optional bus
control signal BHE
●Port 4 outputs the additional segment address bit A23...A16 in systems where more
than 64 Kbytes of memory are to be access directly. In addition, CAN1, CAN2 and I
lines are provided.
●Port 5 is used as analog input channels of the A/D converter or as timer control signals.
●Port 6 provides optional bus arbitration signals (BREQ, HLDA, HOLD) and chip select
signals and the SSC1 lines.
and the system clock output (CLKOUT).
2
C
If the alternate output function of a pin is to be used, the direction of this pin must be
programmed for output (DPx.y=‘1’), except for some signals that are used directly after reset
and are configured automatically. Otherwise the pin remains in the high-impedance state
and is not effected by the alternate output function. The respective port latch should hold a
‘1’, because its output is ANDed with the alternate output data (except for PWM output
signals).
If the alternate input function of a pin is used, the direction of the pin must be programmed
for input (DPx.y=‘0’) if an external device is driving the pin. The input direction is the default
after reset. If no external device is connected to the pin, however, one can also set the
direction for this pin to output. In this case, the pin reflects the state of the port output latch.
Thus, the alternate input function reads the value stored in the port output latch. This can be
used for testing purposes to allow a software trigger of an alternate input function by writing
to the port output latch.
On most of the port lines, the user software is responsible for setting the proper direction
when using an alternate input or output function of a pin.
90/231
ST10F276EParallel ports
This is done by setting or clearing the direction control bit DPx.y of the pin before enabling
the alternate function.
There are port lines, however, where the direction of the port line is switched automatically.
For instance, in the multiplexed external bus modes of PORT0, the direction must be
switched several times for an instruction fetch in order to output the addresses and to input
the data.
Obviously, this cannot be done through instructions. In these cases, the direction of the port
line is switched automatically by hardware if the alternate function of such a pin is enabled.
To determine the appropriate level of the port output latches check how the alternate data
output is combined with the respective port latch output.
There is one basic structure for all port lines with only an alternate input function. Port lines
with only an alternate output function, however, have different structures due to the way the
direction of the pin is switched and depending on whether the pin is accessible by the user
software or not in the alternate function mode.
All port lines that are not used for these alternate functions may be used as general purpose
I/O lines.
91/231
A/D converterST10F276E
13 A/D converter
A 10-bit A/D converter with 16+8 multiplexed input channels and a sample and hold circuit is
integrated on-chip. An automatic self-calibration adjusts the A/D converter module to
process parameter variations at each reset event. The sample time (for loading the
capacitors) and the conversion time is programmable and can be adjusted to the external
circuitry.
The ST10F276E has 16+8 multiplexed input channels on Port 5 and Port 1. The selection
between Port 5 and Port 1 is made via a bit in a XBus register. Refer to the user manual for
a detailed description.
A different accuracy is guaranteed (Total Unadjusted Error) on Port 5 and Port 1 analog
channels (with higher restrictions when overload conditions occur); in particular, Port 5
channels are more accurate than the Port 1 ones. Refer to Chapter 23: Electrical
characteristics for details.
The A/D converter input bandwidth is limited by the achievable accuracy: supposing a
maximum error of 0.5 LSB (2mV) impacting the global TUE (TUE depends also on other
causes), in worst case of temperature and process, the maximum frequency for a sine wave
analog signal is around 7.5 kHz. Of course, to reduce the effect of the input signal variation
on the accuracy down to 0.05 LSB, the maximum input frequency of the sine wave shall be
reduced to 800 Hz.
If static signal is applied during sampling phase, series resistance shall not be greater than
20kΩ (this taking into account eventual input leakage). It is suggested to not connect any
capacitance on analog input pins, in order to reduce the effect of charge partitioning (and
consequent voltage drop error) between the external and the internal capacitance: in case
an RC filter is necessary the external capacitance must be greater than 10nF to minimize
the accuracy impact.
Overrun error detection / protection is controlled by the ADDAT register. Either an interrupt
request is generated when the result of a previous conversion has not been read from the
result register at the time the next conversion is complete, or the next conversion is
suspended until the previous result has been read. For applications which require less than
16+8 analog input channels, the remaining channel inputs can be used as digital input port
pins.
The A/D converter of the ST10F276E supports different conversion modes:
●Single channel single conversion: The analog level of the selected channel is
sampled once and converted. The result of the conversion is stored in the ADDAT
register.
●Single channel continuous conversion: The analog level of the selected channel is
repeatedly sampled and converted. The result of the conversion is stored in the ADDAT
register.
●Auto scan single conversion: The analog level of the selected channels are sampled
once and converted. After each conversion the result is stored in the ADDAT register.
The data can be transferred to the RAM by interrupt software management or using the
powerful Peripheral Event Controller (PEC) data transfer.
●Auto scan continuous conversion: The analog level of the selected channels are
repeatedly sampled and converted. The result of the conversion is stored in the ADDAT
92/231
ST10F276EA/D converter
register. The data can be transferred to the RAM by interrupt software management or
using the PEC data transfer.
●Wait for ADDAT read mode: When using continuous modes, in order to avoid to
overwrite the result of the current conversion by the next one, the ADWR bit of ADCON
control register must be activated. Then, until the ADDAT register is read, the new
result is stored in a temporary buffer and the conversion is on hold.
●Channel injection mode: When using continuous modes, a selected channel can be
converted in between without changing the current operating mode. The 10-bit data of
the conversion are stored in ADRES field of ADDAT2. The current continuous mode
remains active after the single conversion is completed.
A full calibration sequence is performed after a reset. This full calibration lasts up to 40.630
CPU clock cycles. During this time, the busy flag ADBSY is set to indicate the operation. It
compensates the capacitance mismatch, so the calibration procedure does not need any
update during normal operation.
No conversion can be performed during this time: the bit ADBSY shall be polled to verify
when the calibration is over, and the module is able to start a conversion.
93/231
Serial channelsST10F276E
14 Serial channels
Serial communication with other microcontrollers, microprocessors, terminals or external
peripheral components is provided by up to four serial interfaces: two asynchronous /
synchronous serial channels (ASC0 and ASC1) and two high-speed synchronous serial
channel (SSC0 and SSC1). Dedicated Baud rate generators set up all standard Baud rates
without the requirement of oscillator tuning. For transmission, reception and erroneous
reception, separate interrupt vectors are provided for ASC0 and SSC0 serial channel. A
more complex mechanism of interrupt sources multiplexing is implemented for ASC1 and
SSC1 (XBUS mapped).
14.1 Asynchronous / synchronous serial interfaces
The asynchronous / synchronous serial interfaces (ASC0 and ASC1) provides serial
communication between the ST10F276E and other microcontrollers, microprocessors or
external peripherals.
14.2 ASCx in asynchronous mode
In asynchronous mode, 8- or 9-bit data transfer, parity generation and the number of stop
bits can be selected. Parity framing and overrun error detection is provided to increase the
reliability of data transfers. Transmission and reception of data is double-buffered. Fullduplex communication up to 2M bauds (at 64 MHz of f
Table 52.ASC asynchronous baud rates by reload value and deviation errors (f
Note:The deviation errors given in the Ta b le 5 2 and Ta b l e 53 are rounded. To avoid deviation
errors use a Baud rate crystal (providing a multiple of the ASC0 sampling frequency).
14.3 ASCx in synchronous mode
In synchronous mode, data is transmitted or received synchronously to a shift clock which is
generated by the ST10F276E. Half-duplex communication up to 8M baud (at 40 MHz of
f
) is possible in this mode.
CPU
Table 54.ASC synchronous baud rates by reload value and deviation errors (f
Note:The deviation errors given in the Ta b le 5 4 and Ta b l e 55 are rounded. To avoid deviation
errors use a Baud rate crystal (providing a multiple of the ASC0 sampling frequency)
14.4 High speed synchronous serial interfaces
The High-Speed Synchronous Serial Interfaces (SSC0 and SSC1) provides flexible highspeed serial communication between the ST10F276E and other microcontrollers,
microprocessors or external peripherals.
The SSCx supports full-duplex and half-duplex synchronous communication. The serial
clock signal can be generated by the SSCx itself (master mode) or be received from an
external master (slave mode). Data width, shift direction, clock polarity and phase are
programmable.
This allows communication with SPI-compatible devices. Transmission and reception of data
is double-buffered. A 16-bit Baud rate generator provides the SSCx with a separate serial
clock signal. The serial channel SSCx has its own dedicated 16-bit Baud rate generator with
16-bit reload capability, allowing Baud rate generation independent from the timers.
Ta bl e 5 6 and Ta bl e 5 7 list some possible Baud rates against the required reload values and
the resulting bit times for 40 MHz and 64 MHz CPU clock respectively. The maximum is
anyway limited to 8 Mbaud.
96/231
ST10F276ESerial channels
Table 56.Synchronous baud rate and reload values (f
Baud rateBit timeReload value
Reserved---0000h
Can be used only with f
6.6M Baud150ns0002h
5M Baud200ns0003h
2.5M Baud400ns0007h
1M Baud1µs0013h
100K Baud10µs00C7h
10K Baud100µs07CFh
1K Baud1ms4E1Fh
306 Baud3.26msFF4Eh
Table 57.Synchronous baud rate and reload values (f
Reserved---0000h
= 32 MHz (or lower)---0001h
CPU
Baud rateBit timeReload value
= 40 MHz)
CPU
= 64 MHz)
CPU
Can be used only with f
Can be used only with f
= 32 MHz (or lower)---0001h
CPU
= 48 MHz (or lower)---0002h
CPU
8M Baud125ns0003h
4M Baud250ns0007h
1M Baud1µs001Fh
100K Baud10µs013Fh
10K Baud100µs0C7Fh
1K Baud1ms7CFFh
489 Baud2.04msFF9Eh
97/231
I2C interfaceST10F276E
15 I2C interface
The integrated I2C Bus Module handles the transmission and reception of frames over the
two-line SDA/SCL in accordance with the I
2
C Bus specification. The I2C Module can
operate in slave mode, in master mode or in multi-master mode. It can receive and transmit
data using 7-bit or 10-bit addressing. Data can be transferred at speeds up to 400 Kbit/s
(both Standard and Fast I
2
C bus modes are supported).
The module can generate three different types of interrupt:
●Requests related to bus events, like start or stop events, arbitration lost, etc.
●Requests related to data transmission
●Requests related to data reception
These requests are issued to the interrupt controller by three different lines, and identified as
Error, Transmit, and Receive interrupt lines.
When the I
2
C module is enabled by setting bit XI2CEN in XPERCON register, pins P4.4 and
P4.7 (where SCL and SDA are respectively mapped as alternate functions) are
automatically configured as bidirectional open-drain: the value of the external pull-up
resistor depends on the application. P4, DP4 and ODP4 cannot influence the pin
configuration.
When the I
2
C cell is disabled (clearing bit XI2CEN), P4.4 and P4.7 pins are standard I/ O
controlled by P4, DP4 and ODP4.
The speed of the I
2
Fast I
C mode (100 to 400 kHz).
2
C interface may be selected between Standard mode (0 to 100 kHz) and
98/231
ST10F276ECAN modules
16 CAN modules
The two integrated CAN modules (CAN1 and CAN2) are identical and handle the
completely autonomous transmission and reception of CAN frames according to the CAN
specification V2.0 part B (active). It is based on the C-CAN specification.
Each on-chip CAN module can receive and transmit standard frames with 11-bit identifiers
as well as extended frames with 29-bit identifiers.
Because of duplication of the CAN controllers, the following adjustments are to be
considered:
●Same internal register addresses of both CAN controllers, but with base addresses
differing in address bit A8; separate chip select for each CAN module. Refer to
Chapter 4: Internal Flash memory.
●The CAN1 transmit line (CAN1_TxD) is the alternate function of the Port P4.6 pin and
the receive line (CAN1_RxD) is the alternate function of the Port P4.5 pin.
●The CAN2 transmit line (CAN2_TxD) is the alternate function of the Port P4.7 pin and
the receive line (CAN2_RxD) is the alternate function of the Port P4.4 pin.
●Interrupt request lines of the CAN1 and CAN2 modules are connected to the XBUS
interrupt lines together with other X-Peripherals sharing the four vectors.
●The CAN modules must be selected with corresponding CANxEN bit of XPERCON
register before the bit XPEN of SYSCON register is set.
●The reset default configuration is: CAN1 enabled, CAN2 disabled.
Note:If one or both CAN modules is used, Port 4 cannot be programmed to output all 8 segment
address lines. Thus, only four segment address lines can be used, reducing the external
memory space to 5 Mbytes (1 Mbyte per CS
line).
16.1 Configuration support
It is possible that both CAN controllers are working on the same CAN bus, supporting
together up to 64 message objects. In this configuration, both receive signals and both
transmit signals are linked together when using the same CAN transceiver. This
configuration is especially supported by providing open drain outputs for the CAN1_Txd and
CAN2_TxD signals. The open drain function is controlled with the ODP4 register for port P4:
in this way it is possible to connect together P4.4 with P4.5 (receive lines) and P4.6 with
P4.7 (transmit lines configured to be configured as Open-Drain).
The user is also allowed to map internally both CAN modules on the same pins P4.5 and
P4.6. In this way, P4.4 and P4.7 may be used either as general purpose I/O lines, or used
2
for I
C interface. This is possible by setting bit CANPAR of XMISC register. To access this
register it is necessary to set bit XMISCEN of XPERCON register and bit XPEN of SYSCON
register.
99/231
CAN modulesST10F276E
16.2 CAN bus configurations
Depending on application, CAN bus configuration may be one single bus with a single or
multiple interfaces or a multiple bus with a single or multiple interfaces. The ST10F276E is
able to support these two cases.
Single CAN bus
The single CAN Bus multiple interfaces configuration may be implemented using two CAN
transceivers as shown in Figure 20.
Figure 20. Connection to single CAN bus via separate CAN transceivers
XMISC.CANPAR = 0
CAN_H
CAN_L
CAN1
RXTX
CANCAN
CAN bus
CAN2
RXTX
P4.4P4.7P4.5P4.6
TransceiverTransceiver
The ST10F276E also supports single CAN Bus multiple (dual) interfaces using the open
drain option of the CANx_TxD output as shown in Figure 21. Thanks to the OR-Wired
Connection, only one transceiver is required. In this case the design of the application must
take in account the wire length and the noise environment.
Figure 21. Connection to single CAN bus via common CAN transceivers
XMISC.CANPAR = 0
2.7kW
CAN1
RXTX
+5V
OD
CAN2
RXTX
P4.4P4.7P4.5P4.6
OD
CAN
Transceiver
CAN_H
CAN_L
100/231
CAN bus
OD = Open Drain Output
Loading...
+ 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.