Page 1:Addition of 72T774 (32KOTP).
Addition of 60K/48K ROM for ST72754
Deletion of table “ device summary”, replaced with cross reference to table 36 on page 147.
page 13 - addition of section 1.4. external connections
Version 4.1 July 2001
Initial format reapplied, text and related figures in the same page.
Table “Device summary” reinserted in cover page and updated.
Update of table 36: ordering information (p143)
Version 4.2 July 2001
Cover - addition of feature about system protection added,
table for device summary: addition of stack values
page 9 - figure 3: replaced 1KByte with 512 Bytes + notes about opcode fetch and HALT
mode
page 10 - table: CR replaced by WDGCR
TIM replaced with Timer and WDG replaced with Watchdog
page 115 - EDF register: addition of “read from RAM”, EDE: few changes
page 135 - Note 1 replaced, note 2 added SUSpend mode limitation..
Whole document: all mentions of HALT mode either deleted or rewritten.
Version 4.3 October 2001
p140, chapter 8, section 8.1code for unused bytes ( FFh) replaced with
page 141- update of table 36 “Ordering information”
page 142 - list of available devices updated
page 114 - DDC DCR register: bit 5 = 1, text “or read from RAM” deleted
Version 4.3November 2001
page 10, one adddress corrected in the figure 3 “memory map”: 0400h
page 14: addition of mandatory 1K resistor (text and figure)
ST72774/ST727754/ST72734
9Dh (opcode for NOP)
5/144
3
Page 6
ST72774/ST727754/ST72734
1 GENERAL DESCRIPTION
1.1 INTRODUCTION
The ST72774, ST72754 and ST72734 are
HCMOS microcontroller units (MCU) from the
ST727x4 family with dedicated peripherals for
Monitor applications.
They are based around an industry standard 8-bit
core and offer an enhanced instruction set. The
processor runs with an external clock at 12 or 24
MHz with a 5V supply. Due to the fully static design
of this device, operation do wn to DC is possible.
Under software control the ST727x4 can be placed
in WAIT mode thus reducing p ower consumpt ion.
The HALT mode is no longer available.
The enhanced instruction set and addressing
modes afford real programming potential. Illegal
opcodes are patched and lead to a reset.
Figure 1. ST727x4 Block Diagram
Up to 60K Bytes
ROM/OTP/EPROM
Up to 1K Bytes
RAM
In addition to standard 8-bit data management the
ST7 features true bit manipulation, 8x8 unsigned
multiplication and indirect addressing modes.
The device includes an on-chip oscillator, CPU,
System protection aga inst illeg al add re ss j umps,
Sync Processor for video timing & Vfback analysis,
up to 60K Program Mem ory, up to 1K RAM, US B/
DMA, a Timing Measurement Unit, I/O, a timer with
2 input captures and 2 output compares, a 4channel Analog to Digital Converter, DDC, I
Single Master, W atchdog Reset, and ei ght 10-bit
PWM/BRM outputs for analog DC control of
external functions.
Bidirectional. This active low signal forces
the initialization of the MCU. This event is the top
priority non maskable interrupt. This pin is
switched low when the Watchdog has triggered or
V
These pins connect a pa rallel-resonant crystal, or
an external sou rc e to the on -c h ip o s cilla t o r.
TEST/V
: Input. EPROM programming voltage.
PP
This pin must be held low during normal operating
modes.
V
: Power supply voltage (4.0V-5.5V)
DD
V
: Digital Ground.
SS
Alter nate Funct ions: several pins of the I/O ports
assume software programmable alternate
functions as shown in the pin description
Table 1. ST727x4 Pin Description
Pin No.
Pin Name
SDIP42
TQFP44
391PC0/HSYNCDIVI/OPort C0 or HSYNCDIV output (HSYNCO divided by 2)
402PC1/AVI/OPort C1 or “Active Video” input
413PC2/PWM3I/OPort C2 or 10-bit PWM/BRM output 3
424PC3/PWM4I/OPort C3 or 10-bit PWM/BRM output 4
435PC4/PWM5I/OPort C4 or 10-bit PWM/BRM output5
446PC5/PWM6I/OPort C5 or 10-bit PWM/BRM output 6
17PC6/PWM7I/OPort C6 or 10-bit PWM/BRM output 7
28PC7/PWM8I/OPort C7 or 10-bit PWM/BRM output 8
39PB7/AIN3/PWM2I/O
410PB6/AIN2/PWM1I/O
511PB5/AIN1I/OPort B5 or ADC analog input 1
612PB4/AIN0I/OPort B4 or ADC analog input 0
813V
914USBVCCSUSB power supply (output 3.3V +/- 10%)
1015USBDMI/OUSB bidirectional dataMust be tied to ground
1116USBDPI/OUSB bidirectional data
1217V
1318HSYNCIISYNC horizontal synchronisation input
1419VSYNCIISYN C vertical synch ronis ation input
1520PD0/VSYNCOI/OPort D0 or SYNC vertical synchronisation output
1621PD1/HSYNCOI/OPort D1 or SYNC horizontal synchronisation output
1722PD2/CSYNCII/OPort D2 or SYNC composite synchronisation input
DD
SS
Type
Port B7 or ADC analog input 3 or 10-bit PWM/BRM
output 2
Port B6 or ADC analog input 2 or 10-bit PWM/BRM
output 1
SSupply (4.0V - 5.5V)
SGround 0V
DescriptionRemarks
For analog controls,
after external filtering
for devices without
USB peripheral
TTL levels
Refer to Figure 16
TTL levels with pull-up
(SYNC input)
8/144
3
Page 9
Pin No.
ST72774/ST727754/ST72734
Pin Name
SDIP42
TQFP44
1823PD3/VFBACK/ITAI/O
1924PD4/ITBI/OPort D4 or Interrupt falling edge detector input B
2025PD5/HFBACKI/OPort D5 or SYNC horizontal flyback input
2126PD6/CLAMPOUTI/OPort D6 or SYNC clamping/ MOIRE output
2227PB0/SCLDI/OPort B0 or DDC serial clock
2428PB1/SDADI/OPort B1 or DDC serial data
2529PB2/SCLII/OPort B2 or I2C serial clock
2630PB3/SDAII/OPort B3 or I2C serial data
2731PA7/BLANKOUTI/OPort A7 or SYNC blanking output
2832OSCOUTOOscillator output
2933OSCINIOscillator input
3034PA6I/OPort A6
3135PA5I/OPort A5
3236PA4I/OPort A4
3337PA3I/OPort A3
3438PA2/VSYNCI2I/OPort A2 or SYNC vertical synchronisation input 2DDC1 only
3539PA1I/OPort A1
3640RESET
3741TEST/V
3842PA0/OCMP1I/OPort A0 or TIMER output compare 1
PP
Type
Port D3 or SYNC Vertical flyback input or interrupt falling edge detector input A
I/OReset pin Active low
Test mode pin or EPROM programming voltage. This
S
pin should be tied low in user mode.
DescriptionRemarks
Refer to Figure 16 and
Table 11 Port D Description
Refer to Table 11 Port
D Description
TTL levels with pull-up
(SYNC input)
9/144
Page 10
ST72774/ST727754/ST72734
1.3 MEMORY MA P
Figure 3. Me m ory Map
0000h
005Fh
0060h
03FFh
0400h
0FFFh
1000h
4000h
8000h
FFDFh
FFE0h
FFFFh
HW Registers
(see Table 2)
512 Bytes RAM
1 Kbyte RAM
Reserved
60 Kbytes
ROM/EPROM
48 Kbytes
32 Kbytes
Interrupt & Reset Vectors *
(see Table 3)
0060h
0100h
01FFh
0060h
0100h
01FFh
0200h
03FFh
Short Addressing
RAM (zero page)
256 Bytes Stack/
16-bit Addressing RAM
Short Addressing
RAM (zero page)
256 Bytes Stack/
16-bit Addressing RAM
16-bit Addressing
RAM
512 Bytes
any opcode fetch in those areas is considered as illegal and generates a reset
(*) this block only contains addresses of interrupts and reset routines, no opcode is run from this block
10/144
Page 11
MEMORY MAP (Cont’d)
Table 2. Hardware Register Mem ory Map
ST72774/ST727754/ST72734
AddressBlock Register LabelRegister Name
0000h
0001h
0002h
0003h
0004h
0005h
0006h
0007h
0008hWatchdogWDGCRWatchdog Control Register7FhR/W
0009hMISCRMiscellaneous Register10hR/W
000Ah
USB PID Register
USB DMA address Register
USB Interrupt/DMA Register
USB Interrupt Status Register
USB Interrupt Mask Register
USB Control Register
USB Device Address Register
USB Endpoint 0 Register A
USB Endpoint 0 Register B
USB Endpoint 1 Register A
USB Endpoint 1 Register B
USB Endpoint 2 Register A
USB Endpoint2 Register B
DDC/CI Control Register
DDC/CI Status Register 1
DDC/CI Status Register 2
Reserved
DDC/CI (7 Bits) Slave address Register
Reserved
DDC/CI Data Register
Reserved Area (2 bytes)
I2C Data Register
Reserved
Reserved
2
C Clock Control Register
I
2
C Status Register 2
I
2
C Status Register 1
I
2
C Control Register
I
Reset
Status
00h
00h
00h
00h
00h
00h
00h
00h
00h
00h
Table 3. Interrupt Vector Map
Vector AddressDescriptionRemarks
FFE0-FFE1h
FFE2-FFE3h
FFE4-FFE5h
FFE6-FFE7h
FFE8-FFE9h
FFEA-FFEBh
FFEC-FFEDh
FFEE-FFEFh
FFF0-FFF1h
FFF2-FFF3h
FFF4-FFF5h
FFF6-FFF7h
FFF8-FFF9h
FFFA-FFFBh
FFFC-FFFDh
FFFE-FFFFh
Timer Overflow interrupt vector
Timer Output Compare interrupt vector
Timer Input Capture interrupt vector
ITA falling edge interrupt vector
ITB falling edge interrupt vector
DDC1/2B interrupt vector
USB End Suspend interrupt vector
TRAP (software) interrupt vector
Not used
Not used
Not used
USB interrupt vector
Not used
I2C interrupt vector
DDC/CI interrupt vector
RESET vector
Internal Interrupts
External Interrupts
Internal Interrupt
CPU Interrupt
Remarks
R/W
Read only
Read only
R/W
R/W
R/W
R/W
Read only
Read only
R/W
13/144
Page 14
ST72774/ST727754/ST72734
1.4 External connections
The following figure shows the recom mended external connections for the device.
The V
pin is only used for programming OTP
PP
and EPROM devices and must be tied to ground in
user mode.
The 10 nF and 0. 1 µF decoupling capacitors on
the power supply lines are a suggested EMC performance/cost tradeoff.
Figure 4. Recommended Extern al Connec tions
V
DD
EXTERNAL RESET CIRCUIT
10nF
V
DD
0.1µF
0.1µF
+
4.7K
The external reset network (including the mandatory 1K serial resistor) is inten ded to protect the
device against parasitic resets, espec ially in noisy
environments.
Unused I/Os shoul d be t ied hi gh to av oid any unnecessary power consumption on floating lines.
An alternative solution is to program the unused
ports as inputs with pull-up.
V
PP
V
0.1µF
1K
DD
V
SS
RESET
14/144
See
Clocks
Section
Or configure unused I/O ports
by software as input with pull-up
V
10K
DD
OSCIN
OSCOUT
Unused I/O
Page 15
2 CENTRAL PRO CESSING UNIT
ST72774/ST727754/ST72734
2.1 INTRODUCTION
This CPU has a full 8-bit architecture and contains
six internal registers allowing efficient 8-bit data
manipulation.
2.2 MAIN FEATURES
■ 63 basic instructions
■ Fast 8-bit by 8-bit multiply
■ 17 main addressing modes
■ Two 8-bit index registers
■ 16-bit stack pointer
■ Low power modes
■ Maskable hardware interrupts
■ Non-maskable software interrupt
2.3 CPU REGISTERS
The 6 CPU registers shown in Figure 5 are not
present in the memory mapping and are accessed
by specific instructions.
Accumulator (A)
Figure 5. CPU Registers
70
RESET VALUE = XXh
70
RESET VALUE = XXh
70
RESET VALUE = XXh
The Accumulator is an 8-bit general purpose
register used to hold operands and the results of
the arithmetic and logic calculations and to
manipulate data.
Index Registers (X and Y)
In indexed addressing modes, these 8-bit registers
are used to create either effective addresses or
temporary storage areas for data manipulation.
(The Cross-Assembler generates a precede
instruction (PRE) to indicate that the following
instruction refers to the Y register.)
The Y register is not affected by the interrupt
automatic procedures (not pushed to and pop ped
from the stack).
Program Cou nt er (P C )
The program counter is a 16-bit register containing
the address of the next instruction to be executed
by the CPU. It is made of two 8-bit registers PCL
(Program Counter Low which is the LSB) and PCH
(Program Counter High which is the MSB).
ACCUMULATOR
X INDEX REGISTER
Y INDEX REGISTER
158
RESET VALUE = RESET VECTOR @ FFFEh-FFFFh
15
RESET VALUE = STACK HIGHER ADDRESS
PCH
RESET VALUE =
7
70
1C11HI NZ
1X11X1XX
70
8
PCL
0
PROGRAM COUNTER
CONDITION CODE REGISTER
STACK POINTER
X = Undefined Value
15/144
Page 16
ST72774/ST727754/ST72734
CPU REGISTERS (Cont’d)
CONDITION CODE REGISTER (CC)
Read/Write
Reset Value: 111x1xxx
70
enter it and reset by the IRET instruction at the end
of the interrupt routine. If the I bit is cleared by
software in the interrupt routine, pending interrupts
are serviced regardless of the pri ority level of the
current interrupt routine.
111HINZC
The 8-bit Condition Code register contains the
interrupt mask and four flags representative of the
result of the instruction just executed. This register
can also be handled by the PUSH and POP
instructions.
These bits can be individually tested and/or
controlled by specific instructions.
Bit 4 = H
Half carry
.
This bit is set by hardware when a carry occurs
between bits 3 and 4 of the ALU during an ADD or
ADC instruction. It is reset by hardware during the
same instructions.
0: No half carry has occurred.
1: A half carry has occurred.
This bit is tested using the JRH or JRNH
instruction. The H bit is useful in B CD arithmetic
subroutines.
Bit 2 = N
Negative
.
This bit is set and cleared by hardware. It is
representative of the result sign of the last
arithmetic, logical or data manipulation. It is a copy
of the 7
th
bit of the result.
0: The result of the last operation is positive or null.
1: The result of the last operation is negative
(i.e. the most significant bit is a logic 1).
This bit is accessed by the JRMI and JRPL
instructions.
Bit 1 = Z
Zero
.
This bit is set and cleared by hardware. This bit
indicates that the result of the last arithmetic,
logical or data manipulation is zero.
0: The result of the last operation is different from
zero.
1: The result of the last operation is zero.
This bit is accessed by the JREQ and JRNE test
instructions.
Bit 3 = I
Interrupt mask
.
This bit is set by hardware when entering in
interrupt or by software to disable all interrupts
except the TRAP software interrupt. This bit is
cleared by software.
0: Interrupts are enabled.
1: Interrupts are disabled.
This bit is controlled by the RIM, SIM and IRET
instructions and is tested by the JRM and JRNM
instructions.
Note: Interrupts requested while I is set are
latched and can be processed whe n I is cleared.
By default an interrupt routine is not in terruptable
because the I bit is set by hardware when you
16/144
Bit 0 = C
Carry/borrow.
This bit is set and cleared by hardware and
software. It indicates an overflow or an underflow
has occurred during the last arithmetic operation.
0: No overflow or underflow has occurred.
1: An overflow or underflow has occurred.
This bit is driven by th e SCF and RCF instructions
and tested by the JRC and JRNC instructions. It is
also affected by the “bit test and branch”, shift and
rotate instructions.
Page 17
ST72774/ST727754/ST72734
CPU REGISTERS (Cont’d)
Stack Pointer (SP)
Read/Write
Reset Value: 01 FFh
158
00000001
70
The least significant byte of the Stack Pointer
(called S) can be directly accessed by a LD
instruction.
Note: When the lower limit is exceeded, the Stack
Pointer wraps around to the stack upper limit,
without indicating the stack overflow. The
previously stored information is then overwritten
and therefore lost. The stack also wraps in case of
an underflow.
SP7SP6SP5SP4SP3SP2SP1SP0
The Stack Pointer is a 16-bit register which is
always pointing to the next free location in the
stack. It is then decremented after data has been
pushed onto the stack and incremented before
data is popped from the stack (see Figure 6).
Since the stack is 256 bytes deep, the most
significant byte is forced by ha rd ware. Fol lowing
an MCU Reset, or after a Reset Stack Pointer
instruction (RSP), the Stack Pointer contains its
reset value (the SP7 to SP0 bits are set) which is
the stack higher address.
Figure 6. Stack Manipulation Example
@ 0100h
SP
@ 01FFh
CALL
Subroutine
PCH
PCL
Interrupt
event
SP
SP
CC
A
X
PCH
PCL
PCH
PCL
PUSH YPOP YIRET
Y
CC
A
X
PCH
PCL
PCH
PCL
The stack is used to save the return address
during a subroutine call and the CPU context
during an interrupt. The user may also directly
manipulate the stack b y means of the PU SH and
POP instructions. In the case of an in terrupt, the
PCL is stored at the first location pointed to by the
SP. Then the other registers are stored in the next
locations as shown in Figure 6.
– When an interrupt is received, the SP is decre-
mented and the context is pushed on the stack.
– On return from interrupt, the SP is incremented
and the context is popped from the stack.
A subroutine call occupies two locations and an
interrupt five locations in the stack area.
The MCU accepts either a cry stal or an external
clock signal to drive the internal oscillator. The
internal clock (CPU CLK running at f
CPU
) is
derived from the external oscillator frequency
), which is divided by 3. Depending on the
(f
OSC
external quartz or clock frequency, a division factor
of 2 is optionally added to generate the 12 MHz
clock for the Sync Processor (clamp function) as
Figure 7. Clock divider chain
OSC
12 MHz
or
%2
FAST
24MHz
shown in Figure 7 and a second divider by 2 for the
6MHz USB clock.
The CPU clock is used also as clock for the
ST727x4 peripherals.
Note: In the Sync processor, an additional divider
by two is added in fast mode (same external timing
for this peripheral).
f
: 4 or 8 MHz
%3
CPU
(CPU and peripherals)
12 MHz
(Sync processor Clampout signal)
%2
6 MHz
(USB)
FAST=1 for 24 M H Z os c illatorFAST=0 for 12 MHz osc il lat o r
18/144
12 MHz
or
24MHz
(TMU)
4
Page 19
CLOCK SYSTEM (Cont’d)
3.1.2 Crystal Resonator
The internal oscillat or is designed to operate with
an AT-cut parallel resonant quartz crystal
resonator in the frequency range specified for f
osc
The circuit shown in Figure 8 is recommended
when using a crystal, and Table 4, “.
Recommended Crystal Values,” on page 19 lists
the recommended capacitance and feedback
resistance values. The crystal and associated
components should be mounted as close as
possible to the input pins in order to minimize
output distortion and start-up stabilization time.
Figure 8. Crystal/Ceramic Resonator
CRYSTAL CLOCK
OSCINOSCOUT
C
L1
C
L2
ST72774/ST727754/ST72734
Table 4
.
Legend:
C
OSCIN and OSCOUT (the value includes the
external capacitance tied to the pin plus the
parasitic capacitance of the board and of the
device).
R
the quartz allowed.
Note: The tables are relative t o the quart z crystal
only (not ceramic resonator).
3.1.3 External Clock
An external clock should be appli ed to t he O SCIN
input with the OSCOUT pin not connected as
shown in Figure 9. The Crystal clock specifications
do not apply when using an external clock input.
The equivalent spe cification of the external clock
source should be used.
. Recomm en de d Crystal Values
24 MhzUnit
R
SMAX
C
L1
C
L2
, CL2 = Maximum total capacitance on pins
L1
= Maximum series parasitic resistance of
SMAX
702520Ohms
224756pf
224756pf
*Recommended for oscillator stability
1M*
Figure 9. External Clock Source Connections
OSCIN
EXTERNAL
CLOCK
OSCOUT
NC
19/144
Page 20
ST72774/ST727754/ST72734
3.2 RESET
The Reset procedure is used to provide an orderly
software start-up or to quit low powe r modes.
Five conditions generate a reset:
■ LVD,
■ watchdog,
■ external pulse at the RESET pin,
■ illegal address,
■ illegal opcode.
A reset causes the reset vector to be fetched from
addresses FFFEh and FFFFh in order to be loaded
into the PC and with program execution starting
from this point.
An internal circuitry provides a 4096 CPU clock
cycle delay from the time that the oscillator
becomes active.
3.2.1 LVD and Watchdog Reset
The Low Voltage Detector (LVD) generates a reset
when V
when
is active only when V
is below V
DD
is falling (refer to Figure 11). This circuitry
VDD
when VDD is ri sing or V
TRH
is above V
DD
TRM.
TRL
During LVD Reset, the RESET pin is held low, thus
permitting the MCU to reset other devices.
When a watchdog reset occurs, the RESET
pin is
pulled low permitting the MCU to reset other
devices as when Power on/off (Figure 10).
3.2.2 External Reset
The external reset is an active low input signal
applied to the RESET pin of the MCU.
As shown in Figure 12, the RESET
signal must
remain low for 1000ns.
An internal Schmitt trigger at the RESET
pin is
provided to improve noise immunity.
3.2.3 Illegal Address Detection
An opcode fetch from an illegal address (refer to
Figure 3) generates an illegal address reset.
Program execution at those addresses is
forbidden (especially to protect page 0 registers
against spurious accesses).
3.2.4 Illegal Opcode Detection
Illegal instructions corresponding to no valid
opcode generate a reset. Refer to ST7
Programming Manual.
Table 5. List of sections affected by RESET and WAIT (Refer to 3.6 for Wait Mo de)
SectionRESETWAIT
Fast bit of the miscellaneous register set to one (24 MHz as external clock)X
Timer Prescaler reset to zeroX
Timer Counter set to FFFChX
All Timer enable bits set to 0 (disabled)X
Data Direction Registers set to 0 (as Inputs)X
Set Stack Pointer to 01FFhX
Force Internal Address Bus to restart vector FFFEh, FFFFhX
Set Interrupt Mask Bit (I-Bit, CC) to 1 (Interrupt disable)X
Set Interrupt Mask Bit (I-Bit, CC) to 0 (Interrupt enable)X
Reset WAIT latchX
Disable Oscillator (for 4096 cycles)X
Set Timer Clock to 0X
Watchdog counter resetX
Watchdog register resetX
Port data registers resetX
Other on-chip peripherals: registers resetX
20/144
Page 21
RESET (Cont’d)
ST72774/ST727754/ST72734
Figure 10. Low Voltage Detector Functional Diagram
V
DD
LVD
RESET
FROM
WATCHDOG
RESET
RESPOF
INTERNAL
RESET
Figure 11. LVD Reset Signal Output
Note: See electrical characteristics section for
values of V
Figure 12. Reset Timing Diagram
t
DDR
V
DD
OSCIN
t
OXOV
V
V
DD
RESET
TRM
V
TRH
TRH, VTRL
and V
TRM
V
TRL
V
TRM
f
CPU
PC
t
RL
RESET
WATCHDOG RESET
Note: Refer to Electrical Characteristics for values of t
4096 CPU
CLOCK
CYCLES
DELAY
, t
OXOV and
DDR
FFFE
t
FFFF
RL
21/144
Page 22
ST72774/ST727754/ST72734
3.3 INTERRUPTS
The ST727x4 may be interrupted by one of two
different methods: maskable hardware interrupts
as listed in T able 6 and a non-maskab le software
interrupt (TRAP). The Interrupt processing
flowchart is shown in Figure 13.
The maskable interrupts must be enabled in order
to be serviced. However, disabled interrupts can
be latched and processed when they are enabled.
When an interrupt has to be serviced, the PC, X, A
and CC registers are saved onto the stack and the
interrupt mask (I bit of the Condition Code
Register) is set to prevent additional interrupts.
The Y register is not automatically saved.
The PC is then load ed with the interrupt vector of
the interrupt to service and the interrupt service
routine runs (refer to Table 6, “Interrupt Mapping,”
on page 24 for vector addresses). The interrupt
service routine should finish with the IRET
instruction which causes the contents of the
registers to be recovered from the stack and
normal processing to resume. Note that the I bit is
then cleared if and only if the corresponding bit
stored in the stack is zero.
Though many interrupts can be simultaneously
pending, a priority order is defined (see Table 6,
“Interrupt Mapping,” on page 24). The RESET
pin
has the highest priority.
If the I bit is set, only the TRAP interrupt is enabled.
All interrupts allow the processor to leave the
WAIT low power mode.
Software Interrupt. The software interrupt is the
executable instruction TRAP. The interrupt is
recognized when the TRAP instruction is
executed, regardless of the state of the I bit. When
the interrupt is recognized, it is serviced according
to the flowchart on Figure 13.
ITA, ITB interrupts. The ITA (PD3), ITB (PD4),
pins can generate an interrupt when a falling edge
occurs on these pins, if these interrupts are
enabled with the ITAITE, ITBITE bits respectively
in the miscellaneous register and the I bit of the CC
register is reset. When an enabled interrupt
occurs, normal processing is suspended at the
end of the current instruct ion execution. It is then
serviced according to the flowchart on Figure 13.
Software in the ITA or ITB service routine must
reset the cause of this interrupt by clearing the
ITALAT, ITBLAT or ITAITE, ITBITE bits in the
miscellaneous register.
Peripheral Interrupts. Different peripheral
interrupt flags are able to cause an interrupt when
they are active if both the I bit of the CC register is
reset and if the corresponding enable bit is set. If
either of these conditions is false , the interrupt is
latched and thus remains pending.
The interrupt flags are located in the status
register. The Enable bits are in the control register.
When an enabled interrupt occurs, normal
processing is suspended at the end of the current
instruction execution. It is then serviced according
to the flowchart on Figure 13.
The general sequence for clearing an interrupt is
an access to the status register while the flag is set
followed by a read or write of an associated
register. Note that the clearing sequence resets
the internal latch. A pending interrupt (i.e. waiting
for being ena b led ) w ill therefore be los t if the clea r
sequence is executed.
22/144
Page 23
INTERRUPTS (Cont’d)
Figure 13. I nt errupt Processin g Fl owchart
FROM RESET
ST72774/ST727754/ST72734
EXECUTE INSTRUCTION
TRAP?
N
N
I BIT SET?
Y
FETCH NEXT INSTRUCTION
N
IRET?
Y
N
INTERRUPT?
Y
STACK PC, X, A, CC
SET I BIT
LOAD PC FROM INTERRUPT VECTOR
** Many flags can cause an interrupt, see peripheral interrupt status register description.
24/144
Page 25
3.4 POWER SAVI NG MO DE S
ST72774/ST727754/ST72734
3.4.1 WAIT Mode
This mode is a low power consumption mode. The
WFI instruction places the MCU in WAIT mode:
The internal clock remains active but all CPU
processing is stopped; however, all other
peripherals are still running.
Note: In WAIT mode, DMA accesses (DDC, USB)
are possible.
During WAIT mode, the I bit in the condition code
register is cleared to enable all interrupts, whi ch
causes the MCU to exit WAIT mode, causes the
corresponding interrupt vector to be fetched, th e
interrupt routine to be executed and normal
processing to resume. A reset causes the program
counter to fetch the reset vector and processing
starts as for a normal reset.
Table 5 gives a list of the different sections
affected by the low power modes. For detailed
information on a particular device, please refer to
the corresponding part.
Figure 14. WAIT Flow Chart
WFI INSTRUCTION
OSCILLATOR
PERIPH. CLOCK
CPU CLOCK
I-BIT
N
N
INTERRUPT
Y
OSCILLATOR
PERIPH. CLOCK
CPU CLOCK
I-BIT
ON
ON
OFF
CLEARED
RESET
Y
ON
ON
ON
SET
3.4.2 HALT Mode
The HALT mode is the MCU lowest power
consumption mode. Meanwhile, the HALT mode
also stops the oscillator stage comple tely which is
the most critical condition in CRT monitors.
For this reason, the HALT mode has been disabled
and its associated HALT instruction is now
considered as illegal and will generate a reset.
IF RESET
4096 CPU CLOCK
CYCLES DELAY
FETCH RESET VECTOR
OR SERVICE INTERRUPT
Note: Before servicing an interrupt, the CC register is
pushed on the sta ck. T he I-Bit is s et d uring the inte rrupt routine and cleared when the CC register is
popped.
25/144
Page 26
ST72774/ST727754/ST72734
3.5 MISCELLANEOUS REGISTER
MISCELLANEOUS REGISTER (MISCR)
Address: 0009h— R ea d/W rite
Reset Value: 0001 0000 (10h)
70
VSYNC
FLY_SYNHSYNC
SEL
FAST ITBLAT ITALAT ITBITE ITAITE
DIVEN
Bit 4= FAST
Fast Mode.
This bit is set and cleared by software. It is used to
select the external cloc k frequ ency . If th e exte rnal
clock frequency is 12 M Hz, this bit must be at 0,
else if the external frequency is 24 MHz, this bit
must be at 1.
Bit 7= VSYNCSEL
DDC1 VSYNC Selection.
This bit is set and cleared by software. It is used to
choose the VSYNC signal in DDC1 mode.
0: VSYNCI selected
1: VSYNCI2 selected
Note: VSYNCI 2 is only available for the DDC cell,
not for the SYNC processor cell.
Bit 6= FL Y _SY N
Flyback or Synchro Switch.
This bit is set and cleared by software. It is used to
choose the signals the Timing Measureme nt Unit
(TMU) will analyse.
0: horizontal and vertical synchro outputs analysis
1: horizontal and vertical Flyback inputs analysis
Bit 5= HS YNCDIVEN
HSYNCDIV Enable.
This bit is set and cleared by software. It is used to
enable the output of the HSYNCO output on PC0.
0: HSYNCDIV disabled
1:HSYNCDIV enabled
Bit 3= ITBLAT
Falling Edge Detector Latch.
This bit is set by hardware when a falling edge
occurs on pin ITB/PD4 in Port D. An interrupt is
generated if ITBITE=1and the I bit in the CC
register = 0. It is cleared by software.
0: No falling edge detected on ITB
1: Falling edge detected on ITB
Bit 2= ITALAT
Falling Edge Detector Latch.
This bit is set by hardware when a falling edge
occurs on pin ITA/PD3 in Port D. An interrupt is
generated if ITAITE=1and the I bit in the CC
register = 0. It is cleared by software.
0: No falling edge detected on ITA
1: Falling edge detected on ITA
Bit 1= ITBITE
ITB Interrupt Enable
.
This bit is set and cleared by software.
0: ITB interrupt disabled
1: ITB interrupt enabled
Bit 0= ITAITE
ITA Interrupt Enable
.
This bit is set and cleared by software.
26/144
0: ITA interrupt disabled
1: ITA interrupt enabled
Page 27
4 ON-CHIP PERIPHERALS
4.1 I/O PORTS
ST72774/ST727754/ST72734
4.1.1 Introd uct i on
The I/O ports allow the transfer of data through
digital inputs and outputs, and, for specific pins,
the input of analog s ignals or the Input/Output of
alternate signals for on-chip peripherals (DDC,
TIMER...).
Figure 15. I/O Pin Typical Cir cuit
Alternate enable
Alternate
1
output
0
DR
latch
Data Bus
DDR
latch
Each pin can be programmed independently as
digital input or digital output. E ach pin can be an
analog input when an analog switch is connected
to the Analog to Digital Converter (ADC).
V
DD
P-BUFFER
(if required)
PULL-UP (if required)
Alternate enable
PAD
Analog Enable
(ADC)
Common Analog Rail
DDR SEL
Analog
Switch (if required)
N-BUFFER
DR SEL
1
Alternate Enable
0
Digital Enable
V
SS
Alternate Input
Note: This is the typical I/O pin configuration. For cost optimization, each port is customized with a specific configuration.
27/144
5
Page 28
ST72774/ST727754/ST72734
I/O PORTS (Cont’d)
Table 7. I/O Pin Functions
DDRMODE
0Input
1Output
4.1.2 Common Functional Description
Each port pin of the I/O Ports can be individual ly
configured under software control as either i nput
or output.
Each bit of a Data Direction Register (DDR)
corresponds to an I/O pin of the associated p ort.
This corresponding bit must be set to configure its
associated pin as output and must be cleared to
configure its associated pin as input (Table 7, “. I/O
Pin Functions,” on page 28). The Data Direction
Registers can be read and written.
The typical I/O circuit is shown on Figure 15. Any
write to an I/O port updates the port data register
even if it is configured as input. Any read of an I/O
port returns either the data latched in the port data
register (pins configured as output) or the value of
the I/O pins (pins configured as input).
Remark: when an I/O pin does not exist inside an
I/O port, the returned value is a logic one (pin
configured as input).
At reset, all DDR registers are cleared, which
configures all port’s I/Os as inputs with or without
pull-ups (see Table 8 to Table 12 I/O Ports
Register Map). The Data Registers (DR) are also
initialized at reset.
4.1.2.1 Input mode
When DDR=0, the corresponding I/O is configured
in Input mode.
In this case, the output buffer is switched off, the
state of the I/O is readable through the Data
Register address, but the I/O state comes directly
from the CMOS Schmitt Trigger output and not
from the Data Register output.
4.1.2.2 Output mode
When DDR=1, the corresponding I/O is configured
in Output mode.
In this case, the output buffer is activated
according to the Data Register’s content.
A read operation is directly performed from the
Data Register output.
4.1.2.3 Analog input
Each I/O can be used as analog input by adding an
analog switch driven by the ADC.
The I/O must be configured in Input before using it
as analog input.
The CMOS Schmitt trigger is OFF and the analog
value directly input through an analog switch to the
Analog to Digital Converter, when the analog
channel is selected by the ADC.
4.1.2.4 Alternate mode
A signal coming from a on-chip peripheral can be
output on the I/O.
In this case, the I/O is automaticall y configured in
output mode.
This must be controlled directly by the peripheral
with a signal coming from the peripheral which
enables the alternate signal to be output.
A signal coming from an I/O can be inpu t in a onchip peripheral.
Before using an I/O as Alternate Input, it must be
configured in Input mode (DDR=0). So both
Alternate Input configuration and I/O Input
configuration are the same (with or without pullup). The signal to be input in the peripheral is taken
after the CMOS Schmitt trigger or TTL Schmitt
trigger for SYNC.
The I/O state is readable as in Input mode by
addressing the corresponding I/O Data Register.
28/144
Page 29
ST72774/ST727754/ST72734
Figure 16. Input Structure for SYNC signals
TTL trigger
Pin
HSYNCI Input
VSYNCI Input
(no pull-up)
I/O logic (if existing)
V
DD
TTL trigg erpull-up
CSYNCI Input
Pin
HFBACK Input
VFBACK Input
I/O logic (if existing)
4.1.3 Port A
PA7 and PA[2:0] can be defined as Input lines
(with pull-up) or as Push-pull Outputs.
PA [6:3] can be defined as Input lines (without pullup) or as Output Open drain lines.
PA7 and PA[2:0] can be defined as Input lines
(with pull-up) or as Push-pull Outputs.
PA [6:3] can be defined as Input lines (without pullup) or as Output Open drain lines.
The alternate functions are the I/O pins of the onchip DDC SCLD & SCDAD for PB0:1, the I/O pins
of the on-chip I2C SCLI & SCDAI for PB2:3, and 4
bits of port B bit can be used as the Analog source
to the Analog to Digital Converter.
Only one I/O line must be configured as an analog
input at any time. The user must avoid any
situation in which more than one I/O pin is selected
as an analog input simultaneously to av oid de vice
malfunction.
When the analog function is selected for an I/O pin,
the pull-up of the respective pin of Port B is
disconnected and the digital input is off.
Table 9. Port B Description
PORT BI/OAlternate Function
Input*OutputSignalCondition
All unused I/O lines should be tied to an
appropriate logic level (either V
Since the ADC is on the same chip as the
microprocessor, the user should not switch heavily
loaded signals during conversion, if high precision
is required. S uch switching will affec t the supply
voltages used as analog references . the a ccuracy
of the conversion depends on the quality of the
power supplies (V
and VSS). The user must take
DD
special care to ensure that a well regulated
reference voltage is present on the V
pins (power supply variations must be less than
5V/ms). T his impli es, in particul ar, that a su itable
decoupling capacitor is used at the V
PC7With pull-upPush-pull10-bit output 8 (PWM)
* Reset State
I / OAlternate Function
Input* OutputSignalCondition
HSYNCDIVEN
=1
(MISCR)
OE2=1
(PWMOE)
OE3=1
(PWMOE)
OE4=1
(PWMOE)
OE5=1
(PWMOE)
OE6=1
(PWMOE)
OE7=1
(PWMOE)
33/144
Page 34
ST72774/ST727754/ST72734
I/O PORTS (Cont’d)
Figure 21. PC0, PC2 to PC7
Alternate
output
Alternate enable
1
V
DD
Figure 22. PC1
DATA BUS
DR
latch
DDR
latch
DDR SEL
DR SEL
DR
latch
0
PULL-UP
OC1E
1
0
OC1E
CMOS Schmitt Trigger
P-BUFFER
N-BUFFER
V
SS
P-BUFFER
PAD
V
DD
34/144
AV
DDR
latch
DDR SEL
DATA BUS
DR SEL
1
0
CMOS Schmitt Trigger
PULL-UP
V
SS
PAD
N-BUFFER
Page 35
I/O PORTS (Cont’d)
4.1.6 Port D
The Port D I/O pins are normally used for the input
and output of video synchronization signals of the
Sync Processor, but are set to I/O Input with pullup upon reset. The I/O mode can be set
individually for each port bit to Input with pull-up
and output push-pull through the Port D DDR.
The configuration to supp ort the Sync Processor
requires that the SYNOP (bit7) and CLMPEN (bit6)
of the ENR (Enable Register of SYNC) is reset.
SYNOP enables port D bits 0,1 and CLMPEN
enables Port D bit 6 to the sync outputs.
Port D, bit 4:3 are the alternate inputs ITA, ITB, (for
the interrupt falling edge detector).
When a falling edge occurs on these inputs, an
interrupt will be generated depending on the status
of the INTX (ITAITE & ITBITE) bit s in the MISCR
Register.
Table 11. Port D Description
ST72774/ST727754/ST72734
Port D, bit 6 is switched to the alternate
(CLAMPOUT) by reset ting the CLMPEN bit of the
ENR Register inside SYNC block.
If the SYNC function is selected, Port D bit 5 and 3
MUST be set as input to enable the HFBACK or
VFBACK timin g in p uts.
Note: As these inputs are switched from normal
I/O function ality, the v ideo sync hronization signals
may also be mo nitored dire ctly through the Port D
Data Register for such tasks as checking for the
presence of video signals or checking the polarity of
Horizontal and Vertical synchronization signals
(when the Syn c Inputs are s witched dire ctly to the
outputs usin g the m ultip lexers of the Sync Proc essor).
The Watchdog timer is used to detect the
occurrence of a software fault, usually generated
by external interference o r by unforeseen logical
conditions, which causes the applicatio n program
to abandon its normal sequence. The Watchdog
circuit generates an MCU reset on expiry of a
programmed time period, unless the program
Figure 26. Watchdog Block Diagram
RESET
WATCHDOG CONTROL REGISTER (CR)
T5
WDGA
T6T0
T4
refreshes the counter’s cont ents before t he T6 bit
becomes cleared.
4.2.2 Main Features
■ Programmable timer (64 increments of 49152
CPU cycles)
■ Programmable reset
■ Res et (if watchdog activated) when the T6 bit
reaches zero
T1
T2
T3
7-BIT DOWNCOU NTE R
f
CPU
CLOCK DIVIDER
49152
÷
4.2.3 Functional Description
The counter value stored in the CR register (bits
T6:T0), is decremented every 49,152 machine
cycles, and the length of the timeout period can be
programmed by the user in 64 increments.
If the watchdog is activated (the W DGA bit is s et)
and when the 7-bit timer (bits T6:T0) rolls over
from 40h to 3Fh (T6 becomes cleared), it initiates a
reset cycle pulling low the reset pin for typically
500ns.
The application program must write in the CR
register at regular intervals during normal
operation to prevent an MCU reset. Th e value to
be stored in the CR register must be between FFh
and C0h (see Table 13 . Watchdog Timing (fCPU =
8 MHz)):
– The WDGA bit is set (watchdog enabled)
– The T6 bit is set to prevent generating an imme-
diate reset
– The T5:T0 bits contain the number of increments
which represents the time delay before the
watchdog produces a reset.
39/144
Page 40
ST72774/ST727754/ST72734
Table 13. Watchdog Timing (f
CR Register
initial value
MaxFFh393.216
MinC0h6.144
= 8 MHz)
CPU
WDG timeout period
(ms)
Notes: Following a reset, the watchdog is
disabled. Once activated it cannot be disabled,
except by a reset.
The T6 bit can be used to generate a software
reset (the WDGA bit is set and the T6 bit is
cleared).
4.2.4 Interrupts
None.
4.2.5 Register Description
CONTROL REGISTER (CR)
Read/Write
Reset Value: 0111 1111 (7Fh)
70
WDGAT6T5T4T3T2T1T0
Bit 7 = WDGA
Activation bit
.
This bit is set by software and only cleared by
hardware after a reset. When WDGA = 1, the
watchdog can generate a reset.
0: Watchdog disabled
1: Watchdog enabled
Bit 6:0 = T[6:0]
7-bit timer (MSB to LSB).
These bits contain the decremented value. A reset
is produced when it rolls over from 40h to 3Fh (T6
becomes cleared).
Table 14. Watchdog Time r Register Map and Rese t Values
Address
(Hex.)
08
40/144
Register
Label
WDGCR
Reset Value
76543210
WDGA
0
T6
T5
1
1
T4
1
T3
T2
1
1
T1
T0
1
1
Page 41
4.3 16-BIT TIMER (TIM)
ST72774/ST727754/ST72734
4.3.1 Introd uct i on
The timer consists of a 16-bit free-running counter
driven by a programmable prescaler.
It may be used for a variety of purposes, including
pulse length measurement of up to two input
signals (
output waveforms (
input capture
output compare
) or generation of up to two
and
PWM
).
Pulse lengths and waveform periods can be
modulated from a few microseconds to several
milliseconds using the timer prescaler and the
CPU clock prescaler.
The principal block of the Programmable Timer is a
16-bit free running counter and its associated 16bit registers:
Counter Registers
– Counter High Register (CHR) is the most sig-
nificant byte (MSB).
– Counter Low Register (CLR) is the least sig-
nificant byte (LSB).
Alternate Counter Registers
– Alternate Count er Hi gh Regi ster ( ACHR) is th e
most significant byte (MSB).
– Alternate Counter Low Register (ACLR) is the
least significant byt e (LSB).
These two read-only 16-bit registers contain the
same value but with the difference that reading the
ACLR register does not clear the TOF bit (overflow
flag), (see note page 43).
Writing in the CLR register or ACLR register resets
the free running counter to the FFFCh value.
The timer clock depends on the cloc k control bits
of the CR2 register, as illustrated in Table 15 Clock
Control Bits. The value in the counter register
repeats every 131.072, 262.144 or 524.288
internal processor clock cycles depending on the
CC1 and CC0 bits.
The Block Diagram is shown in Figure 27.
Note: Some external pins are not available on all devices.
16-BIT TIMER (Cont’d)
16-bit read sequence: (from either the Counter
Register or the Alternate Counter Register).
Beginning of the sequence
At t0
Read MSB
LSB is buffered
Other
instructions
Returns the buffered
LSB value at t0
At t0 +Dt
Read LSB
Sequence completed
ST72774/ST727754/ST72734
Clearing the overflow interrupt request is done by:
1. Reading the SR register while the TOF bit is
set.
2. An access (read or write) to the CLR register.
Notes: The TOF bit is not cleared by ac ces ses to
ACLR register. This feature allows simultaneous
use of the overflow f unction and rea ds of t he free
running counter at random times (for example, to
measure elapsed time) without the risk of clearing
the TOF bit erroneously.
The timer is not affected by WAIT mode.
The user must read the MSB first, then the LSB
value is buffered automatically.
This buffered value rem ains unchanged until the
16-bit read sequence is completed, even if the
user reads the MSB several times.
After a complete reading sequence, if only the CLR
register or ACLR register are read, they return the
LSB of the count value at the time of the read.
An overflow occurs when the counter rolls over
from FFFFh to 0000h then:
– The TOF bit of the SR register is set.
– A timer interrupt is generated if:
– TOIE bit of the CR1register is set and
– I bit of the CC register is clea red.
If one of these conditions is false, the interrupt
remains pending to be issued as soon as they are
both true.
4.3.3.2 External Clock
The external clock (wh ere available) is selected if
CC0=1 and CC1=1 in CR2 register.
The status of the EXEDG bit determi nes the type
of level transition on the external clock pin
EXTCLK that will trigger the free running c ounter .
The counter is synchronised with t he falling edge
of the internal CPU clock.
At least four falling edges of the CPU clock must
occur between two consecutive active edges of
the external clock; thus the external clock
frequency must be less than a qu arter of t he CPU
clock frequency.
This function can be used to control an output
waveform or indicating when a p eriod of time has
elapsed.
When a match is found between the Output
Compare register and the free running counter, the
output compare function:
– Assigns pins with a programmable value if the
OCIE bit is set
– Sets a flag in the status register
– Generates an interrupt if enabled
Two 16-bit registers Output Compare Register 1
(OC1R) and Output Compare Register 2 (OC2R)
contain the value to be compared to the free
running counter each timer clock cycle.
MS ByteLS Byte
i
ROC
OC
i
HROCiLR
These registers are readable and writable and are
not affected by the timer hardware. A reset event
changes the OC
i
R value to 8000h.
Timing resolution is one count of the free running
counter: (
f
CPU/(CC1.CC0)
).
Procedure
To use the output compare function, select the
following in the CR2 register:
– Set the O C
OCMP
i
E bit if an output is needed then the
i
pin is dedicated to the output com pare
function.
– Select the timer clock (CC1-CC0) (see Table 15
Clock Control Bits).
And select the following in the CR1 register:
– Select the OLVL
i
bit to applied to the OCMPi pins
after the match occurs.
– Set the OCIE bit to generate an interrupt i f it is
needed.
When match is found:
– OC F
i
bit is set.
– The OCMP
i
pin takes OLVLi bit value (OCMPi
pin latch is forced low during reset and stays low
until valid compares change it to a high level).
ST72774/ST727754/ST72734
– A timer interrupt is generated if the OCIE bit is
set in the CR2 register and the I bit is cleared in
the CC register (CC).
Clearing the output compare interrupt request is
done by:
3. Reading the SR register while the OCF
set.
4. An access (read or write) to the OC
Note: After a processor write cycle to the OCiHR register,
the output compare function is inhibited un til the
OC
iLR
register is also written.
i
If the OCiE bit is not set, the OCMPi pin is a
general I/O port a nd the OLV L
i
bit will not appear
when match is found but an interrupt could be
generated if the OCIE bit is set.
The value in the 16-bit OC
i
R register and the OLV
bit should be changed after each successful
comparison in order to control an output wavef orm
or establish a new elapsed timeout.
The OC
i
R register value required for a specific
timing application can be calculated using the
following formula:
∆t * f
∆ OC
i
R =
CPU
(CC1.CC0)
Where:
∆t = Desired output compare period (in
seconds)
f
= Internal clock frequency
CPU
CC1-CC0 = Timer clock prescaler
i
The following procedure is recommended to
prevent the OCF
time it is read and the write to the OC
– Write to the OC
are inhibited).
– Read the SR register (first step of the clearance
Figure 34. Output Compare Timing Diagram, Intern al Clock Divided by 2
INTERNAL CPU CLOC K
TIMER CLOCK
COUNTER
FFFD FFFD FFFE
FFFF
Latch
1
Latch
2
0000FFFC
OCMP1
OCMP2
OUTPUT COMPARE REGISTE R
COMPARE REGISTER LATCH
OCFi AND OCMPi PIN (OLVLi=1)
CPU writes FFFF
FFFF
48/144
Page 49
16-BIT TIMER (Cont’d)
4.3.3.5 Forced Compare Mode
In this section
i
may represent 1 or 2.
The following bits of the CR1 register are used:
FOLV2 FOLV1 OLVL2OLVL1
ST72774/ST727754/ST72734
– Set the OPM bit.
– Select the timer clock CC1-CC0 (see Table 15
Clock Control Bits).
Load the OC1R register with the value
corresponding to the length of the pulse (see the
formula in Section 4.3.3.7).
One pulse mode cycle
When the FOLV
to the OCM P
software, only by a chip reset. The OLV
be toggled in order to tog gle the OCMP
it is enabled (OC
The OCF
i
bit is set, the OLV Li bit is copied
i
pin. The FOLVi bit is not cleared by
i
bit has to
i
pin when
i
E bit=1).
i
bit is not set, and thus no interrupt
request is generated.
4.3.3.6 One Pulse Mode
One Pulse mode enables the generation of a pulse
when an external event occurs. This mode is
selected via the OPM bit in the CR2 register.
The one pulse mode uses the Input Capture1
function and the Output Compare1 function.
Procedure
To use one pulse mode, select the following in the
the CR1 register:
– Using the OLVL1 bit, select the level to be ap-
plied to the OCMP1 pin after the pulse.
– Using the OLVL2 bit, select the level to be ap-
plied to the OCMP1 pin during the pulse.
– Select the edge of the active transition on the
ICAP1 pin with the IEDG1 bit
.
And select the following in the CR2 register:
– Set the OC1E bit, the OCMP1 pin is then dedi-
cated to the Output Compare 1 function.
When
event occurs
on ICAP1
initialized
to FFFCh
OCMP1 = OLVL2
When
Counter is
Counter
= OC1R
OCMP1 = OLVL1
Then, on a valid event on the ICAP1 pin, the
counter is initialized to FFFCh and OLVL2 bit is
loaded on the OCMP1 pin. When the value of the
counter is equal to the value of the contents of the
OC1R register, the OLVL1 bit is output on the
OCMP1 pin, (See Figure 35).
Note: T he OCF1 bit cannot be set by hardware i n one
pulse mode but the OCF2 bit can generate an Output Compare interrupt.
The ICF1 bit is set when an active edge occurs and
can generate an interrupt if the ICIE bit is set.
When the Pulse Width Modulation (PWM) and
One Pulse Mode (OPM) bits are both set, the
PWM mode is the only active one.
Figure 35.
One Pulse Mode Timing
....
COUNTER
ICAP1
OCMP1
Note: IEDG1=1, OC1R=2ED0h, OLVL1=0, OLVL2=1
FFFC FFFD FFFE2ED0 2ED1 2ED2
OLVL2
compare1
FFFC FFFD
2ED3
OLVL2OL VL1
49/144
Page 50
ST72774/ST727754/ST72734
16-BIT TIMER (Cont’d)
4.3.3.7 Pulse Width Modulation Mode
Pulse Width Modulation mode enables the
generation of a signal wi th a frequency a nd pul se
length determined by the value of the OC1R and
OC2R registers.
The pulse width modulation mode uses the
complete Output Compare 1 function plus the
OC2R register.
Procedure
To use pulse width modulation mode select the
following in the CR1 register:
– Using the O LVL1 bit, select the level to be ap-
plied to the OCMP1 pin after a successful comparison with OC1R register.
– Using the O LVL2 bit, select the level to be ap-
plied to the OCMP1 pin after a successful comparison with OC2R register.
And select the following in the CR2 register:
– Set OC1E bit : the OCM P 1 pin is then dedicated
to the output compare 1 function.
– Set the PWM bit.
– Select the timer clock (CC1-CC0) (see Table 15
Clock Control Bits).
Load the OC2R register with the value
corresponding to the period of the signal.
Load the OC1R register with the value
corresponding to the length of the pulse if
(OLVL1=0 and OLVL2=1).
If OLVL1=1 and OLVL2=0 the length of the pulse is
the difference between the OC2R and OC1R
registers.
The OC
i
R register value required for a specific
timing application can be calculated using the
following formula:
t * f
CPU
OC
i
R Value =
(CC1.CC0)
- 5
Where:
– t = Desired output compare period (seconds)
–f
= Internal clock frequency (see Miscella-
CPU
neous register)
– CC1-CC0 = Timer clock prescaler
The Output Compare 2 event causes the counter
to be initialized to FFFCh (See Figure 36).
Pulse Width Modulation cycle
When
Counter
OCMP1 = OLVL1
= OC1R
When
OCMP1 = OLVL2
Counter
= OC2R
Counter is reset
to FFFCh
Note: A fter a write instructio n to the O CiHR register, t he
output compare function is inhibited until the OC
register is also written.
i
LR
The OCF1 and OCF2 bits cannot be set by
hardware in PWM mode therefore the Output
Compare interrupt is inhibited. Th e Input Capture
interrupts are available.
When the Pulse Width Modulation (PWM) and
One Pulse Mode (OPM) bits are both set, the
PWM mode is the only active one.
Figure 36. P ul se Wi dt h M odulation Mo de Ti m in g
COUNTER
OCMP1
34E2 FFFC FFFD FFFE2ED0 2ED1 2ED234E2 FFFC
OLVL2
compare2compare1compare2
Note: OC1R=2ED0h, OC2R=34E2, OLV L1= 0, OLVL2= 1
50/144
OLVL2OLVL1
Page 51
ST72774/ST727754/ST72734
4.3.4 Register Description
Each Timer is associated with three control and
status registers, and with six pairs of data registers
(16-bit values) relating to the two input captures,
the two output compares, the counter and the
alternate counter.
CONTROL REGISTER 1 (CR1)
Bit 4 = FOLV2
This bit is not cleared by software, only by a chip
reset.
0: No effect.
1:Forces the OLVL2 bit to be copied to the
OCMP2 pin.
Bit 3 = FOLV1
Forced Output Compare 2.
Forced Output Compare 1.
This bit is not cleared by software, only by a chip
Read/Write
Reset Value: 0000 0000 (00h)
70
ICIE OCIE TOIE FOLV2 FOLV1 OLVL2 IEDG1 OLVL1
Bit 7 = ICIE
Input Capture Interrupt Enable.
0: Interrupt is inhibited.
1: A timer interrupt is generated whenever the
ICF1 or ICF2 bit of the SR register is set.
reset.
0: No effect.
1: Forces OLVL1 to be copied to the OCMP1
pin.
Bit 2 = OLVL2
Output Level 2.
This bit is copied to the OCMP2 pin whenev er a
successful comparison occurs with the OC2R
register and OCxE is set in the CR2 register. This
value is copied to the OCMP1 pin in One P ulse
Mode and Pulse Width Modulation mode.
Bit 6 = OCIE
0: Interrupt is inhibited.
1: A timer interrupt is generated whenever the
OCF1 or OCF2 bit of the SR register is set.
Output Compare Interrupt Enable.
Bit 1 = IEDG1
Input Edge 1.
This bit determines which type of level transition on
the ICAP1 pin will trigger the capture.
Bit 5 = TOIE
Timer Overflow Interrupt Enable.
0: Interrupt is inhibited.
1: A timer interrupt is enabled whenever the
TOF bit of the SR register is set.
0: A falling ed ge tr iggers the cap ture .
1: A rising edge triggers the capture.
Bit 0 = OLVL1
Output Level 1.
The OLVL1 bit is copied to the OCMP1 pin
whenever a successful comparison occurs with
the OC1R register an d the OC1E bit is set in the
CR2 register.
51/144
Page 52
ST72774/ST727754/ST72734
16-BIT TIMER (Cont’d)
CONTROL REGISTER 2 (CR2)
Bit 3, 2 = CC1-CC0
Clock Control.
Read/Write
Reset Value: 0000 0000 (00h)
70
OC1E OC2E OPM PWM CC1 CC 0 IEDG2 EXEDG
Bit 7 = OC1E
Output Compare 1 Enable.
The value of the timer clock depends on these bits:
Table 15. Clock Control Bits
CC1CC0Timer Clock
00
01
10
11
0: Output Compare 1 function is enabled, but
the OCMP1 pin is a general I/O.
1: Output Compare 1 function is enabled, the
OCMP1 pin is dedicated to the Output Compare 1 capability of the timer.
Bit 6 = OC2E
Output Compare 2 Enable.
0: Output Compare 2 function is enabled, but
the OCMP2 pin is a general I/O.
1: Output Compare 2 function is enabled, the
OCMP2 pin is dedicated to the Output Compare 2 capability of the timer.
Bit 1 = IE DG2
Input Edge 2.
This bit determines which type of level transition on
the ICAP2 pin will trigger the capture.
0: A falling ed ge tr iggers the cap ture .
1: A rising edge triggers the capture.
Bit 0 = EXEDG
External Clock Edge.
This bit determines which type of level transition on
the external clock pin EXTCLK will trigger the free
running counter.
Bit 5 = OPM
One Pulse Mode.
0: A falling edge triggers the free running coun-
0: One Pulse Mode is not active.
1: One Pulse Mode is active, the ICAP1 pin can
be used to trigger one pulse on the OCMP1
ter.
1: A rising edge triggers the free running coun-
ter.
pin; the active transition is given by the
IEDG1 bit. The length of the generated pulse
depends on the contents of the OC1R register.
f
/ 4
CPU
f
/ 2
CPU
f
/ 8
CPU
External Clock (where
available)
Bit 4 = PW M
Pulse Width Modulation.
0: PWM mode is not active.
1: PWM mode is active, the OCMP1 pin outputs
a programmable cyclic signal; the length of
the pulse depends on the value of OC1R register; the period depends on the value of
OC2R register.
52/144
Page 53
16-BIT TIMER (Cont’d)
STATUS REGISTER (SR)
Read Only
ST72774/ST727754/ST72734
Bit 2-0 = Unused.
Reset Value: 0000 0000 (00h)
The three least significant bits are not used.
70
INPUT CAPTURE 1 HIGH REGIST ER (IC1HR)
Read Only
Reset Value: Undefined
This is an 8-bit read only register that contains the
ICF1 OCF1TOFICF2 OCF2
high part of the counter value (transferred by the
input capture 1 event).
Bit 7 = ICF1
0: No input capture (reset value).
1: An input capture has occurred. To clear this
bit, first read the SR register, then read or
Input Capture Flag 1.
70
MSBLSB
write the low byte of the IC1R (IC1LR) register.
Bit 6 = OCF1
Output Compare Flag 1.
0: No match (reset value).
1: The content of the free running counter has
matched the content of the OC1R register. To
clear this bit, first read the SR register, then
read or write the low byte of the OC1R
(OC1LR) register.
Bit 5 = TOF
Timer Ov erflow.
0: No timer overflow (reset value).
1:The free running counter rolled over from
INPUT CAPTURE 1 LOW REGISTER (IC1LR)
Read Only
Reset Value: Undefined
This is an 8-bit read only register that contains the
low part of the counter value (transferred by the
input capture 1 event).
70
MSBLSB
FFFFh to 0000h. To clear this bit, first read
the SR register, then read or write the low
byte of the CR (CLR) register.
OUTPUT COMPARE 1 HIGH REGISTER
(OC1HR)
Note: Reading or writing the ACLR register does not clear
TOF.
Bit 4 = ICF2
Input Capture Flag 2.
0: No input capture (reset value).
1: An input capture has occurred.To clear this
bit, first read the SR register, then read or
write the low byte of the IC2R (IC2LR) register.
Bit 3 = OCF2
Output Compare Flag 2.
0: No match (reset value).
1: The content of the free running counter has
matched the content of the OC2R register. To
clear this bit, first read the SR register, then
read or write the low byte of the OC2R
(OC2LR) register.
Read/Write
Reset Value: 1000 0000 (80h)
This is an 8-bit re gister tha t co ntains t he hi gh part
of the value to be compared to the CHR register.
70
MSBLSB
OUTPUT COMPARE 1 LOW REGISTER
(OC1LR)
Read/Write
Reset Value: 0000 0000 (00h)
This is an 8-bit register that contains the low part of
53/144
Page 54
ST72774/ST727754/ST72734
16-BIT TIMER (Cont’d)
OUTPUT COMPARE 2 HIGH REGISTER
(OC2HR)
70
Read/Write
MSBLSB
Reset Value: 1000 0000 (80h)
This is an 8-bit register that cont ains the high part
of the value to be compared to the CHR register.
ALTERNATE COUNTER HIGH REGISTER
(ACHR)
Read Only
70
MSBLSB
Reset Value: 1111 1111 (FFh)
This is an 8-bit re gister tha t co ntains t he hi gh part
of the counter value.
70
OUTPUT COMPARE 2 LOW REGISTER
(OC2LR)
MSBLSB
Read/Write
Reset Value: 0000 0000 (00h)
This is an 8-bit register that contains the low part of
the value to be compared to the CLR register.
ALTERNATE COUNTER LOW REGISTER
(ACLR)
Read/Write
70
MSBLSB
Reset Value: 1111 1100 (FCh)
This is an 8-bit register that contains the low part of
the counter value. A write to this register resets the
COUNTER HIGH REGISTER (CHR)
Read Only
counter. An access to this register after an access
to SR register does no t clear t he TOF bit in SR
register.
Reset Value: 1111 1111 (FFh)
This is an 8-bit register that cont ains the high part
of the counter value.
70
MSBLSB
70
INPUT CAPTURE 2 HIGH REGIST ER (IC2HR)
MSBLSB
Read Only
Reset Value: Undefined
This is an 8-bit read only register that contains the
COUNTER LOW REGISTER (CLR)
Read/Write
Reset Value: 1111 1100 (FCh)
high part of the counter value (transferred by the
Input Capture 2 event).
70
This is an 8-bit register that contains the low part of
the counter value. A write to this register resets the
MSBLSB
counter. An access to this register after accessing
the SR register clears the TOF bit.
The Sync processor handles all the man agement
tasks of the video synchronization signals, and is
used with the timer and software to provide
information and status on the video standard an d
timings. This block supports multiple video
standards such as: Separate Sync, Composite
Sync and (via an external extractor) Sync on
Green. The internal clock in the Sync processor is
4 MHz.
4.4.2 Main Features
■ Input Processing
– Presence of incoming signals (edge detection)
– Read the HSYNCI / VSYNCI input signal levels
– Measure the signal periods
– Detect the sync polarities
– Detect the composite sync and extract VSYNCO
■ Output Processing
Figure 37. Sync Processor Block Diagram
Latch
Pulse Detec t
VSYNCI1
VSYNCI2
HSYNCI1
HSYNCI2
CSYNCI
Note: CLK is f
Pull-Up Resistor (if existing)
1
0
HVSEL
HVSEL
1
0
Latch
Pulse Detect
0
1
Latch
Pulse Detect
in fast mode (see note in Clock System section)
INT/2
SCI0
VSYNCI
Capt ure
LD
Register
&
(see note)
Prescaler
PSCD
Up / Down
CLK
INT
f
Sync
Edge
Detect
LCV0
HSYNCI / CSYNCI
5-Bit Counter
Latch
00
match
ICAP2 TIMER
LCV1
Control
Logic
Correction
– Control the sync output polarities
– Gene rate free-running frequenc ies
– Gene rate a video blanking signal
– Gene rate a clamping signal or a Moire signal
■ Analyzer Mode
– Meas ure the number of scan lines per frame to
simplify OSD vertical cent er ing
– Detect HSYNCI reaching too high a frequency
– Detect pre/post equal ization pulses
– Measure the low level of HSYNCO or HFBACK
■ Correc tor Mode
– Inhibit Pre/Pos t equalization pulses
– Program VSYNCO pulse width extension
– Extend VSYNCO pulse widths during:
post-equalization pulse detection only
pre and post-equalization pulse detection
Note: Some external pins are not available on all devices.
Refer to the device pinout description.
EN
Latch
1F
match
H-Inhibit
ON/OFF
H Sync O
Polarity
H Sync O
Vsync*
LCV1
V
S
Y
HFBACK
N
C
O
ICAP1 TIMER
V Sync O
Polarity
VFBACK
0
1
FBSEL
1
0
HVGEN
HFBACK
VFBACK
Polarity
Detector
V Sync
Correction
1
0
FBSEL
Sync Generator
Sync Analyze r
Sync Correc to r
Hardwar e Bloc k
(Positive polarity)
Back Porch
Clamp
Generator
HVGEN
0
1
Blanking
Generator
VSYNC Ge nerator
Typical Pulse Width
HSYNC Generator
Duty cycle ran ge
SYNOP
Clamp
Polarity
CLPINV
Other
00
BP1, BP0
SYNOP
40 - 200 Hz
20 - 256 µs
15 - 200 kHz
3 - 40 %
CLMPEN
VSYNCO
BLKEN
BLANKOUT
HSYNCO
CLAMPOUT
VR02071C
56/144
Page 57
SYNC PROCESSOR (SYNC) (Cont’d)
4.4.3 Input Signals
The Sync Processor has the following inputs (TTL
level):
5µs < Typical Hor. Total time < 66.66µs
(200kHz)(15kHz)
Maximum Sync. pulse width: 7µs
Note: Minimum HPeriod: 500ns + S/W interrupt servicing time
Figure 39. Vertical Sync Input Timing
or:
(1 Timer Clock)
VR01961
5ms < Typical Ver. Total time < 25ms
(200Hz)(40Hz)
Typical Sync. pulse width: 0.0384ms - 0.600ms
Note: Minimum VPeriod: 500ns + S/W interrupt servicing time
(1 Timer Clock)
VR01961A
58/144
Page 59
SYNC PROCESSOR (SYNC) (Cont’d)
ClampOut and Moire Signal
ST72774/ST727754/ST72734
Moire Signal
Clamp Output signal
The clamping pulse generator can control the
pulse width and polarity signal and can be
configured as pseudo-front porch or back porch.
To use the ClampOut signal:
– Select the Clamping Pulse width:
BP0/BP1 bits in MCR register
– Program the Clamp polarity:
CLPINV bit in POLR register
– Select the ClampOut signal as back-porch (after
falling edge of HSYNCO) or pseudo-front porch
(after the rising edge of HSYNCO):
HS0/HS1 bits in MCR register.
– Enable the CLAMPOUT signa l:
CLMPEN bit in ENR register
Figure 40. Clamping Pulse (CLAMPOUT) Delay
The Moire output signal is available (instead of the
clamping signal) to reduce the screen Moire effect
and improve color transitions.
The CLAMPOUT pin is alternatively used to output
a Moire signal.
The output signal toggles at each HFBACK rising
edge. After each V FBACK fallin g edge, the va lue
of the Moire output is t he opposite of the previous
one, independent of the number of HFBACK
pulses during the VFBACK low level.
To use the Moire signal:
– Select the Moire signal:
Figure 41. M oi re Output (instead of Clamping Output)
VFBACK
HFBACK
Moire
4.4.5.1 Blanking output signal
The Video Blanking function uses VSYNCO,
HFBACK, VFBACK as input signals and
BLANKOUT output as Video Blanking Output. This
To use the video blanking signal:
– Program the polarity:
– Enable the BLANKOUT output:
output pin is a 5V ope n-drain output and can be
AND-wired with any external video blanking signal.
Note: HFBACK, VFBACK, V SYNCO signals must have
positive polarity.
Figure 42. Video Blanking Stage Simplified Schematic
HFBACK
VFBACK
To Edge detector (LATR)
To Edge detector (LATR)
R
S
BLKINV bit in POLR register
BLKEN bit in ENR register
BLKINV
BLKEN
BLANKOUT
60/144
VSYNCO
Page 61
SYNC PROCESSOR (SYNC) (Cont’d)
4.4.6 Input Processing
4.4.6.1 Detecting Signal Presence
The Sync Processor provides two ways of
checking input signal presen ce, by direct ly pollin g
the LATR Latch Register or using the Timer
interrupts.
Pollingcheck
Use the Latch Register (LATR), to detect the
presence of HSYNCI, VSYNCI, CSYNCI,
HFBACK and VFBACK signals. These latched bits
are set when the falling edge of the corresponding
signal is detected. They are cleared by software.
Interrupts check
Due to the fact that VSYNCI is connected to Timer
Input Capture 1 and HSYNCI or CSYNCI is
connected to Timer Input Capture 2, the Timer
interrupts can be used to det ect the presence of
input signals. Refer to the 16-bit Timer chapter for
the description of the Timer registers.
To use the interrupt method:
– Select Input Capture1 edge detecti on:
IEDG1 bit in the Timer CR1 register
– Select Input Capture 2 edge detection (must be
falling edge):
IEDG2 bit = 0 in the Timer CR2 register
– Enable Timer Input Capture interrupts:
ICIE bit in the Timer CR1 register.
– Select the Hsync and Vsync input signals:
HVSEL bit in the POLR register
– Enable the prescaler for HSYNCI or CSYNCI
signal:
PSCD bit in the CCR register.
– Select the normal mode:
LCV1/LCV0 bits in the CCR register.
Perform any of the following:
– Check for VSYNCI presence by monitoring inter-
rupt requests from Timer ICAP1. When VSYNCI
is detected then either detect the VSYNCI polar-
ity or check for HSYNCI presence.
– Check for HSYNCI presence by monitoring inter-
rupt requests from Timer ICAP2. On detecting
HSYNCI, either detect its polarity or check if the-
composite sync on HSYNCI pin is detected or
check for CSYNCI presence.
ST72774/ST727754/ST72734
– Check for CSYNCI presence by monitoring inter-
rupt requests from Timer ICAP2.
4.4.6.2 Measuring Sync Peri od
To measure the sync period, the S ync processor
block uses the Timer Input Capture interrupts:
– ICAP1 connecte d to VSYNCI signal
– ICAP2 connected to HSYNCI/CSYNCI signal
with a 256 prescaler
Calculating the difference between two
subsequent Input Captures (16-bit value) gives the
period for 256xPH (horizontal period) and PV
(vertical period).
The period accuracy is one timer clock (500ns at 2
MHz), so that the tolerance is 500ns for PH and
256 * PH (PH accuracy =1.95ns).
Notes:
1) In case of composite sy nc, the HSYNCI pe riod
measurement can be synchronized on the
VSYNCI pulse by setting and resetting the
prescaler PSCD bit in the CCR re gister (for this
function, the ICAP2 det ection m us t be selected
as falling edge).
This avoids errors in the period measurem ent
due to the Vsync pulse.
2) The Timer Interrupt request should be masked
during a write access to any of the Sync
processor control registers.
Importa nt N ot e:
Since the recognition of the video mode relies
on the accuracy of the measurements, it is
highly recommended to implement a counterstyle algorithm which performs several
consecutive measurements before switching
between modes.
The purpose of this a lgorithm is t o f ilter out any
glitches occurring on the video signals.
61/144
Page 62
ST72774/ST727754/ST72734
SYNC PROCESSOR (SYNC) (Cont’d)
4.4.6.3 Detecting Signal Polarity
The Sync Processor provides two ways for
checking input signal polarity by polling the latches
or using the 5-bit up/down counter.
Polling check
– HSYNCI polarity detection:
UPLAT/DWNLAT bits in LATR register
These bits are directly connected to the 5-bit
Up/Down counter.
– VPOL bit (VSYNCO polarity) in POLR and
– VOP bit (VSYNCO polarity control) in MCR
The delay between VSYNCI polarity changes
and the VPOL bit typically toggles within 4
msecs. The polarity detector includes an
integrator to filter possible incoming VSYNCI
glitches.
5-bit Up/Down Counter Check
for HSYNCI Polarity
This method involves the internal 5-bit up/down
counter.
The counter value (CV4-CV0 bits) is updated with
the 5-bit counter value at ev ery detected e dge o n
the signal monitored.
It is incremented when the signal is high, otherwise
it is decremented.
– Start the detection phase:
Initialize the 5-bit counter: write '00000' in the
CCR register (CV4-CV0 bits).
Select normal mode on falling edge:
LCV1/LCV0 = 0 in the CCR register.
– Software checks the counter value (CV4-CV0)
after an interrupt (with the signal internally connected or ICAP2) or by polling (timeout 150µs).
Positive polarity: The counter value < 1Fh.
Negative polarity: The counter value =1Fh on
the falling edge.
In case of a composite incoming signal, the
software just has to check that the VSYNCO
period and polarity are stable.
4.4.6.4 Extracting VSYNCO from CSYNCI
In case of composite sync, the Vertical sync output
signal is extracted with the 5-bit up/down counter.
Initially, the width of an Horizontal Sync
component pulse is automatically determined by
hardware which defines a threshold for the 5-bit
counter with a possible user-defined tolerance.
The circuit then monitors for any i ncoming period
greater than this previously captured value. This is
then processed as the VSYNCO signal.
To use the Vsync extractor, the following steps are
necessary:
– Detection of a composite sync signal:
When the UPLAT and DOWNLAT bits in LATR
register are set, a composite sync signal or a
HSYNCI polarity change is detected.
If these bits are stable during two subsequent
ICAP2 interrupt, the composite sync signal is
stable.
– Defining a threshold:
Select the normal mode (LCV1/LCV0=0 in the
CCR register).
Initialize the counter capture CV4-CV0 to 0.
This automatically measures the HSYNCI pulse
width. It defines a threshold in the CV4-CV0 bits
used by the 5-bit up/down counter.
It also allows to check the HSYNCI polarity
(refer to the “5-bit Up/Down Counter Check”
paragraph.
If a user-defined tolerance is to be added, then
an updated value should be written in the CCR
register (CV4-CV0 bits).
In a composite sync signal, Hsync and Vsync
always have the same polarity.
– Starting the VSYNCO hardware extraction
mode:
According to the Composite sync polarity, select
the extraction mode (LCV1/LCV0 in CCR
register) and rewrite the counter if necessary.
Negative polarity: minimum threshold (00h)
Positive po larity: maximum thresho ld (1Fh)
Note:
The extracted VSYNCO signal always has
negative polarity.
62/144
Page 63
ST72774/ST727754/ST72734
SYNC PROCESSOR (SYNC) (Cont’d)
4.4.6.5 Example of VSYNCO extraction for a
negative composite sync with serration pulses
Refer to Figure 43.
In extraction mode, the 5-bit comparator checks
the counter value with respect to the threshold.
When the incoming signal is high, the cou nte r is
increased, otherwise it is decreased.
When the counter reaches the threshold on its way
down, VSYNCO is asserted. During the vertical
blanking, the counter value is decreased down to a
programmable minimum, i.e. it does not underflow.
Figure 43. VSYNCO Extraction from a Composite Signal (negative polarity)
When the vertical pe riod is finished, the counter
starts counting up and when the maximum is
reached, VSYNCO is negated. The extracted
signal may be validated by software since it is input
to Timer ICAP1.
Serration pulses during vertical blanking can be
filtered if the serration pulse widths are less than
8µs.
In the same way, posit ive compo site sync si gnals
can be used by properly selecting the edge
sensitivity in HSYNCI width measurement mode
(LCV0 bit).
Composite signal
Input
Counter value:
1F=Max
8µs
Threshold
0=Min
VSYNCO
generated
Max Delay: 8µs
or threshold
HSYNCO
Figure 44. Obtaining the 11-bit Vertical Period (V11BITS)
7
CFGR
0
VGENR
7
V11BITS
0
10
Serration pulses
Max Pulse width: 8µs
1F-Threshold
VSYNCO Pulse
0
Q’2
Q’0
Q’1
Example:
VGENR=CCh, CFGR = 3h
V11bits=663h
VR01990
63/144
Page 64
ST72774/ST727754/ST72734
SYNC PROCESSOR (SYNC) (Cont’d)
4.4.7 Output Processing
4.4.7.1 Generating Free-Running Frequencies
The free-running frequencies function is used to:
– Drive the monitor when no or bad sync signals
are received.
– Stabilize the OSD screen when the monitor is
unlocked.
– Perform fast alignment for maintenance purpos-
es.
Note: When free-running mode is active, the analyzer
and corrector modes must be disabled.
– VCORDIS = 1, VEXT = 0 in CFGR and POLR
registers for vertical output measurement
– 2FHINH = 0 in CFG R register for horizontal
low level measurment
– VACQ, HACQ = 0, in CFGR register for ana-
lyzer mode
The Sync processor can generate any of the
following output sync si gnals HSY NCO, VSYNCO,
CLAMPOUT, BLANKOUT.
The analyzer block is used for all extra
measurements on the sync signals to manage the
monitor functions:
– Measure the number of scan lines per frame
(VSYNCO or VFBACK) to simplify the OSD vertical centering.
– Measure the low level of HSYNCO or HFBACK.
This function can be used for VSYNCO pulse
extension or for a fast estimation of the incoming
Hsync signal period.
– Detection of the pre/post equalization pulses.
Notes:
1. Analyzer mode should be performed before
corrector mode.
2. When analyzer mode is active, the free-running
frequencies generator and corrector mode must
be disabled.
– HVGEN = 0 in ENR register
– 2FHINH 0 in CFGR register for Horizontal low
level measurement
– VEXT = 0, VCORDIS = 1 in CFGR, POLR reg-
isters for Vertical output measurement
3. If H/VBACK are selected (FBSEL=0) corrector
mode must be disabled
4. For all measurements, HSYNCO and VSYNCO
must be POSITIVE.
ST72774/ST727754/ST72734
For maximum accuracy, it is pos sible to measure
the low level of HFBACK with the same technique
(FBSEL bit in the MCR register).
Figure 45. Horizontal Low Level Measurement
Measure HLow
Disable H correction Mode
2FHINH=0
Disable H i nternal gener ation
HVGEN= 0
HSYNCO Positive polarity
Select H/VBACK or H/VSYNCO
FBSEL=0 or 1
HACQ=1
Start measurement
No
HACQ=0?
Yes
Necessary if Signals
are H/VSYNCO
4.4.8.1 Horizontal Low Level Measurem ent
The measurement starts in setting HACQ by
software. When this bit is cleared by hardware, the
HGENR register returns the result.
The algorithm is shown in Figure 45.
HLow = ((255-HGENR+1)/4) µs
Note: HLow maximum value = 64µs (even if real value is
greater)
HGENR=Result
END
VR02118A
65/144
Page 66
ST72774/ST727754/ST72734
SYNC PROCESSOR (SYNC) (Cont’d)
4.4.8.2 Vertical Output Measurement
The function of vertical pulse measurement is to:
– Capture the number of HSYNCO pulses during
a Low level of VSYNCO.
– Capture the number of HFBACK pulses during a
Low level of VFBACK (maximum accuracy).
Start the measurement by setting VACQ in the
CFGR. When the m easuremen t is completed this
bit is cleared by hardware. The VGENR and CFGR
registers return the result.
The algorithm is shown in Figure 46.
HLine = 2048 - (V11bits)
Hline maximum value = 2048 (even if real value is
greater)
V11bits = VGENR(8 MSB) and Q'2,Q'1,Q'0 (3
LSB). Refer to Figure 44.
Note: In case of pre/post equalization pulses, set the
2FHINH bit in the CFGR register.
4.4.8.3 Detection of pre equalization pulses
This function uses two bits:
– 2FHDET in POLR register continuously updated
by hardware
– 2FHLAT in LATR register set by hardware when
a higher frequency is detected and reset by software
A measurement of the low level of HSYNCO is
necessary before reading this information.
Note: Reset the 2FHLAT b it in the LATR r egister on the
third Hsync pulse after the Vsync pulse.
Figure 46. Vertical Output Measurement
Measure H Lines
Disable V correction M ode
VCORDIS=1, VEXT=0
Disable H i nternal gener ation
HVGEN= 0
H & VSYNCO Positive polarity
Select H/VBACK or H/VSYNCO
FBSEL=0 or 1
VACQ=1
Start measurement
No
VACQ=0?
Yes
VGENR & CFGR=Result
END
Necessary if Signals
are H/VSYNCO
VR02118B
66/144
Page 67
SYNC PROCESSOR (SYNC) (Cont’d)
4.4.9 Corrector Mode
In this mode, you can perform the following
functions:
– Inhibit pre/post equalization pulses
This removes all pre/post equalization pulses
on the HSYNCO signal.
The inhibition starts on the falling edge of
HSYNCO and lasts for (((HGENR+1)/4)-2)
µs. The decrease of 2µs (one minimum pulse
width) avoids the removal of the next pulse of
HSYNCO.
Procedure:
1. HSYNCO and VSYNCO polarities must be
positive.
2. Measure the low level of HSYNCO.
3. Set the 2FHINH bit in the CFGR register.
– Extend VSYNCO pulse width by several scan
lines
This function c an be al so used to extend the
video blanking signal.
Procedure:
1. HSYNCO and VSYNCO polarities must be
positive.
2. Set the 2FHINH bit in the CFGR register
only if some pre/post equalizations pulses
are detected. (2FHLAT, 2FHDET flags).
3. The extension will be the number of
HSYNCO periods set in the VGENR
register.
4. Reset the VCORDIS bit in the POLR
register.
– Extend VSYNCO width during all post equaliza-
tion pulses.
This function extends the VSYNCO pulse
width when post equalization pulses are
detected (2FHDET bit in the POLR register
and 2FHLAT bit in the LATR register).
ST72774/ST727754/ST72734
Procedure:
1. HSYNCO and VSYNCO polarities must be
positive.
2. Set the 2FHINH bit in the CFGR register to
remove pre/post equalization pulses.
3. Measure the low level of HSYNCO.
4. Update HGENR =(FFh - (HGENR + 1)) + 4
to add tolerance
5. Write VGENR > 0.
6. Reset the VCORDIS bit in the POLR
register
7. Set the VEXT bit in the CFGR register.
– Extend VSYNCO pulse width during pre and
post equalization pulses (for test only).
This function allows extending the VSYNCO
pulse width as long as equalization pulses are
detected. (VSYNCO = VSYNCO + 2FHDET).
Procedure:
1. HSYNCO and VSYNCO polarities must be
positive.
2. Set the 2FHINH bit in the CFGR register to
remove pre/post equalization pulses.
3. Measure the low level of HSYNCO.
4. Update HGENR =(FFh - (HGENR + 1)) + 4.
5. Write VGENR > 0.
6. Reset the VCORDIS bit in the POLR register.
7. Set the VEXT bit in the CFGR register.
8. Set the 2FHEN bit in the ENR register.
Notes:
1. When corrector mode is active, the free-running
frequencies generator and analyzer mode must
be disabled.
(HVGEN=0 in ENR register, HACQ=0, VACQ=0
in the CFGR register).
2. If VGENR=0, all VSYNCO correction functions
are disabled except the 2FHEN b it which must
be cleared if VGENR = 0 or VCORDIS = 1.
Bit 4 = 2FHINH Inhibition of Pre/ P ost equal izat ion
70
HACQ VACQ-2FHINH VEXTQ’2Q’1Q’0
pulses.
This function removes pre/post equalization
pulses on HSYNCO signal. The sync generator
and the Horizontal sync analyzer must both be
Bit 7 = H ACQ Horizontal Sync Analyzer Mode
Set by software, reset by hardware when the
measurement is done. The sync generator must
Case HVGEN = 1: Generation mode
In this mode, this register contains the Hsync freerunning frequency.
The generated signal is:
- Pulse widt h: 2 µs.
- Period PH = ((HGENR+1)/4) µs.
- Polarity: Positive
Note: The value in HGENR must be in the range [8..255]
Case HVGEN = 0: Analyzer/corrector Mode
Read/Write
Reset Value: 0000 0000 (00h)
70
MSBLSB
Case HVGEN = 1: Generation mode
In this mode, this register contains the Vsync free-
running frequency (11-bit value).
The generated signal is:
- Pulse width: 4 * PH µs (horizontal period).
- Period PV = PH * (V11bits) µs.
- Polarity: Positive
.
Note: The value in VGENR must be in the range [5..255]
The Vsync generation mode works as an 11-bit horizontal line counter (2047 scan lines per frame
max.). The 3 L SB are in the CFGR regist er. Refer
to Figure 44.
Sub-case HACQ = 1: Analyzer Mode
By setting HACQ bit by software the Analyzer
Case HVGEN = 0: Analyzer/Corrector Mode
mode starts. When HACQ is cleared by hardware,
HGENR returns the duration of HSYNCO/
HFBACK low level. The anal ysis should be done
before corrector mode.
Sub-case VACQ = 1: Analyzer Mode
Set the VACQ bit to start analyzer mode. When
VACQ is cleared by hardware, VGENR/CFGR
returns the number of scan lines during the
Sub-case HACQ = 0: Corrector Mode
VSYNCO/VFBACK low lev e l pe rio d.
In this mode, the final HSYNCO signal on the pin
can be corrected in order to detect and inhibit pre/
post equalization pulses.
The timing measurement unit (TMU) allows the
analysis of the current video timing characteristics
in order to control display position and size.
It consists of measuring the timing between the
horizontal or vertical sync output signals and the
active video signal input (AV).
4.5.2 Main Features
■ Horizontal or vertical timing measurement
■ Oscillator clock f
horizontal measurement
■ Horizontal sync signal (HSYNCO or HFBACK)
(24 or 12 MHz) used for
OSC
and Vertica l sync signal ( VSYNC O o r VFBACK)
used for all measurements
■ Measurements performed on positive signals
only
■ 11-bit counter
■ Overflow detection
4.5.3 Functional Description
The Timing Measurement Unit is c ent ered aroun d
an 11-bit counter. Depending on the H_V bit of the
control register, the TMU me asures the hori zontal
or vertical video characteristics.
For horizontal analysis (refer to Figure 48):
– Obtain the minimum number of oscillator clock
cycles (H1) between the falling edge of the
horizontal sync signal (HSYNCO or HFBACK)
and the first rising edge of the active video input (AV), for all lines, between 2 consecutive
vertical sync pulses.
– Obtain the minimum number of oscillator clock
cycles (H2) between the last falling edge of
the active video input (AV) and the rising edge
of the horizontal sync signal (HSYNCO or HFBACK) for all lines, between 2 consecutive
vertical sync pulses.
Note: Horizontal measurement is inhibited during the high
level of VSYNCO or VFLYBACK.
For vertical analysis (refer to Figure 49):
– Obtain the minimum number of horizontal
sync p ulses ( V1) b etween t he fa lling ed ge of
the vertical sync signal (VSYNCO or VFBACK) and the first rising edge of the active
video input, during 2 consecutive frames.
Figure 47. TMU Block Diagram
ST7 INTERNAL BUS
TMUT1CRTMUT2CRTMUCSR
T1[7:0]T2[7:0]
88
COMPARATOR
T2[10]
T2[9] T2[8]T1[9] T1[8]STARTH_V
T1[10]
3
SUP
11
Clock
f
OSC
(1)
Start
Stop
(1)
11 bit COUNTER
(FROM SYNC PROCESSOR)
Note 1: Selection between Sync outputs or Flyback inputs is made in MISCR register (bit 6: FLY_SYN)
HSYNCO or HFBACK
VSYNCO or VFBACK
3
CONTROL
AV
75/144
Page 76
ST72774/ST727754/ST72734
TIMING MEASUREMENT UNIT (Cont’d)
– Obtain the minimum number of horizontal
sync output pulses (V2) between the last falling edge of the active video input (AV) and the
rising edge of the vertical sync signal (VSYNCO or VFBACK) during two 2 consecutive
frames.
The H_V bit selects horizontal or vertical
measurement. This selection should be made prior
to starting the measurement by setting the START
bit. This bit is set by software but only cleared by
hardware at the end of the measurement.
When the measurement is finished (rising e dge of
AV, horizontal or vertical sync signals), the results
(T1,T2) are transferred into the corresponding
registers (H1,H2) or (V1,V2).
Note: The values of the H1/H2 or V1/V2 registers are
available only at the end of a measurement (after
the START bit has been cleared).
4.5.3.1 Horizontal Measurement
When the H_V bit = 1, and when the ST ART bit is
set by software, the m easurement s tarts after the
next vertical sync pulse. The TMU searches the
minimum values of H1 and H2 until the rising edge
of the next following vertical sync pulse. The
START bit is then cleared by hardware.
The values of the H1 and H2 registers are
available only at the end of a measurement, in
other words when the START bit is at 0.
4.5.3.2 Vertical Measuremen t
When the H_V bit = 0 and, when th e STA RT bi t is
set by software, the TM U measures the m inimum
V1 and V2 values during 2 consecutive vertical
frames. The START bit is then cleared by
hardware.
4.5.3.3 Special cases
– If an overflow of the counter occurs during any of
the measurements, the measured T1 or T2 values will be 7FFh.
– If the AV signal is always low (no active video),
the measured T1 or T2 values will also be 7FFh.
– If T1 ≤ 0 (AV already high when the falling edge
of the sync signal occurs), the measured T1 value will be fixed to 1.
– If T 2 ≤ 0 (AV still high when the rising edge of the
sync signal occurs), a specific T2 value will be returned.
Note: Refer to Application Note AN1183 for further de-
tails.
Figure 48. Horizontal Measurement
HSYNCO or
HFBACK
H1H2
AV
H1 and H2 measured in oscillator clock periods
Note: HSYNCO or HFBACK must be positive.
Figure 49. Vertical Measurement
VSYNCO or
VFBACK
V1V2
AV
V1 and V2 measured in horizontal pulses
Note: VSYNCO or VFBACK must be positive.
76/144
Page 77
ST72774/ST727754/ST72734
TIMING MEASUREMENT UNIT (Cont’d)
4.5.4 Register Description
CONTROL STATUS REGISTER (TMUCSR)
Bit 7:2 - Read only
Bit 1:0 - Read/Write
Reset Value: 1111 1100 (FCh)
70
T2[10] T2[9] T2[8] T1[10] T1[9] T1[8] H_V START
Bit 7:5 = T2[10:8]
MSB of T2 Counter.
Most Significant Bits of the T2 co unter value (see
T2 Counter register description).
T1 COUNTER REGISTER (TMUT1CR)
Read Only
Reset Value: 1111 1111 (FFh)
This is an 8-bit register that contains the low part of
the counter value.
70
T1[7]T1[0]
When a T1 measurement is finished (rising edge
on AV input), the 11-bit counter value is transferred
to this register and to the T 1[10 :8] bits i n the CS R
register.
T1 is H1 value if the H_V bit = 1.
Bit 4:2= T1[10:8]
MSB T1 Counter
.
Most Significant Bits of the T1 co unter value (see
T1 Counter register description).
Bit 1 = H_V
Horizontal or Vertical Measurement.
This bit is set and cleared by software to select the
type of measurement. I t cannot be m odified while
the START bit = 1 (measurement in progress).
This bit is set by software and cleared by hardware
when the measurements are completed. It can not
be cleared by software.
0: Measurement done.
1: Start measurement.
T1 is V1 value if the H_V bit = 0.
T2 COUNTER REGISTER (TMUT2CR)
Read Only
Reset Value: 1111 1111(FFh)
This is an 8-bit register that contains the low part of
the counter value.
70
T2[7]T2[0]
When a T2 measurement is finished (rising edge
on the selected sync signal), the 11-bit counter
value is transferred to this register and to the
T2[10:8] bits in the CSR register.
T2 is H2 value if the H_V bit = 1.
T2 is V2 value if the H_V bit = 0.
77/144
Page 78
ST72774/ST727754/ST72734
TIMING MEASUREMENT UNIT (Cont’d)
Table 22. TMU Register Map and Reset Values
Address
(Hex.)
0E
0F
10
Register
Name
CSR
Reset Value
T1CR
Reset Value
T2CR
Reset Value
76543210
T2[10]
1
T1[7]
1111111
T2[7]
1111111
T2[9]
1
T2[8]
1
T1[10]
1
T1[9]
1
T1[8]
1
H_V
0
START
0
T1[0]
1
T2[0]
1
78/144
Page 79
4.6 USB INTERFACE (USB)
ST72774/ST727754/ST72734
4.6.1 Introd uct i on
The USB Interface implements a low-speed
function interface between the USB and the ST7
microcontroller. It is a highly integrated circuit
which includes the transceiver, 3.3 voltage
regulator, SIE and DMA. No ext ernal com ponent s
are needed apart from the external pull-up on
USBDM for low speed recognition by the USB
host.
4.6.2 Main Features
■ USB Specification Version 1.0 Compliant
■ Supports Low-Speed USB Protocol
■ Two or Three E ndp oints (i ncludin g default one)
depending on the device (see device feature list
and register map)
■ CRC generation/checking, NRZI encoding/
decoding and bit-stuffing
■ USB Suspend/Resume operations
■ DMA Data transfers
■ On-Chip 3.3V Regulator
■ On-Chip USB Transceiver
4.6.3 Functional Description
The block diagram in Figure 50, gives an overview
of the USB interface hardware.
Serial Interface Engine
The SIE (Serial Interface Engine) interfaces with
the USB, via the transceiver.
The SIE processes tokens, handles data
transmission/reception, and handshaking as
required by the USB standard. It also performs
frame formatting, including CRC generation and
checking.
Endpoints
The Endpoint registers indicate if the
microcontroller is ready to transmit/receive, and
how many bytes need to be transmitted.
DMA
When a token for a valid Endpoint is recognized by
the USB interface, the related data transfer takes
place, using DMA. At the end of the transaction, an
interrupt is generated.
Interrupts
By reading the Interrupt Status register,
application software can know which USB event
has occurred.
For general information on the USB, refer to the
“Universal Serial Bus Specifications” document
available at http//:www.usb.org.
Bits 7:0=DA[15:8]
See the description of bits DA7-6 in the next
register (IDR).
INTERRUPT/DMA REGISTER (IDR)
Read / Write
Reset Value: xxxx 0000 (x0h)
70
DMA address bits 15-8.
Bits 7:6 = DA[7:6]
The software must writ e the start address of the
DMA memory area whose most significant bits are
given by DA15-DA6. The remaining 6 address bits
are set by hardware. See Figure 51.
Bits 5:4 = EP[1:0]
These bits identify the endpoint which required
attention.
00: Endpoint 0
01: Endpoint 1
10: Endpoint 2
When a CTR interrupt occurs (see register ISTR)
the software should read the EP bits to identify the
endpoint which has sent or received a packet.
Bits 3:0 = CNT[3:0]
This field shows how man y data bytes have b een
received during the last data reception.
Note: Not valid for data transmission.
DMA address bits 7-6.
Endpoint numb er
Byte count
(read-only).
(read only).
DA7DA6EP1EP0CNT3 CNT2 CNT1 CNT0
Figure 51. DMA buffers
DA15-6,000000
101111
Endpoint 2 TX
101000
100111
Endpoint 2 RX
100000
011111
Endpoint 1 TX
011000
010111
Endpoint 1 RX
010000
001111
Endpoint 0 TX
001000
000111
Endpoint 0 RX
000000
80/144
Page 81
ST72774/ST727754/ST72734
USB INTERFACE (Cont’d)
PID REGISTER (PIDR)
Read only
Reset Value: xx00 0000 (x0h)
70
TP3TP2000000
Bit 5 = CTR
hardware when a correct transfer operation is
performed. The type of transfer can be determined
by looking at bits TP3-T P2 in register PIDR. The
Endpoint on which the transfer was made is
identified by bits EP1-EP0 in register IDR.
0: No Correct Transfer detected
1: Correct Transfer detected
Correct Transfer.
This bit is set by
Bits 7:6 =TP3-TP2
USB token PIDs are encoded in four bits. TP3 - TP 2
correspond to the variable token PID bits 3 & 2.
Note: PID bits 1 & 0 have a fixed value of 01.
When a CTR inte rrupt occurs (see registe r ISTR)
the software sho uld read the TP3 and TP 2 bits to
retrieve the PID name of the token received.
The USB standard defines TP bits as:
Token PID bits 3 & 2
.
Note:A transfer where the device sen t a NAK or STALL
handshake is considered not correct (the host only
sends ACK handshak es). A tran sfer is con sidered
correct if there are no erro rs in the PID and CRC
fields, if the DATA0 /DATA1 PID is se nt as expected, if there were n o data overruns, bit stuffing or
framing errors.
Bit 4 = ERR
Error.
This bit is set by hardware whenever one of the
TP3TP2PID Name
00OUT
10IN
11SETUP
Bit 5:0 Reserved. Forced by hardware to 0.
errors listed below has occurred:
0: No error detected
1: Timeout, CRC, bit stuffing or nonstandard
framing error detected
Bit 3 = IOVR
Interrupt overrun.
This bit is set when hardware tries to set ERR,
ESUSP or SOF before they have been cleared by
INTERRUPT STATUS REGISTER (ISTR)
Read / Write
Reset Value: 0000 0000 (00h)
70
software.
0: No overrun detected
1: Overrun detected
Bit 2 = ESUSP
End suspend mode
This bit is set by hardware when, during suspend
0DOVR CTR ERR IOVR ESUSP RESET SOF
mode, activity is detected that wakes the USB
interface up from suspend mode.
When an interrupt occurs these bits are set by
hardware. Software must read them to determine
the interrupt type and clear them after servicing.
Note: These bits cannot be set by software.
Bit 7 = Reserved. Forced by hardware to 0.
This interrupt is serviced by a specific vector.
0: No End Suspend detected
1: End Suspend detected
Bit 1 = RESET
USB reset.
This bit is set by hardware when the USB reset
sequence is detected on the bus.
Bit 6 = DOVR
DMA over/underrun
This bit is set by hardware if the ST7 processor
can’t answer a DMA request in time.
0: No over/underrun detected
1: Over/underrun detected
.
0: No USB reset signal detected
1: USB reset signal detected
Note: The DADDR, EP0RA, EP0RB, EP1RA, EP1RB,
EP2RA and EP2 RB registers are reset by a USB
reset.
.
81/144
Page 82
ST72774/ST727754/ST72734
USB INTERFACE (Cont’d)Bit 0 = SOF
Start of frame.
This bit is set by hardware when a low-speed SOF
Software should clear this bit after the appropriate
delay.
indication (keep-alive strobe) is seen o n the USB
bus.
0: No SOF signal detected
1: SOF signal detected
Bit 2 = PDWN
Power down
.
This bit is set by software to turn off the 3.3V onchip voltage regulator that supplies the external
pull-up resistor and the transceiver.
Note: To avoid spurious clearing of some bits, it is recom-
mended to clear them using a load instruction
where all bits which must not be altered are set, and
all bits to be cleared are res et. Avoid read-m odifywrite instructions like AND , XOR..
INTERRUPT MASK REGISTER (IMR)
Read / Write
Reset Value: 0000 0000 (00h)
70
DOVRMCTRMERRMIOVRMESU
0
SPM
RES
ETM
SOF
M
0: Voltage regulator on
1: Voltage regulator off
Note: After turning on the voltage regulator, software
should allow at least 3 µs for s tabilisation of the
power supply before using the USB interface.
Bit 1 = SUSP
Suspend mode
.
This bit is set by software to enter Suspend mode.
0: Suspend mode inactive
1: Suspend mode active
When the hardware detec ts USB a ctivity, it res ets
this bit (it can also be reset by sof tw are).
Bit 0 = FRES
Force reset.
This bit is set by software to force a reset of the
Bit 7 = Reserved. Forced by hardware to 0.
USB interface, just as if a RESET sequence came
from the USB.
Bits 6:0 = These bits are mask bits for a ll interrupt
condition bits included in the ISTR. Whenever one
of the IMR bits is set, if the corresponding ISTR bit
is set, and the I bit in the CC register is cleared, an
interrupt request is generated. For an explanation
of each bit, please refer to the corresponding bit
description in ISTR.
CONTROL REGISTER (CTLR)
Read / Write
0: Reset not forced
1: USB interface reset forced.
The USB is held in RESET state until software
clears this bit, at which point a “USB-RESET”
interrupt will be generated if enabled.
DEVICE ADDRESS REGISTER (DADDR)
Read / Write
Reset Value: 0000 0000 (00h)
Reset Value: 0000 0110 (06h)
70
70
0ADD6 ADD5 ADD4 ADD3 ADD2 ADD1 ADD0
0000RESUMEPDWNSUSPFRES
Bits 7:4 = Reserved. Forced by hardware to 0.
Bit 3 = RESUME
Resume
.
This bit is set by software to wake-up the Host
when the ST7 is in suspend mode.
0: Resume signal not forced
1: Resume signal forced on the USB bus.
82/144
Bit 7 = Reserved. Forced by hardware to 0.
Bits 6:0 = ADD[6:0]
Device address, 7 bits.
Software must write into this regist er the address
sent by the host during enumeration.
Note: T his register is als o reset when a US B reset is re-
ceived from the USB bus or forced through bit
FRES in the CTLR register.
Page 83
USB INTERFACE (Cont’d)
ENDPOINT n REGISTER A (EPnRA)
Read / Write
Reset Value: 0000 xxxx (0xh)
ST72774/ST727754/ST72734
Bits 5:4 = STAT_TX[1:0]
transmissi on tran sfers.
These bits contain the information about the
endpoint status, which are listed below:
Status bits, for
70
ST_
DTOG
OUT
_TX
STAT
_TX1
STAT
TBC3TBC2TBC1TBC
_TX0
0
These registers (EP0RA, EP1RA and EP2RA) are
used for controlling data transmission. They are
also reset by the USB bus reset.
Note: Endpoint 2 and the EP2 RA r egiste r are not a vaila -
ble on some dev ices (see device feature list and
register map).
Bit 7 = ST_OUT
Status out.
This bit is set by software to indicate that a status
STAT_TX1 STA T_TX0 Meanin g
DISABLED: transmission
00
01
10
11
transfers cannot be executed.
STALL: the endpoint is
stalled and all transmission
requests result in a STALL
handshake.
NAK: the endpoint is naked
and all transmission requests result in a NAK handshake.
VALID: this endpoint is enabled for transmission.
out packet is expec ted: i n this case, all nonzero
OUT data transfers on the endpoint are STALLe d
instead of being ACKed. When ST _OUT is reset,
OUT transactions can have any number of bytes,
as needed.
These bits are written by software. Hardware sets
the STAT_TX bits to NAK when a correct transfer
has occurred (CTR=1) related to a IN or SETUP
transaction addressed to this endpoint; this allows
the software to prepare the next set of data to be
Bit 6 = DTOG_TX
transfers.
It contains the required value of the toggle bit
(0=DATA0, 1=DATA1) for the next transmitted
data packet. This bit is set by hardware at the
reception of a SETUP PID. DTOG_TX toggles only
when the transmitter has received the ACK signal
from the USB host. DTOG_TX and also
Data Toggle, for transmission
transmitted.
Bits 3:0 = TBC[3:0]
Endpoint n.
Transmit byte count for
Before transmission, after filling the transmit
buffer, software must write in the TBC field the
transmit packet size expressed in bytes (in the
range 0-8).
DTOG_RX (see EPnRB) are normally updated by
hardware, at the receipt of a relevant PID. They
can be also written by software.
83/144
Page 84
ST72774/ST727754/ST72734
USB INTERFACE (Cont’d)
ENDPOINT n REGISTER B (EPnRB)
Read / Write
Reset Value: 0000 xxxx (0xh)
70
CTRL
DTOG
_RX
STAT
_RX1
STAT
EA3 EA2 EA1 EA0
_RX0
These registers (EP1RB and EP2RB) are used for
controlling data reception on Endpoints 1 and 2.
They are also reset by the USB bus reset.
Note: Endpoint 2 and the EP2 RB r egiste r are not a vaila -
ble on some dev ices (see device feature list and
register map).
Bit 7 = CTRL
Control.
This bit should be 0.
Note: If this bit is 1, the Endpoint is a c ontrol endpoint.
(Endpoint 0 is alway s a control Endpoint, but it is
possible to have more than one control Endpoint).
Bit 6 = DTOG_RX
transfers
.
Data toggle, for reception
STAT_RX1 STAT_RX0 Meaning
DISABLED: reception
00
transfers cannot be
executed.
STALL: the endpoint is
01
stalled and all reception
requests result in a STALL
handshake.
NAK: the endpoint is na-
10
ked and all reception requests result in a NAK
handshake.
11
VALID: this endpoint is
enabled for reception.
These bits are written by software. Hardware sets
the STAT_RX bits to NAK wh en a c orrect transfer
has occurred (CTR=1) related to an OUT or
SETUP transaction addressed to this endpoint, so
the software has the time to elaborate the received
data before acknowledging a new transaction.
It contains the expected value of the toggle bit
(0=DATA0, 1=DATA1) for the next data packet.
This bit is cleared by hardware in the first stage
(Setup Stage) of a control transfer (SETUP
transactions start always with DATA0 PID). The
receiver toggles DTOG_RX only if it receives a
correct data packet and the packet’s data PID
matches the receiver sequence bit.
Bits 3:0 = EA[3:0]
Software must write in this field the 4 -bit address
used to identify the transactions directed to this
endpoint. Usually EP1RB contains “0001” and
EP2RB contains “0010”.
ENDPOINT 0 REGISTER B (EP0RB)
Read / Write
Endpoint address
.
Bit 5:4 = STAT _ RX [1:0 ]
Status bits, for reception
transfers.
These bits contain the information about the
endpoint status, which are listed in the following
table:
84/144
Reset Value: 1000 0000 (80h)
70
DTOGRXSTAT
1
RX1
STAT
RX0
0000
This register is used for controlling data reception
on Endpoint 0. It is also reset by the USB bus
reset.
Bit 7 = Forced by hardware to 1.
Bit 6:4 = Refer to the EPnRB register for a
description of these bits.
Bit 3:0 = Forced by hardware to 0.
Page 85
USB INTERFACE (Cont’d)
4.6.5 Programming Considerations
In the following, the interaction between the USB
interface and the application program is described.
Apart from system reset , ac tion is al way s in itiated
by the USB interface, driven by on e of the USB
events associated with the Interrupt Status
Register (ISTR) bits.
4.6.5.1 Initializing the Registers
At system reset, the software must initialize all
registers to enable the USB interface to properly
generate interrupts and DMA requests.
1. Initialize the DMAR, IDR, and IMR registers
(choice of enabled interrupts, address of DMA
buffers). Refer the paragraph titled initializing
the DMA Buffers.
2. Initialize the EP0RA and EP0RB registers to
enable accesses to address 0 and endp oint 0
to support USB enumeration. Refer to the paragraph titled Endpoint Initialization.
3. When addresses are received through this
channel, update the content of the DADDR.
4. If needed, write the endpoint numbers in the EA
fields in the EP1RB and EP2RB register.
4.6.5.2 Initializing DMA buffers
The DMA buffers are a contiguous zone of
memory whose maximum size is 48 bytes. They
can be placed anywhere in the memory space,
typically in RAM, to enable the reception of
messages. The 10 most significant bits of the start
of this memory area are specified by bits DA15DA6 in registers DMAR and IDR, the remaining
bits are 0. The memory map is shown in Figure 51.
Each buffer is filled starting from the bottom (last 3
address bits=000) up.
4.6.5.3 Endpoint Initialization
To be ready to receive:
Set STAT_RX to VALID (11b) in EP0RB to enable
reception.
To be ready to transmit:
1. Write the data in the DMA transmit buffer.
2. In register EPnRA, spec ify t he nu mbe r of byt es
to be transmitted in the TBC field
ST72774/ST727754/ST72734
3. Enable the endpoint by setting the STAT_TX
bits to VALID (11b) in EPnRA.
Note: Once transmission and/or reception are enabled,
registers EPnRA and/or EPnRB (respectively) must
not be modified by so ftware, as the hardware can
change their value on the fly.
When the operation is completed, they can be
accessed again to enable a new operation.
4.6.5.4 Interrupt Handling
Start of Frame (SOF)
The interrupt service routine must monitor the SOF
events and measure the interval between each
SOF event. If 3ms p ass without a S OF event, the
software should set the USB interface to suspend
mode.
USB Reset (RESET)
When this event occurs, the DADDR register is
reset, and communication is disabled in all
endpoint registers (the USB interface will not
respond to any packet). Software is responsible for
reenabling endpoint 0 within 10 ms of the end of
reset. To do this you set the STAT_ RX bits in the
EP0RB register to VALID.
End Suspend (ESUSP)
The CPU is alerted by ac tivity on the US B, which
causes an ESUSP interrupt.
Correct Transfer (CTR)
1. When this event occurs, the hardware automatically sets the STAT _ TX or STAT_ RX to NAK.
Note: Every valid endpoint is NAKed until software clears
the CTR bit in the ISTR re gister, in dependen tly of
the endpoint number addressed by the transfer
which generated the CTR interrup t.
Note: If the event triggering the CTR interrupt is a SETUP
transaction, both STAT_T X and STAT_ RX are set
to NAK.
2. Read the PIDR to obtain the token and t he I DR
to get the endpo int number related to the last
transfer.
Note: W hen a CTR interru pt occurs, the TP 3-TP2 bits in
the PIDR register and EP1-EP0 bits in the IDR register stay unch anged unti l the CTR bit in the ISTR
register is cleared.
3. Clear the CTR bit in the ISTR reg ister.
85/144
Page 86
ST72774/ST727754/ST72734
USB INTERFACE (Cont’d)
Table 23. USB Register Map and Reset Values
Address
(Hex.)
25
26
27
28
29
2A
2B
2C
2D
2E
2F
30
31
Register
Name
PIDR
Reset Value
DMAR
Reset Value
IDR
Reset Value
ISTR
Reset Value
IMR
Reset Value
CTLR
Reset Value
DADDR
Reset Value
EP0RA
Reset Value
EP0RB
Reset Value
EP1RA
Reset Value
EP1RB
Reset Value
EP2RA
Reset Value
EP2RB
Reset Value
76 5 43210
TP3
x
DA15
x
DA7
x
SUSP
0
SUSPM0DOVRM
0
0
0
0
ST_OUT0DTOG_TX0STAT_TX10STAT_TX00TBC3
1
1
ST_OUT0DTOG_TX0STAT_TX10STAT_TX00TBC3
CTRL0DTOG_RX0STAT_RX10STAT_RX00EA3
ST_OUT0DTOG_TX0STAT_TX10STAT_TX00TBC3
CTRL0DTOG_RX0STAT_RX10STAT_RX00EA3
TP2
x
DA14
x
DA6
x
DOVR
0
0
0
0
ADD6
0
DTOG_RX0STAT_RX10STAT_RX0
0
0
DA13
x
EP1
x
CTR
0
CTRM
0
0
0
ADD5
0
0
0
DA12
x
EP0
x
ERR
0
ERRM
0
0
0
ADD4
0
0
RX_SEZ0RXD
0
DA11
x
CNT3
0
IOVR0ESUSP0RESET0SOF
IOVRM0ESUSPM0RESETM0SOFM
RESUME0PDWN1FSUSP1FRES
ADD3
0
x
0
0
x
x
x
x
DA10
x
CNT2
0
ADD2
0
TBC2
x
0
0
TBC2
x
EA2
x
TBC2
x
EA2
x
0
0
DA9
x
CNT10CNT0
ADD10ADD0
TBC1xTBC0
0
0
TBC1xTBC0
EA1
x
TBC1xTBC0
EA1
x
0
0
DA8
x
0
0
0
0
0
x
0
0
x
EA0
x
x
EA0
x
86/144
Page 87
4.7 I²C SINGLE MASTER BUS INTERFACE (I2C)
ST72774/ST727754/ST72734
4.7.1 Introd uct i on
2
The I
between the microcontroller and the serial I
C Bus Interface serves as an interface
2
C bus.
It provides single master functions, and controls all
2
I
C bus-specific sequencing, protocol and timing.
It supports fast I²C mode (400kHz).
4.7.2 Main Features
– Parallel bus/I
2
C protocol converter
– Interrupt generation
– Standard I
2
C mode/Fast I2C mode
– 7- bit Addressing
2
■ I
C single Master Mode
– End of byte transmission flag
– Transmitter/Receiver flag
– Clock generation
4.7.3 General Description
In addition to receiving and transmitting data, this
interface converts it from serial to parallel format
and vice versa, using either an interrupt or polled
handshake. The interrupts are enabled or disabled
by software. The interface is c on nec ted t o the I
2
bus by a data pin (SDAI) and by a clock pin (SCLI).
It can be conne cted both with a s tandard I
and a Fast I
2
C bus. This selection is made by
2
C bus
software.
Mode Selection
The interface can operate in the two following
modes:
– Master transmitter/receiver
By default, it is idle.
The interface automatically switches from idle to
master after it generates a START condition and
from master to idle after it generates a STOP
condition.
Communication Flow
The interface initiates a data transfer and
generates the clock signal. A serial data tran sfer
always begins with a start condition and e nds with
a stop condition. Both start and stop conditions are
generated by software.
Data and addresses are transferred as 8-bit bytes,
MSB first. The first byte following the start
condition is the address byte.
A 9th clock pulse follows the 8 clock cycles of a
byte transfer, during which the receiver must send
C
an acknowledge bit to the transmitter. Refer to
Figure 52.
Figure 52. I
2
C BUS Protocol
SDA
SCL
START
CONDITION
MSB
ACK
1289
STOP
CONDITION
VR02119B
87/144
Page 88
ST72774/ST727754/ST72734
I²C SINGLE MASTER BUS INTERFACE (Cont’d)
Acknowledge may be enabled and disabled by
software.
The speed of the I
between Standard (0-100KHz) and Fast I
400KHz).
SDA/SCL Line Control
Transmitter mode: the interface holds the clock
line low before transmission to wait for the
microcontroller to write the byte in the Data
Register.
Receiver mode: the interface holds the clock line
low after reception to wait for the microcontroller to
read the byte in the Data Register.
2
C interface may be selected
2
C (100-
The SCL frequency (F
) is controlled by a
scl
programmable clock divider which depends on the
2
I
C bus mode.
When the I2C cell is enabled, the SDA and SCL
ports must be configured as floating open-drain
output or floating input . In this case, the val ue of
the external pull-up resistance used depe nds on
the application.
When the I2C cell is disabled, the SDA and SCL
ports revert to being standard I /O port pins.
Figure 53. I
SDA
SCL
2
C Interface Block Diagram
SDAI
SCLI
DATA CO NTROL
CLOCK CONT ROL
CLOCK CONTROL REGISTER (CCR)
CONTROL REGISTER (CR)
DATA REGISTER (DR)
DATA SHIFT REG ISTER
88/144
STATUS REGISTER 1 (SR1)
STATUS REGISTER 2 (SR2)
CONTROL LOGIC
INTERRUPT
Page 89
I²C SINGLE MASTER BUS INTERFACE (Cont’d)
4.7.4 Functional Description (Master Mode)
Refer to the CR, SR1 and SR2 registers in Secti on
4.7.5. for the bit definitions.
By default the I
2
C interface operates in idle mode
(M/IDL bit is cleared) except when it initiates a
transmit or receive sequence.
To switch from default idle mode to Master mode a
Start condition generation is needed.
Start condition and Transmit Slave address
Setting the START bit causes the interface to
switch to Master mode (M/IDL bit set) and
generates a Start condition.
Once the Start condition is sent:
ST72774/ST727754/ST72734
– Acknowledge pulse if if the ACK bit is set
– EVF and BTF bits are set by hardware with an in-
terrupt if the ITE bit is set.
Then the interface waits for a read of the SR1
register followed by a read of the DR register,
holding the SCL line low (see Figure 54 Transfer
sequencing EV3).
To close the communication: before reading the
last byte from the DR register, set the STOP bit to
generate the Stop condition. The interface goes
automatically back to idle mode (M/IDL bit
cleared).
Note: In order to generate the non-acknowledge pulse af-
ter the last received data byte, the ACK bit must be
cleared just before reading the second last data
byte.
– The EVF and SB bits are set by hardware with
an interrupt if the ITE bit is set.
Then the master waits for a read of the SR1
register followed by a write in the DR register with
the Slave address byte, holding the SCL line low
(see Figure 54 Transf er sequenc ing EV1 ).
Then the slave address byte is sent to the SDA line
via the internal shift register.
After completion of this transfer (and acknowledge
from the slave if the ACK bit is set):
– The EVF bit is set by hardware with interrupt
generation if the ITE bit is set.
Then the master waits for a read of the SR1
register followed by a write in t he CR regist er (for
example set PE bit), holding the SCL line low
(see Figure 54 Transfer sequencing EV2).
Next the master must enter Receiver or
Transmitter mode.
Master Receiver
Following the address transmission and after SR1
and CR registers have been accessed, the master
receives bytes from the SDA line into the DR
register via the internal shift register. After each
byte the interface generates in sequence:
Master Transmitter
Following the address transmission and after SR1
register has been read, the master sends bytes
from the DR register to the SDA line via the internal
shift register.
The master waits for a read of the SR1 register
followed by a write in the DR register, holding theSCL line low (see Figure 54 Transfer sequencing
EV4).
When the acknowledge bit is received, the
interface sets:
– EVF and BTF bits with an interrupt if the ITE bit
is set.
To close the communication: after writing the last
byte to the DR register, set the STOP bit to
generate the Stop condition. The interface goes
automatically back to idle mode (M/IDL bit
cleared).
Error Case
– AF: Detection of a non-acknowledge bit. In this
case, the EVF and AF bits are set by hardware
with a n in terrup t i f th e ITE bit is set. To resum e ,
set the START or STOP bit.
Note: The SCL line is not held low.
89/144
Page 90
ST72774/ST727754/ST72734
I²C SINGLE MASTER BUS INTERFACE (Cont’d)
Figure 54. Transfer Sequencing
Master receiver:
SAddressAData1AData2A
EV1EV2EV3EV3EV3
DataNNAP
.....
Master transmitter:
SAddressAData1AData2A
EV1EV2 EV4EV4EV4EV4
DataNAP
.....
Legend:
S=Start, P=Stop, A=Acknowledge, NA=Non-acknowledge
EVx=Event (with interrupt if ITE=1)
EV1: EVF=1, SB=1, cleared by reading SR1 register followed by writing DR register.
EV2: EVF=1, cleared by reading SR1 register followed by writing CR register (for example PE=1).
EV3: EVF=1, BTF=1, cleared by reading SR1 register followed by reading DR register.
EV4: EVF=1, BTF=1, cleared by reading SR1 register followed by writing DR register.
Figure 55. Event Flags and Interrupt Generation
ITE
BTF
SB
AF
*
*
EVF can also be set by EV2 or an error from the SR2 register.
*
90/144
INTERRUPT
EVF
Page 91
I²C SINGLE MASTER BUS INTERFACE (Cont’d)
4.7.5 Register Description
2
C CONTROL REGISTER (CR)
I
Read / Write
Reset Value: 0000 0000 (00h)
ST72774/ST727754/ST72734
Bit 2 = ACK
This bit is set and cleared by software. It is also
cleared by hardware when the interface is disabled
(PE=0).
Acknowledge enable.
70
00PE0START ACKSTOPITE
Bit 7:6 = Reserved. Forced to 0 by hardware.
0: No acknowledge returned
1: Acknowledge returned after a data byte is re-
ceived
Bit 1 = STOP
Generation of a Stop condition
This bit is set and cleared by software. It is also
cleared by hardware when the interface is disabled
Bit 5 = PE
Peripheral enable.
This bit is set and cleared by software.
0: Peripheral disabled
1: Master capability
(PE=0) or when the Stop condition is sent.
In Master mode only:
0: No stop generation
1: Stop generation after the current byte transfer
or after the current Start condition is sent.
Note: When PE=0, all the bits of the C R regi ster a nd the
SR register except the Stop bit are reset. All outputs
are released while PE=0
Note: When PE=1, the corresponding I/O pins are select-
ed by hardware as alternate functions.
2
Note: To enable the I
TWICE with PE=1 as the firs t write only activates
the interface (only PE is set).
C interface, wr ite the CR register
Bit 4 = Reserved. Forced to 0 by hardware.
Bit 0 = ITE
Interrupt enable.
This bit is set and cleared by software and cleared
by hardware when the interface is disabled
(PE=0).
0: Interrupts disabled
1: Interrupts enabled
Refer to Figure 55 for the relationship between the
events and the interrupt.
Bit 3 = START
Generation of a Start condition
This bit is set and cleared by software. It is also
.
SCL is held low when the SB or BTF flags or an
EV2 event (See Figure 54) is detected.
cleared by hardware when the interface is disabled
(PE=0) or when the Start condition is sent (with
interrupt generation if ITE=1).
.
In master mode:
0: No start generation
1: Repeated start generation
In idle mode:
0: No start generation
1: Start generation when the bus is free
91/144
Page 92
ST72774/ST727754/ST72734
I²C SINGLE MASTER BUS INTERFACE (Cont’d)
2
C STATUS REGISTER 1 (SR1)
I
Read Only
Reset Value: 0000 0000 (00h)
70
EVF0TRA0BTF0M/IDLSB
Bit 7 = EVF
Event flag.
This bit is set by hardware as soon as an event
occurs. It is cleared by software reading SR2
register in case of error event or as described in
Figure 54. It is also cleared by hardware when the
interface is disabled (PE=0).
0: No event
1: One of the following events has occurred:
– BTF=1 (Byte received or transmitted)
– SB=1 (Start condition generated)
– AF=1 (No acknowledge received after byte
transmission if ACK=1)
– Address byte successfully transmitted.
– Following a byte transmission, this bit is set after
reception of the acknowledge clock pulse. In
case an address byte is sent, this bit is set only
after the EV2 event (See Figure 54). BTF is
cleared by reading SR1 register followed by writing the next byte in DR register.
– Following a byte reception, this bit is set after
transmission of the acknowledge clock pulse if
ACK=1. BTF is cleared by reading SR1 register
followed by reading the byte from DR register.
The SCL line is held low while BTF=1.
0: Byte transfer not done
1: Byte transfer succeeded
Bit 2 = Reserved. Forced to 0 by hardware.
Bit 1 = M/IDL
Master/Idle.
This bit is set by hardware as soon as the interface
is in Master mode (writing START=1). It is cleared
by hardware after generating a Stop condition on
the bus. It is also cleared when the interface is
disabled (PE=0).
0: Idle mode
1: Master mode
Bit 6 = Reserved. Forced to 0 by hardware.
Bit 5 = TRA
Transmitter/Receiver.
When BTF is set, TRA=1 if a dat a byte has been
transmitted. It is cleared automatically when BTF
is cleared. It is also cleared by hardware when the
interface is disabled (PE=0).
0: Data byte received (if BTF=1)
1: Data byte transmitted
Bit 4 = Reserved. Forced to 0 by hardware.
Bit 3 = B TF
Byte transfer finished.
This bit is set by hardware as soon as a byte is
correctly received or transmitted with interrupt
generation if ITE=1. It is cleared by software
reading SR1 register followed by a read or write of
DR register. It is also cleared by hardware when
the interface is disabled (PE=0).
Bit 0 = SB
Start bit generated.
This bit is set by hardware as soon as the Start
condition is generated (following a write
START=1). An interrupt is generated if ITE=1. It is
cleared by software reading SR1 register followed
by writing the address byte in DR register.It is al so
cleared by hardware when the interface is disabled
(PE=0).
0: No Start condition
1: Start condition generated
92/144
Page 93
ST72774/ST727754/ST72734
I²C SINGLE MASTER BUS INTERFACE (Cont’d)
2
C STATUS REGISTER 2 (SR2)
I
Read Only
0: Standard I
1: Fast I
Reset Value: 0000 0000 (00h)
Bit 6:0 = CC6-CC0
70
000AF0000
These bits select the speed of the bus (F
depending on the I
when the interface is disabled (PE=0).
2
2
C mode
C mode
7-bit clock divider.
2
C mode. They are n ot cleared
)
SCL
– Stand ard mode (FM/SM =0 ): F
Bit 7:5 = Reserved. Forced to 0 by hardware.
Bit 4 = AF
Acknowledge failure
.
This bit is set by hardware when no acknowledg e
= F
F
SCL
– Fast mode (FM/ SM=1): F
F
= F
SCL
Note: T he programmed F
and SDA lines.
/(2x([CC6..CC0]+2))
CPU
/(3x([CC6..CC0]+2))
CPU
SCL
assumes no load on SCL
SCL
is returned. An interrupt is generated if ITE=1. It is
cleared by software reading SR2 register or by
hardware when the interface is disabled (PE=0).
The SCL line is not held low while AF=1.
0: No acknowledge failure
I2C DATA REGISTER (DR)
Read / Write
Reset Value: 0000 0000 (00h)
70
1: Acknowledge failure
Bit 3:0 = Reserved. Forced to 0 by hardware.
matically when the software writes in the DR register.
– Receiver mode: the first data byte is received au-
FM/SM CC6CC5CC4CC3CC2CC1CC0
tomatically in the DR register using the least significant bit of the address.
Then, the next data bytes are received one by
Bit 7 = FM/SM
Fast/Standard I2C mode.
one after reading the DR register.
This bit is set and cleared by software.It is not
cleared when the interface is disabled (PE=0).
<= 100kHz
SCL
> 100kHz
93/144
Page 94
ST72774/ST727754/ST72734
I2C SINGLE MASTER BUS INT ERFACE (Cont’d)
2
Table 24. I
C Register Map
Address
(Hex.)
5F
5E
5D
5C
59
Register
Name
CR
Reset Value00
SR1
Reset Value
SR2
Reset Value000
CCR
Reset Value
DR
Reset Value
76543210
PE
EVF
00
FM/SM
0
DR7
0
CC6
0
DR6
0
TRA
CC5
DR5
START
00
00
AF
00000
CC4
0
0
0
DR4
0
ACK
0
BTF
00
CC3
0
DR3
0
0
CC2
0
DR2
0
STOP
0
M/IDL
0
CC1
0
DR1
0
ITE
0
SB
0
CC0
0
DR0
0
94/144
Page 95
4.8 DDC INTERFACE (DDC)
4.8.1 Introd uct i on
The DDC (Display Data Channel) Bus Interface is
mainly used by the monitor to identify itself to the
video controller, by the monitor manufacturer to
perform factory alignment, and by the user to
adjust the monitor’s parameters.
The DDC interface consists of two parts:
■ A fully hardware-implemented interface,
supporting DDC1 and DDC2B (VESA
specification 3.0 compliant). It accesses the
ST7 on-chip memory di rectly through a built-in
DMA engine.
■ A second interface, supporting the slave I
2
functions for handling DDC/CI mode (DDC2Bi),
factory alignment or Enhanced DDC (EDDC) by
software.
4.8.2 DDC Interface Features
4.8.2.1 Hardware DDC1/2B Interface Features
■ Full hardware support for DDC1/2B
communications (VESA specification versions 2
and 3)
■ Hardware detection of DDC2B addresses A0h/
A1h and optionally A2h/ A3h (P&D) or A6h/A7h
(FPDI-2)
■ Separate mapping of EDID version 1 (128
bytes) and EDID version 2 (256 bytes) when
both must coexist
■ Support for error recovery mechanism
■ Detection of misplaced Start and Stop
conditions
ST72774/ST727754/ST72734
2
■ I
C byte, random and sequential read modes
■ DM A transfer from any m emory location and to
RAM
■ Automatic memory address incrementation
■ End of data downloading flag and interrupt
capability
4.8.2.2 DDC/CI - Factory Interface Features
General I
– Parallel bus/I
– Interrupt generation
C
– Standard I
– 7-bit Addressing
2
I
C Slave Features:
–I
– Start bit detection flag
– Detection of misplaced Start or Stop condition
– Transfer problem detection
– Address Matched detection
– Programmable Address detection and/or
– End of byte transmission flag
– Transmitter/Receiver flag
– Stop condition Detection
2
C Features:
2
C protocol converter
2
C mode/Fast I2C mode
2
C bus busy flag
Hardware detection of Enhanced DDC (EDDC) addresses (60h/61h)
The SDA bidirectional pi n is used t o transfer dat a
in and out of the device. It is an open-drai n out put
that may be or-wired with other open-drain or
open-collector pins. An external pull-up resistor
must be connected to the SDA line. Its value
depends on the load of the line and the transfer
rate.
Serial Clock (SCL)
ST72774/ST727754/ST72734
Transmit-only Clock (Vsync/Vsync2)
The Vsync input pins are used to synchronize all
data in and out of the device when in Transmit-only
mode.
These pins are ONLY used by the DDC1/2B
interface (when in DDC1 mode).
The SCL input pin is used to synchronize all data in
and out of the device when in I
2
C bidirectional
mode. An external pull-up resistor must be
connected to the SCL line. Its value depend s on
the load of the line and the transfer rate.
Note:When the DDC1/2B and DDC/CI-Factory Interfaces
are disabled (HW PE bit= 0 in the DC R regis ter and
PE bit=0 in the CR register), SDA and SCL pins revert to standard I/O pins.
97/144
Page 98
ST72774/ST727754/ST72734
DDC INTERFACE (Cont’d)
2
4.8.4 I
A standard I
on four parts: START condition, device slave
address transmission, data transfer and STOP
condition. They are described brielfly in the
following section and illustrated in F igure 58 (for
more details, refer to the I
4.8.4.1 START condition
When the bus is free (both SCL and SDA lines are
at a high level), a master can initiate a
communication by sendin g a START signal. This
signal is defined as a high-to-low transition of SDA
while SCL is stable high. The bus is considered to
be busy after a START condition.
This START condition must precede any
command for data transfer.
4.8.4.2 Slave Address Transmission
The first byte following a START condition is the
slave address transmitted by the master. This
address is 7-bit long f ollowed by an 8th bit (Least
significant bit: LSB) which is the data direction bit
(R/W
– A “0” indicates a transmission (WRITE) from the
– A “1” indicates a request for data (READ) from
If a slave device is present on the bus at the given
address, an Acknowledge will be generated on the
9th clock pulse.
C BUS Protocol
2
C communication i s normally base d
bit).
master to the slave.
the slave to the master.
2
C bus specification).
4.8.4.3 Data Transfer
Once the slave address is acknowledged, the data
transfer can proceed in the direction given by the
R/W
bit sent in the address.
Data is transferred with the most significant bit
(MSB) first. Data bits can be changed onl y when
SCL is low and must be held stable when SCL is
high.
One complete data byte transf er requires 9 clock
pulses: 8 bits + 1 acknowledge bit.
4.8.4.4 Acknowledge Bit (ACK / NACK)
Every byte put on the SDA line is 8-bit long
followed by an acknowledge bit.
This bit is used to indicate a successful data
transfer. The bus transmitter, either master or
slave, releases the SDA line during the 9th clock
period (after sending all 8 bits of data), then:
– To generate an Acknow ledge (ACK) of the cur-
rent byte, the receiver pulls the SDA line low.
– To generate a No-Acknowledge (NA CK) of the
current byte, the receiver releases the SDA line
(hence at a high level).
4.8.4.5 STOP Condition
A STOP condition is defined by a low-to-high
transition of SDA while SCL is s table hi gh. It ends
the communication between the Inte rface and the
bus master.
Figure 58. I
2
C Signal Diagram
SDA
SCL
SDA
SCL
98/144
StartAckA0h
Device Slave Address
StartAckA1h
Device Slave Address
00h
Data Address
WRITE DATA TO I2C DEVICE (Slave Address A0h)
Data1(00h) AckAckData2(B0h)DataN(F0h)
READ DATA FROM I2C DEVICE (Slave Address A1h)
AckAckData1(B0h)
DataN(F0h)
Ack
Nack
STOP
STOP
Page 99
ST72774/ST727754/ST72734
DDC INTERFACE (Cont’d)
4.8.5 DDC Standard
The DDC standard is divided in several data
transfer protocols: DDC1, DDC2B, DDC/CI.
For DDC1/2B, refer to the “VESA DDC Standard
v3.0” specification. For DDC/CI refer to the “VESA
DDC Commands Interface v1.0”
– DDC1 is a uni-directional transmission of EDID
v1 (128 bytes) from display to host clocked by
VSYNCI.
– DDC2B is a uni-directional channel from display
to host. The host computer uses base-level I
2
C
commands to read the EDID data from the display which is always in slave mode.
Specific types of display contain EDID at fixed
2
I
C device addresses within the device (refer to
Table 25).
– DDC/CI is a bi-directional channel between the
host computer and the display. The DDC/C I offers a display control interface based on I
2
C bus.
It includes the DDC2Bi and DDC2AB standards.
Note: The DDC2AB standard is no longer handled by the
interface.
4.8.5.1 DDC1/2B Interface
4.8.5.1.1 Functionnal descri ption
Refer to the DCR, AHR registers in Sec tion 4.8.6.
for the bit definitions.
The DDC1/2B Interface acts as an I/O interface
between a DDC bus and the microcontroller
memory. In addition to receiving and t ransmitting
serial data, this interface directly trans fers parallel
data to and from memory using a DMA engine,
only halting CPU activity for two clock cycles
during each byte transfer.
The interface supports by hardware:
– Two DDC communication protocols called DDC1
and DDC2B.
Table 25. Valid Device Addresses an d EDID structure
Device AddressCF2 bitCF1 bitCF0 bitTransfer Type
EDID v1:
A0h / A1h = 1010 000x
EDID v2:
A2h / A3h = 1010 001x
EDID v2:
A6h / A7h = 1010 011x
reserved1x1reserved
xx0128-byte EDID structure write/read
001
110
111256-byte EDID structure write/read
– Write operations into RAM.
– Read operations from RAM.
In DDC1, the interface reads sequential EDID v1
data bytes from the microcontroller memory, and
transmits them on SDA synchronized with Vsync.
In DDC2B mode, it operates in I
The DDC1/2B Interface supports several DDC
versions configured using the CF[2:0] bits in the
DCR register which can only be changed while the
interface is disabled (HWPE bit=0 in the DCR
register). They define which EDID structure
version is used and which Device Addresses are
recognized.
Depending on the DDC version, one or two device
address pairs will be recognized and the
corresponding EDID structure will be validated
(refer to Table 25):
– DDC v2 (CF2=0,CF1=0,CF 0=0): DDC1 is ena-
bled and device addresses A0h/A1h are recognized. EDID v1 is used.
– DDC v2 (CF2=1,CF1=0,CF0=0): DDC1 is disa-
bled and device addresses A0h/A1h are recognized. EDID v1 is used.
– Plug and Display (CF2=0,CF1=0,CF0=1):
DDC1 is disabled and device addresses A2h/
A3h are recognized. EDID v2 is used.
– Plug and Display + DDC v2 (CF2=0,CF1=1,
CF0=0): DDC1 is enabled and device addresses
A0h/A1h and A2h/A3h are recognized. Both
EDID structures v1 and v2 are used.
– Plug and Display + DDC v2 (CF2=1,CF1=1,
CF0=0): DDC1 is disabled and device addresses
A0h/A1h and A2h/A3h are recognized. Both
EDID structures v1 and v2 are used.
– FPDI (CF2=0,CF1=1, CF0=1): DDC1 is disabled
and device addresses A6h/A7h are recognized.
EDID v2 is used.
256-byte EDID structure write/read010
2
C slave mode.
99/144
Page 100
ST72774/ST727754/ST72734
DDC INTERFACE (Cont’d)
The Write and Read operations allow the EDID
data to be downloaded during factory alignment
(for example).
Writes to the memory by the DMA engine can b e
inhibited by means of the WP bit in the DCR
register.
A write of the last data structure byte sets a flag
and may be programmed to generat e an interrupt
request.
The Data address (sub-address) is either the
second byte of write transfers or is pointed to by
the internal address counter automatically
incremented after each byte transfer.
Physical address mapping of the data structure
within the memory space is performed with a
dedicated register accessible by software.
4.8.5.1.2 Mode desc riptio n
DDC1 Mode: This mode is only enabled when the
DDC v2 or P&D-DDC v2 standards are validated. It
transmits only the EDID v1 data (128 bytes).
To switch the DDC1/2B Interface to DDC1 mode,
softw are must f irst clear the C F0 bit in th e DCR
register while the HWPE bit=0 and then set the
HWPE bit to enable the DDC1/2B Interface.
A proper initialization sequence (see Figure 59)
must supply nine clock pulses on the VSYNCI pin
in order to internally synchronize the device.
During this initialization sequence, the SDA pin is
in high impedance. On the rising edge of the 10th
pulse applied on VSYNCI, the device outputs on
SDA the most significant (MSB) bit of the byte
located at data address 00h.
A byte is clocked out by m eans of 9 clock pulses
on Vsync, 8 clock pulses for the data byte itself and
an extra pulse for a Don’t Care bit.
As long as SCL is not held low, eac h byte of the
memory array is transmitted serially on SDA.
The internal address counter is incremented
automatically until the last byte is transmitted.
Then, it rolls over to relative location 00h.
The physical mapping of the data structure
depends on the configuration and on the content of
the AHR register which can be set by software
(see Figure 60).
Figure 59. DDC1 Waveforms
PE
SCL
ALR
SDA
Vsync
PE
SCL
ALR
SDA
Vsync
12 89
Bit 7Bit 6Bit 0
00hXX
Bit 7
1011
00h7Fh
Bit 7
Bit 6
Bit 6
100/144
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.