– 80C51 core wit h 6 clocks per instructi on
– 8 MHz On-Chip Oscil lator
– PLL for generating clock to supply CPU core, USB and Smart Card Interfaces
– Programmable CPU clock from 500 KHz / X1 to 48 MHz / X1
• Reset Controller
– Power On Reset (POR) featur e avoiding an external reset capacitor
– Power Fail Detector (PFD)
– Watch-Dog Timer
• Power Management
– Two power saving modes : Idle and Power Down
– Four Power Down Wake-u p Sources : Smart Card Detection, Keyboard Interrupt, USB
Resume, External Interrupt
– Input Voltage Range : 3.0V - 5.5V
– Core’s Power Consu mp ti on (Without Smart Card and USB) :
•30 mA Maximum Operating Current @ 48 MHz / X1
•200 μA Maximum Power- down Current @ 5.5V
• Interrupt Controller
– up to 9 interrupt sources
– up to 4 Leve l P rio r ity
• Memory Controller
– Internal Progra m memory :
•up to 32KB of Flash or CRAM or ROM for AT8xC5122
•up to 30KB of ROM for AT83C5123
– Internal Data Me mory : 768 bytes including 256 bytes of data and 512 bytes of XRAM
– Optional : inter nal data E2PROM 512 bytes
• T w o 16-bit Timer/Counters
• USB 2.0 Full Speed Interface
–48 MHz DPLL
– On-Chip 3.3V USB voltage regulator and transcei vers
– Software detach feature
– 7 endpoints programmable with In or out directions and ISO, Bulk or Int errupt Transf ers :
•Endpoint 0: 32 Bytes Bidirectionnal FIFO for Control transfers
•Endpoint s 1,2,3: 8 bytes FIFO
•Endpoint s 4,5: 64 Bytes FIFO
•Endpoint 6: 2*64 byt es FIFO with Pin-Pong feature
• ISO 7816 UART Interface Fully Compliant with EMV, GIE-CB and WHQL Standards
– Programmable ISO clock from 1 MHz to 4.8 MHz
– Card insertion/removal detection wit h automatic deactiva tion sequence
– Programmable Baud Rate Generator from 372 to 11.625 clock pulses
– Synchronous/Asynchronous Protocols T=0 and T=1 with Direct or Inverse Convention
– Automatic character repetition on parity errors
– 32 B it Wa iting Time Count e r
– 16 Bit Guard Time Counter
– Internal Step Up/Down Converter with Programmable Voltage Output:
•VCC = 4.0V to 5.5V, 1.8V -30 mA, 3V- 60 mA and 5V-60 mA
•VCC = 3.0V, 1.8V-30 mA, 3V-30 m A and 5V-30 mA
– Current overload protection
– 6 kV ESD (MIL/STD 833 Class 3) protection on whole Smart Card Interface
• Alternate Smart Card Interface with CLK, IO and RST
• UART Interface with Integrat ed Baud Rate Gener ator (BRG)
• Keyboard interface with up to 20x8 matrix management capability
• Master/Slave SPI Interface
• Four 8 bit Ports, one 6 bit port, one 3-bit port
– Up to Seven LED outputs with 3 lev el programmable current source : 2, 4 and 10 mA
– Two Gene ral Purpose I/O programmable as ext ernal interrupts
– Up to 8 input lines programmable as interrupts
– Up to 30 outp ut lines
C51
Microcontroller
with USB and
Smart Card
Reader
Interfaces
Reference DocumentsThe user must get the following additionnal documents which are not included but which
complete this product datasheet
•Product Errata Sheet
•Bootloader Datasheet
2
4202E–SCR–06/06
AT8xC5122/23
Product DescriptionAT8xC5122/23 products are high-performance CMOS derivatives of the 80C51 8-bit
microcontrollers designed for USB smart card reader applications.
The AT8xC5122 is proposed in four versions :
- ROM vers ion w ith or wi thout interna l data E 2PR OM. T he RO M dev ice is on ly fa ctory
programmable.
- CRAM version withou t interna l data E2PR OM. The CRAM devi ce impl ements a vol atile program memory whic h is programmed by means of a n embedded ROMed
bootloader which transfers the code from a remote software programming tool called
FLIP through UART or USB interfaces.
- Flash version without internal data E2PROM. At power-up, the program located in the
flash memory is transferred into the CRAM then executed.
The AT83C5123 is a low pi n count of the AT 8xC5122 and is propos ed in ROM version
with or without internal data E2PROM. The ROM device is only factory programmable.
The AT8xC5122DS is a secure version of the AT8xC5122 on which the external program memory access mode is disabled.
The Port pins are driven to their reset conditions when a voltage
is applied, whether or not the oscillator is running.
IL
when the chip is in Idle mode or Power-Down mode
Ω
VREF < 3.6 V
can be connected to D+ through a 1.5 KΩ resistor. The V
RST
V
341645193416VCCI/0
D+6029526029DVCCI/O
D-5928415928DVCCI/O
6130636130AVCCO
REF
lower than V
This pin has an internal 10K pull-up resistor which allows the device
to be reset by connecting a capacit or between this pi n and VSS.
Asserting RST
returns the chip to normal operation.
The output is active for at least 12 oscillator periods when an internal
reset occurs.
USB Positive Data Upstream Port
This pin requires an external serial resistor of 27Ω (AT8xC122) or
33Ω (AT83C5123) and a 1.5 K
configuration.
USB Negative Data Upstream Port
This pin requires an external serial resistor of 27Ω (AT8xC122) or
33Ω (AT83C5123)
USB Voltage Reference: 3.0 <
V
REF
voltage is controlled by software.
Input
WPD
Input
WPD
Input
WPD
pull-up to VREF for full speed
Input
WPU
Input
WPU
Input
WPU
REF
XTAL
XTAL
VCC
ALE21-32-21- VCCO
311442173114VCCI
1
321543183215VCCO
2
EA
/
63-8-63-VCCI
Input to the on-chip inverting oscillator amplifier
To use the internal oscillator, a crystal or an external oscillator must
be conn ected to this pin.
Output of the on-chip inverting oscillator amplifier
To use the internal oscillator, a crystal circuit must be connected to
this pin. If an external oscillator is used, leave XTAL2 unconnected.
Exter nal Access Enable (Only AT8xC5122)
must be strapped to ground in order to enable the device to fetch
EA
code from external memory locations 0000h to FFFFh.
If security level 1 is programmed, EA
Warning : EA pin cannot be left floating. If the External Access
Enable mod e i s not u se d, EA pi n mus t b e st rapp ed to V CC . I f this l ast
condition is not met,the MCU may have an unpredictable behaviour.
VCC (Only AT89C5122DS)
Address Latch Enable/Program Pulse: Ou tp ut puls e f or latc hing
the low byte of the address during an access to external memory. In
normal operation, ALE is emitted at a constant rate of 1/6 (1/3 in X2
mode) t he os cil lat or f r equ enc y, and can be use d fo r ex ter nal t i mi ng or
clocki ng. Note that one ALE pulse is skipped during each access to
external data memory. ALE can be disabled by setting SFR’s
AUXR.0 bit. With this bit set, ALE will be inactive during internal
fetches
will be latched on reset.
4202E–SCR–06/06
15
AT8xC5122/23
Table 2. Pin Description (Continued)
Internal
Power
QFN64
Port
PSEN15-24-15-VCCO
VQFP64
VQFP32
PLCC68
PLCC28
QFN32
Supply ESDI/O
Reset
LevelAlt
Program Strobe Enable: The read strobe to external program
memory. When executing code from the external program memory,
PSEN
activations are skipped during each access to external data memory.
PSEN
Reset
ConfigConf 1Conf 2Conf 3Led
is activated twice each machine cycle, except that two PSEN
is not activated during fetches from internal program memory.
PLLF542667275426AVCCO
AVCC552768285527PWR
VCC201231152012PWR
LI181029131810PWR
CVCC1792812179PWR
DVCC1110511PWR
PLL Low Pass Filter input
Receives the RC network of the PLL low pass filter.
Analog Supply Voltage
AVCC is used to supply the internal 3.3V analog regulator which
supplies the i nternal USB driver
Supply Voltage
VCC is used to supply the internal 3.3V digital regulator which
supplies the PLL, CPU core and internal I/O ’s
DC/DC Input
LI supplies the current for the charge pump of the DC/DC converter.
- LI tied directly to VCC : the DC/DC converter must be configured in
regulator mode.
- LI tied to VC C through an ext ernal 10 µH coil : the DC/DC convert er
can be configured either in regulator or in pump mode.
Card Supply Voltage
CVCC is t he ouput of internal DC/DC co nverter w hich supplies the
Smart Card Interface. It must be connected to an external decoupling
capacitor of 10 µF with the lowest ESR as this parameter influences
on the CVCC noise
Digital Supply V olta ge
DVCC is t he output of the internal analog 3.3V regulator whi c h
supplies the USB driver. This pin must be connected to an external
680nF decoupling capacitor if the USB interface is used.
This ou tpu t ca n be use d by th e ap pl ic ati on w ith a max im um of 10 mA.
CVSS191130141911GND
VSS1682511168GND
AVSS532566265325GND
16
DC/DC Ground
CVSS is used to sink high shunt currents from the external coil
Digital Ground
VSS is used to supply the PLL, buffer ring and the digital core
Analog Ground
AVSS is used to supply the USB driver.
4202E–SCR–06/06
Typical Applications
Recommended External components
All the external components described in the figure and table below must be implemented as close as possible from the microcontroller package.
Table 3. External Components Bill Of Materials
Reference DescriptionValueComments
R1USB Full Speed Pull-up1.5 KΩ +/-10%All product versions
C10Reset capa citor10 µF +/-10%Option al capacitor for all produ c t versio ns
L1DC/DC converter input inductance
Q1Crystal
10 µH +/- 1 0%
Min rated current : 200 mA
Min rated freq. : 4 MHz
8.0000 Mhz +/- 2500 ppm
max
ESR max : 100 Ω
All product versions.
Qualified component : Murata LQH32CN100K21L
If DC/DC converter is not used at 5V, this inductance is optional.
All product versions
4202E–SCR–06/06
17
AT8xC5122/23
USB Keyboard with Smart Card Reader Using the AT8xC5122 and AT89C5122DS Versions
VCC
C9
GND
VCC
EA/VCC (1)
10mA Max
GND
R1
R2
R3
R19
R18
R17
R16
R15
D+
D-
VCC
GND
R14
R13
R12
R11
R10
R09
R08
USB
VBUS
GND
R07
R06
R05
R04
R03
R02
R01
R00
C4
C0
C1
C2
C3
C4
C5
C6
C7
DVCC
VREF
D+
D-
KB0
KB1
KB2
KB3
KB4
KB5
KB6
KB7
P3[0-1,3-4]
P2[0-7]
P0[0-7]
GND
VCCAVCC
C8
VCC
CPRES
CRST1
CCLK1
GND
LEDx
CVCC
CVSS
CRST
CCLK
CC4
CIO
CC8
CIO1
C1
VCC
C7
R5
VCC
VCC
Smart Card
C1
VCC
C5
GND
C2
RST
C3
CLK
C4
C4
C7
I/O
C8
C8
S1
S1
S2
GND
L1
LI
C6
GND
Alternate Card
C1
VCC
C2
RST
C3
CLK
C7
I/O
C5
GND
GND
Keyboard Matrix
Notes :
1 - Pin configuration depends on product versions
18
R4
C3
GND
C2
PLLF
AVSS
VSS
GND
XTAL2XTAL1
Q1
RST
C10
Optional
Capacitor
GND
4202E–SCR–06/06
USB Smart Card Reader Using the AT83C5123 Version
AT8xC5122/23
USB
VBUS
D+
GND
D-
VCC
GND
VCC
10mA Max
GND
R1
R2
R3
C4
C9
VCC
GND
EA
DVCC
VREF
D+
D-
GND
VCCAVCC
C8
VCC
CVCC
CPRES
GND
LEDx
CVSS
CRST
CCLK
CC4
CIO
CC8
C1
VCC
VCC
L1
LI
C6
GND
C7
R5
Smart Card
C1
VCC
C5
GND
C2
RST
C3
CLK
C4
C4
C7
I/O
C8
C8
S1
S1
S2
GND
R4
C3
GND
C2
PLLF
AVSS
VSS
GND
CRST1
CCLK1
CIO1
RST
XTAL2XTAL1
Q1
C10
GND
VCC
GND
Optional
Capacitor
Alternate Card
C1
VCC
C2
RST
C3
CLK
C7
I/O
C5
GND
4202E–SCR–06/06
19
AT8xC5122/23
Memory Or ga nizationThe AT8xC5122/23 devices have separated address spaces for Program and Data
Memory, as shown in Figure 13 on page 29, Figure 14 on page 31 and Figure 15 on
page 32. The logical separation of Program and Data memory allows the Data Memory
to be accessed by 8-bi t addresses , which can be more quic kly stored and m anipulate d
by an-bit CPU. Nevertheless, 16-bit Data Memory addresses can also be generated
through the DPTR register.
Program Memory
Managament
Depending on the state of EA pin, the MCU fetches the code from internal or external
progr am memory (R OMless mod e )
Warning : the EA pin c an not be lef t flo ating , oth er wise M CU m ay have an unpr ed ictable behaviour.
If EA is strapped to VCC, the MCU fetches the code from the internal program memo ry.
The wa y th e MC U works in this mod e depe nds o n the d evic e ve rsi on. S ee next pa ragraphs for further details.
If the EA is strapped to GND, the MCU fetches the code from external program memory.
This mode is common for all device versions wich supports it. After reset, the CPU
begins the execution from location 0000h. There can be up to 64 KBytes of program
memory. In this mode, the internal program memories are disabled.
The hardware configuration for external program execution is shown in Figure 9.
Figure 9. Executing from External Program Memory
AT8xC5122
ALE
P2
P0
AD7:0
A15:8
Latch
EXTERNAL PROGRAM
MEMORY
A15:8
A7:0
A7:0
20
D7:0
OEPSEN#
Note that the 16 I/O line s (Ports 0 and 2) are dedicated to bus func tions during ex ternal
Program Mem ory fetches. P ort 0 serves a s a m ultiplexed a ddre ss/dat bus. It em its the
low byte of the Program Counter (PC L) as an add ress, and then go es into a floa t state
awaiting the arrival of the code byte from the Program Mem ory . During the time that the
low byte of the Program Counter is valid on P0, the signal ALE (Address Latch Enable)
clocks the byte into an address latch. Meanwhile, Port 2 emits the high byte of the Program Counter (PCH). Then PSEN strobes the External Program M emory and the code
byte is read into the MCU.
PSEN is not activated and Ports P0 and P2 are not affected during internal program
fetches.
4202E–SCR–06/06
AT8xC5122/23
Data Memory
Managament
RAM AchitectureThe internal RAM is mapped into three separate segments :
All device versions implements :
- 256 Bytes of RAM to increase data parameter handling and high level language usage
- 512 bytes of XRAM (Extended RAM) to store program data.
•The Lower 128 bytes (addresses 00h to 7Fh) are directly and indirectly
addressable.
•The Upper 128 bytes (addresses 80h to FFh) are indirectly addressable only.
•The Special Function Registers (SFRs) (addresses 80h to FFh) are directly
addressable only.
The U pper 12 8 bytes and SF R’s ha ve the same address spac e but ar e phys ically
separated.
When an instruction ac cesses an i nternal location ab ove addres s 7Fh, the CPU knows
whether the ac cess is in the upper 128 b ytes of data RA M or to SFR space by the
addressing mode used in the instruction.
•Instructions that use direct addressing access SFR space. For example: MOV
0A0H, # data, accesses the SFR at location 0A0h (which is P2).
•Instructions that use indirect addressing access the Upper 128 bytes of data RAM.
For example: MOV @R0, # data where R0 contains 0A0h, accesses the data byte
at address 0A0h, rather than P2 (whose address is 0A0h).
The stack pointer (SP) may be locat ed anywhere in the 256 bytes RAM (lowe r and
upper RAM) internal data memory. The stack may not be located in the XRAM.
The M0 bit al lows to st retc h the X RA M ti mings . If M 0 is s et, t he re ad an d w rite pu ls es
are extended from 6 to 30 clock periods. This is useful to access externa l slow
peripherals.
XRAM AchitectureDepending on the state of EXTRAM bit in AUXR register (See Table 5 on p age 24), t he
MCU fetches data from internal or external XRAM.
If EXTRAM=0 (reset condition), the MCU fetches the data from internal XRAM. The size
of internal XRAM is configured by the bit XRS0 in AUXR register (See Table 5 on page
24).
Table 4. XRAM Size Configuration
Address
XRS0XRAM size
0
1512 bytes000h1FFh
The XRAM logically occupie s the first bytes of external data memory. The bit XRS0 can
be used to hide a part of the available XRAM . This can be use ful if external peripherals
are mapped at addresses already used by the internal XRAM.
The XRAM is indirectly addressed, using the MOVX instruction in combination with any
of the registers R0, R1 of the selected bank or DPTR.
256 Bytes
(Reset condition)
StartEnd
000h0FFh
4202E–SCR–06/06
For example, MOVX @R0, # data where R0 contains 0A0H, accesses the XRAM at
address 0A0H rather than external memory.
21
AT8xC5122/23
An access to e xternal XRAM m emory locations hig her than the accessi ble size o f the
memory (roll-over feature) will be performed with the M OVX DPTR i nstructions, with P 0
and P2 as data/address busses, WR
and RD as respectively write and read signals.
Accesses above XRAM size can only be done by the use of DPTR.
If EXTRAM=1 the MCU fetches the data from external XRAM Memory. There can be up
to 64 KBytes of external XRAM Memory.
The hardware configuration for external Data Memory Access is shown in Figure 10
Figure 10. Accessing to External XRAM Memory
AT8xC5122/23
EXTERNAL XRAM
MEMORY
AD7:0
A15:8
Latch
A7:0
A15:8
A7:0
D7:0
OERD#WR
P2
ALE
P0
WR#
MOVX @Ri an d M OVX @DPT R wil l be similar to the standard 80C51. MOVX @ Ri will
provide an eight-bit address multiplexed with data on Port 0 and any output port pins
can be use d to ou tput hi gher ord er addre ss bi ts. Thi s is to p rovide t he ext ernal pagin g
capability. MO VX @DP TR will generate a sixteen -bit addre ss. Po rt 2 outputs the highorder eight address bits (DPH) while Port0 m ultiplexes the low -order eight address bits
(DPL) with data. MOVX @ Ri a nd M OVX @DPTR will generate either read or write signals on W
R and RD.
Ports P0, P2 are not affected and RD, WR signals are not activated during access to
internal XR AM.
Note that external XRAM Memory access is only available on High Pin Count Packages.
External Program Memory and ext ernal XRAM Memory may be combined if desired by
applying the RD and PSEN sig nals t o the in puts o f a n AND gat e and using the ouput of
the gate as the read strobe to the external program/data memory.
Dual Data Pointer
Register (DDPTR)
22
RD
STROBE
PSEN
The addi tion al da ta poin ter ca n be u sed t o spe ed up code exe cuti on and reduc e cod e
size.
The dual DPTR structure is a way by which the chip will specify the address of an external data memory location. There are two 16-bit DPTR registers that address the external
memory, and a single bit called DPS = AUXR1.0 (see Table 7) that allow the program
code to switch between them (Figure 11).
4202E–SCR–06/06
Figure 11. Use of Dual Pointer
AUXR1(A2H)
Assembly Language
AT8xC5122/23
External Data Memory
07
DPS
DPH(83H) DPL(82H)
a. Bit 2 stuck at 0; this allows to use INC AUXR1 to toggle DPS without changing GF3.
; Block move using dual data pointers
; Modifies DPTR0, DPTR1, A and PSW
; note: DPS exits opposite of entry state
; unless an extra INC AUXR1 is added
;
00A2 AUXR1 QU 0A2H
;
0000 909000MOV DPTR,#SOURCE ; address of SOURCE
0003 05A2 INC AUXR1 ; switch data pointers
0005 90A000 MOV DPTR,#DEST ; address of DEST
0008 LOOP:
0008 05A2 INC AUXR1 ; switch data pointers
000A E0 MOVX A,@DPTR ; get a byte from SOURCE
000B A3 INC DPTR ;increment SOURCE address
000C 05A2 INC AUXR1 ; switch data pointers
000E F0 MOVX @DPTR,A ; write the byte to DEST
000F A3 INC DPTR ; increment DEST address
0010 70F6JNZ LOOP ; check for 0 terminator
0012 05A2 INC AUXR1 ; (optional) restore DPS
DPTR1
DPTR0
4202E–SCR–06/06
INC is a short (2 bytes) and fast (12 clocks) way to manipulate the DPS bit in the AUXR1
SFR. However, note that the INC instruction does not directly force the DPS bit to a particular state, but simply toggl es it. In simple rou tines, such as the block move example,
only the fact that DPS is toggled in the proper sequence matters, not its actual value.
For example, the block move routine works the sam e whether DPS is '0' or '1 ' on ent ry.
Observe that witho ut the last ins truction (INC AUXR1), th e routine will exit with DP S in
the opposite state.
23
AT8xC5122/23
Registers
Table 5. Auxiliary Register - AUXR (8Eh)
76543210
DPU---XRS0EXTRAMAO
Bit
Number
7DPU
6-3-
2XRS0
1EXTRAM
0AO
Bit
Mnemonic Description
Disable weak Pull-up
0weak pull-up is enabled
1 weak pull-up is disabl ed
Reserved
The value read from this bit is indeterminate. Do not change these bits.
XRAM Size
0256 bytes (default)
1512 bytes
EXTRAM bit
Cleared to access internal XRAM using MOVX @ Ri/ @ DPTR.
Set to access external memory.
Programmed by hardware after Power-up regarding Hardware Security Byte
(HSB), default setting , XRAM selected.
ALE Output bit
Cleared , ALE is emitted at a constant rate of 1/6 the o s cillator frequency (or 1/3 if
X2 mode is used)( default).
Set , ALE is active only when a MOVX or MOVC instruction is used.
Reset Value = 0XXX X000b
24
4202E–SCR–06/06
AT8xC5122/23
Table 6. Auxiliary Register 1 AUXR1- (0A2h) for AT8xC5122
76543210
--ENBOOT-GF30-DPS
Bit
Number
7 - 6-
5ENBOOT
4-
3GF3This bit is a general-purpose user flag.
20Always cleared .
1-
0DPS
Bit
Mnemonic Description
Reserved
The valu e re a d from this bit is ind et er m in at e. Do not chang e th es e bits .
Enable Boot ROM (CRAM / E2PROM version only)
Set this bit to map the Boot ROM from 8000h to FFFFh. If the PC increments
beyond 7FFFh address, the code is fetch from int ernal ROM
Clear this bit to disable Bo ot ROM. If the PC increments beyond 7FFF h address,
the code is fetch from external code memory (C51 standard roll over function)
This bit is forced to 1 at reset
Reserved
The value rea d fro m thi s bit is ind et erm in at e. Do no t chang e th is bit.
Reserved
The value rea d fro m thi s bit is ind et erm in at e. Do no t chang e th is bit.
Data Pointer Selection
Cleared to select DPTR0. Set to select DPTR1.
Reset Value = XX1X XX0X0b (Not bit addressable)
Table 7. Auxiliary Register 1 AUXR1- (0A2h) for AT83C5123
76543210
----GF30-DPS
Bit
Number
7 - 6-
5
4-
3GF3This bit is a general-purpose user flag.
20Always cleared .
1-
0DPS
Bit
Mnemonic Description
Reserved
The valu e re a d from this bit is ind et er m in at e. Do not chang e th es e bits .
Reserved
The valu e re a d from this bit is ind et er m in at e. Do not chang e th es e bits .
Reserved
The value rea d fro m thi s bit is ind et erm in at e. Do no t chang e th is bit.
Reserved
The value rea d fro m thi s bit is ind et erm in at e. Do no t chang e th is bit.
Data Pointer Selection
Cleared to select DPTR0.
Set to select DPTR1.
Reset Value = XXXX XX0X0b (Not bit addressable)
4202E–SCR–06/06
25
AT8xC5122/23
Table 8. CRAM Configuration Register - RCON (D1h)
76543210
----RPS---
Bit
Number
7 - 4-
3RPS
2-0-
Bit
MnemonicDescription
Reset Value = XXXX 0XXXb
AT8xC5122’s CRAM and E2PROM Versions
The AT8xC5122’s CRAM and E2PROM versions implements :
- 32 KB of ROM mapped from 8000 to FFFF in which is embed ded a bootlo ader for In-
System Programming feature
- 32 KB of CRAM (Code RAM) , a volatile program memory mapped from 0000 to 7FFF
In CRAM versions only :
- 512 bytes of E2PROM can be optionally implemented to store permane nt data
Reserved
The value read from this bit is indeterminate. Do not change these bits.
CRAM Memory Mapping Bit
Set to map the CRAM memory during MOVX instructions
Clear to map the XRAM memory during MOVX .
This bit has priority over th e EXTRAM bit.
Reserved
The value read from this bit is indeterminate. Do not change these bits.
In E2PR OM ver sion :
- 32KB of E2PROM are implemented to store permanent code
Warnings :
–so me bytes of user program memory space are reserved for bootloader
configuration. Depending on the configuration, up to 256 bytes of code may
be not available for the user code from 7F00h location. Refer to bootloader
datasheet for further details.
–Port P3.7 may be used by the bootloader as a hardware condition at reset to
select the In-System Programming mode. Once the bootloader has started,
the P3.7 Port is no more used.
26
4202E–SCR–06/06
AT8xC5122 Microcontroller
FFFFh
Bootloader
AT8xC5122/23
P3.7
7FFFh
7F00h
7EFFh
0000h
When pin EA =1 and after the reset, the MCU begins the execution of the embedded
bootloade r from loca tion F8 00h of the ROM. T he b ootload er implem ent s an In-Sys tem
Programming (ISP) mode which manages the transfer of the code in the volatile Program Memory (CR A M) .
For CRAM ve rsion, th e code is sup plied b y the ATME L’s FL exible In-system Pro gramming software (FLIP) through USB or UART interface
For E2PROM vers ion, t he code is supplied from the internal cod e E2P ROM or by F LI P.
The s tate of pi n P 3.7 at re set de term ines the code so urc e. I f P3 .7=1 (re set cond ition )
the source is the internal E2PROM and the transfer takes about 1.5 seconds. If P3.7=0
the source is FLIP and the transfer time depends mainly on external conditions not
related to bootloader.
Reserved
User code
4202E–SCR–06/06
Once the code is running in CRAM, the roll-over condition (code fetched beyond
address 7FFFh) depends on the state of ENBOOT bit of AUXR1 register (Table 6 on
page 25).
If ENBOOT=1 (reset condition) the MCU fetche s the code from bootloader ROM. If
ENBOOT=0, the MCU fetches the code from the external Program Memory. In this last
case, PSEN is activated and Ports P0 and P2 are used to emit data and address
signals.
Warning : external Program Memory access is not allowed on Low Pin Count
Packages.
27
AT8xC5122/23
Using CRAM MemoryThe CRAM is a read / write volatile memory that is mapped in the program memory
space. Then wh en the p ower is sw itched off t he code is l ost and ne eds to be reload at
each power up. In return, the CRAM enabl es a lot of f lexibility in the code dev elopment
as it can be programm ed indefinite ly. The user code runnin g in the CRAM c an perform
read operations in CRAM itself by means of MOVC instructions like any C51 m icrocontroller does. Although the writing operations in CRAM are usually handled by the
bootloader, it is possible for the user code to handle its own writing operations in CRAM
as well. The user co de must c all API functi ons prov ide d by th e bootlo ade r in the R OM
memory. Refer to bootloader datasheet for further details about the use of these API
functions. These API functions use a mechanism provided by the AT8xC5122 microcontroller. When the bit RPS is set in RCON register (Tabl e 8 on page 26), the MOVX
intructions are configured to write in CRAM instead of XRAM m em ory. Ho wever, due t o
C51 architecture, it is not possible for the user c ode to write directly in CRAM when it is
itself running in CRAM. This is why the API functions must be called in order to have the
code executing in ROM while the CRAM is written.
Figure 12. Read / Write Mechanisms in CRAM Memory
API Call
API functions
BOOTLOADER
CRAM
User code
MOVC
RPS=1
MOVX
Writing operation
Read operation
28
4202E–SCR–06/06
Figure 13. AT8xC5122’s CRAM and E2PROM Versions
AT8xC5122/23
(E2PROM version)
FFFF
32K
INTERNAL
E2PROM
(Read/Write)
8000
PROGRAM
MEMORY
Reset@
FFFF
<F800>
8000
Roll-Over
7FFF
0000
EA = 1
ENBOOT=1
32K
INTERNAL
ROM
(Read Only)
32K
INTERNAL
CRAM
(Read/Write)
FFFF
8000
ENBOOT=0
32K
EXTERNAL
PROGRAM
MEMORY
PSEN
Reset@
EA = 0
EXTERNAL
PROGRAM
MEMORY
<0000>
PSEN
DATA MEMORY
(Read / Write)
01FF
0000
EXTRAM=0
Roll-Over
On-chip
512 bytes
XRAM
FFFF
0200
01FF
0000
EXTRAM=1
EXTERNAL
XRAM
EXTERNAL
XRAM
RDWR
Optional
(applicable only to CRAM version)
01FF
512 Bytes
INTERNAL
E2PROM
0000
On-Chip 256 bytes RAM
Indirect
Addressing
FF
128 Bytes
80
7F
00
Upper
RAM
128 Bytes
Direct
Addressing
FF
SFR
Space
80
Lower
RAM
4202E–SCR–06/06
29
AT8xC5122/23
AT8xC5122’s ROM
Version
Security LevelThere are two security levels (applicable to High Pin Count packages only) :
The AT8xC5122’s ROM version implements :
- 32 K of ROM mappe d fro m 0 000h to 7FFFh in which is em bedded the user code. The
ROM device is only factory programmable.
- 512 byte s of E 2P ROM can be op tiona lly imp lem ente d to s tore pe rman en t data. Wi th
this option, the size of ROM is reduced to 30K.
After the rese t, th e MCU b egins t he exe cutio n of the user code fr om lo cation 00 00 h of
the ROM.
Access to external Program Memory is not allowed.
Table 9. Security Level s Des cri ption
Securi ty LevelProte ction description
1No protection lock enabl ed
MOVC instruction executed from external Program Memory is disabled when fe tching
2
code bytes from internal Program Memory
EA
is sampled and latched on r eset.
External code execution is enabled.
The security level 2 can be used to protect the user code from piracy. This option is configured at factory and must be requested by the customer at order time.
30
4202E–SCR–06/06
Loading...
+ 183 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.