UPSD3254A, UPSD3254BV
UPSD3253B, UPSD3253BV
Flash programmable system devices
with 8032 MCU and 256 Kbit SRAM
Features
■
Fast 8-bit 8032 MCU
– 40 MHz at 5.0 V, 24 MHz at 3.3 V
– Core, 12-clocks per instruction
Dual Flash memories with memory
management
– Place either memory into 8032 program
address space or data address space
– Read-while-write operation for in-
application programming and EEPROM
emulation
– Single voltage program and erase
– 100,000 minimum erase cycles, 15-year
retention
Clock, reset, and supply management
– Normal, idle, and power down modes
– Power-on and low voltage reset supervisor
– Programmable watchdog timer
LQFP52 (T)
52-lead, thin,
quad flat package
■
■
■
LQFP80 (U)
80-lead, thin, quad
flat package
A/D converter
– Four channels, 8-bit resolution, 10 µs
-
et
l
)
(s
so
b
ct
u
d
-O
ro
s)
P
t(
te
uc
le
o
od
r
s
P
b
O
te
le
so
b
O
■
■
b
O
■
Programmable logic, general-purpose
– 16 macrocells
– Implements state machines, glue-logic, etc.
Timers and interrupts
– Three 8032 standard 16-bit timers
– 10 Interrupt sources with two external
interrupt pins
Communication interfaces
– USB v1.1, low-speed 1.5 Mbps,
3 endpoints
– I
2
C master/slave bus controller
– Two UARTs with independent baud rate
– Six I/O ports with up to 46 I/O pins
– 8032 address/data bus available on
TQFP80 package
– 5 PWM outputs, 8-bit resolution
so
te
le
ro
P
uc
d
s)
t(
P
e
od
r
s)
t(
uc
JTAG in-system programming
– Program the entire device in as little as
10 seconds
Single supply voltage
– 4.5 to 5.5 V
– 3.0 to 3.6 V
ECOPACK® packages
■
■
■
Table 1.
Device summary
Order code
Max. clock 1st
2nd
8032
SRAM GPIO USB
V
CC
(V)
(MHz)
Flash Flash
bus
40
128 KB 32 KB 32 KB
128 KB 32 KB 32 KB
37
No
No
Pkg.
Temp.
UPSD3253B-40T6
4.5-5.5 TQFP52 –40°C to 85°C
3.0-3.6 TQFP52 –40°C to 85°C
3.0-3.6 TQFP80 –40°C to 85°C
4.5-5.5 TQFP52 –40°C to 85°C
4.5-5.5 TQFP80 –40°C to 85°C
UPSD3253BV-24T6
UPSD3254A-40T6
UPSD3254A-40U6
24
37
No
No
UPSD3254BV-24U6
24
40
40
256 KB 32 KB 32 KB
256 KB 32 KB 32 KB
256 KB 32 KB 32 KB
46
37
46
No
Yes
Yes
Yes
No
Yes
January 2009
Rev 5
1/189
www.st.com
1
Contents
UPSD3254A, UPSD3254BV, UPSD3253B, UPSD3253BV
Contents
1
UPSD325xx description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.1
52-pin package I/O port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2
Architecture overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.1
2.2
Memory organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.2.1
2.2.2
2.2.3
2.2.4
2.2.5
2.2.6
2.2.7
Accumulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
B register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Stack pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Program counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Program status word . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Registers R0~R7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Data pointer register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.3
2.4
2.5
2.6
2.7
Program memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Data memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
XRAM-DDC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
XRAM-PSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
SFR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.9.1
2.9.2
2.9.3
2.9.5
2.9.6
Direct addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
-
et
l
)
(s
so
b
ct
u
d
-O
ro
s)
P
t(
te
uc
le
o
od
r
s
P
b
O
te
le
so
b
O
2.8
2.9
2.9.4
b
O
so
te
le
ro
P
uc
d
s)
t(
P
e
od
r
s)
t(
uc
Addressing modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Indirect addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Register addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Register-specific addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Immediate constants addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Indexed addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.10
Arithmetic instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Logical instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.12.1
2.12.2
2.12.3
Internal RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
External RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Lookup tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.11
2.12
Data transfers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.13
2/189
Boolean instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
UPSD3254A, UPSD3254BV, UPSD3253B, UPSD3253BV
Contents
2.14
2.15
2.16
Relative offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Jump instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Machine cycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3
4
UPSD325xx hardware description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
MCU module description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.1
Special function registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5
Interrupt system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
5.1
5.2
5.3
5.4
5.5
5.6
5.7
5.8
External Int0 interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Timer 0 and 1 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Timer 2 interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
I C interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
External Int1 interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
DDC interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
USB interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
USART interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Interrupt priority structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
2
-
et
l
)
(s
so
b
ct
u
d
-O
ro
s)
P
t(
te
uc
le
o
od
r
s
P
b
O
te
le
so
b
O
5.9
5.10
5.11
b
O
so
te
le
ro
P
uc
d
s)
t(
P
e
od
r
s)
t(
uc
Interrupt enable structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
How interrupts are handled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
6
Power-saving mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6.1
6.2
6.3
Idle mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Power-down mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Power control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Idle mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
6.4
6.5
Power-down mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
7
I/O ports (MCU module) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
7.1
Port type and description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
8
9
Oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Supervisory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3/189
Contents
UPSD3254A, UPSD3254BV, UPSD3253B, UPSD3253BV
9.1
9.2
9.3
9.4
External reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Low V
DD
voltage reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Watchdog timer overflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
USB reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
10
11
Watchdog timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Timer/counters (Timer 0, Timer 1 and Timer 2) . . . . . . . . . . . . . . . . . . 59
11.1
Timer 0 and Timer 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
11.1.1
11.1.2
11.1.3
11.1.4
Mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Mode 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Mode 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
11.2
Timer 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
12
Standard serial interface (UART) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
12.1
12.2
Multiprocessor communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Serial port control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Baud rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Using Timer 1 to generate baud rates . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Using Timer/counter 2 to generate baud rates . . . . . . . . . . . . . . . . . . . 68
More about Mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
More about Mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
More about Modes 2 and 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
12.2.1
-
et
l
)
(s
so
b
ct
u
d
-O
ro
s)
P
t(
te
uc
le
o
od
r
s
P
b
O
te
le
so
b
O
12.2.2
12.2.3
12.2.4
12.2.5
12.2.6
b
O
so
te
le
ro
P
uc
d
s)
t(
P
e
od
r
s)
t(
uc
13
Analog-to-digital convertor (ADC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
ADC interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
13.1
14
Pulse width modulation (PWM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4-channel PWM unit (PWM 0-3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Programmable period 8-bit PWM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
14.1
14.2
14.3
PWM 4-channel operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
15
I
2
C interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
15.1
15.2
Serial status register (SxSTA: S1STA, S2STA) . . . . . . . . . . . . . . . . . . . . 86
Data shift register (SxDAT: S1DAT, S2DAT) . . . . . . . . . . . . . . . . . . . . . . . 86
4/189
UPSD3254A, UPSD3254BV, UPSD3253B, UPSD3253BV
Contents
15.3
Address register (SxADR: S1ADR, S2ADR) . . . . . . . . . . . . . . . . . . . . . . 87
16
DDC interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
16.1
Special Function register for the DDC interface . . . . . . . . . . . . . . . . . . . . 89
16.1.1
16.1.2
DDCDAT register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
DDCADR register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
16.2
16.3
16.4
Host type detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
DDC1 protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
DDC2B protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
17
USB hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
17.1
17.2
USB related registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Transceiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
17.2.1
17.2.2
USB physical layer characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Low speed driver characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
17.3
17.4
Receiver characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
External USB pull-up resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
-
et
l
)
(s
so
b
ct
u
d
-O
ro
s)
P
t(
te
uc
le
o
od
r
s
P
b
O
te
le
so
b
O
18
18.1
18.2
PSD module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Functional overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
In-system programming (ISP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
b
O
so
te
le
ro
P
uc
d
s)
t(
P
e
od
r
s)
t(
uc
19
20
Development system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
PSD module register description and address offset . . . . . . . . . . . . 110
PSD module detailed operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Memory blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Primary Flash memory and secondary Flash memory description . . . . 112
22.2.1
22.2.2
Ready/Busy (PC3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
21
22
22.1
22.2
Memory block select signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Memory operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
22.3
22.4
Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Power-down instruction and Power-up mode . . . . . . . . . . . . . . . . . . . . . 115
22.4.1
Power-up mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
5/189