W7500 Datasheet Manual
Version 1.0.1
http://www.wiznet.co.kr
© Copyright 2015 WIZnet Co., Ltd. All rights reserved.
Table of Contents
1 Documentation conventions ........................................................................ 11
List of abbreviations ....................................................................... 11
Glossary ...................................................................................... 11
Register Bit Conventions .................................................................. 13
2 System and memory overview ..................................................................... 14
2.1
System architecture ....................................................................... 14
2.2
Memory organization ...................................................................... 15
Introduction ......................................................................... 15
Memory map ......................................................................... 16
3 System configuration controller (SYSCFG) ....................................................... 17
3.1
Introduction ................................................................................. 17
4 Interrupt and events ................................................................................. 17
4.1
Introduction ................................................................................. 17
4.2
Interrupt assignments ..................................................................... 17
4.3
Event ......................................................................................... 18
5 Power supply ........................................................................................... 18
5.1
Introduction ................................................................................. 18
5.2
Voltage regulator ........................................................................... 18
5.3
Power supply supervisor .................................................................. 19
5.4
Low-power modes .......................................................................... 19
Sleep mode .......................................................................... 19
Peripheral clock gating ............................................................ 20
6 System tick timer ..................................................................................... 20
6.1
Introduction ................................................................................. 20
6.2
Features ..................................................................................... 20
6.3
Functional description .................................................................... 20
7 TCPIPCore Offload Engine (TOE) ................................................................... 21
Introduction ................................................................................. 21
Features ..................................................................................... 21
Functional description .................................................................... 22
TOE Memory map ........................................................................... 22
Common register map ............................................................. 24
Socket register map ................................................................ 24
Memory ............................................................................... 25
8 Booting Sequence ..................................................................................... 26
9 Embedded Flash memory ............................................................................ 28
Flash main features ........................................................................ 28
W7500 Datasheet Version1.0.1
2 / 116
Flash memory functional description ................................................... 28
Flash memory organization ....................................................... 28
Read operations ..................................................................... 30
Flash erase operations ............................................................. 31
Flash program operation .......................................................... 33
Memory protection ......................................................................... 34
Read protection ..................................................................... 34
Write protection .................................................................... 34
10 Clock Reset generator (CRG) ........................................................................ 35
10.1
Introduction ................................................................................. 35
10.2
Features ..................................................................................... 35
Reset .................................................................................. 35
Clock .................................................................................. 35
10.3
Functional description .................................................................... 36
External Oscillator Clock .......................................................... 36
RC oscillator clock .................................................................. 37
PLL .................................................................................... 37
Generated clock .................................................................... 37
11 Random number generator (RNG) ................................................................. 38
Introduction ................................................................................. 38
Features ..................................................................................... 38
Functional description .................................................................... 38
Operation RNG ...................................................................... 39
12 Alternate Function Controller (AFC) .............................................................. 40
Introduction ................................................................................. 40
Features ..................................................................................... 40
Functional description .................................................................... 40
13 External Interrupt (EXTI) ............................................................................ 42
Introduction ................................................................................. 42
Features ..................................................................................... 42
Functional description .................................................................... 42
14 Pad Controller (PADCON) ............................................................................ 44
Introduction ................................................................................. 44
Features ..................................................................................... 44
Functional description .................................................................... 44
15 General-purpose I/Os(GPIO) ......................................................................... 45
Introduction ................................................................................. 45
Features ..................................................................................... 45
Functional description .................................................................... 46
W7500 Datasheet Version1.0.1
3 / 116
Masked access ....................................................................... 47
16 Direct memory access controller (DMA) .......................................................... 49
Introduction ................................................................................. 49
Features ..................................................................................... 49
Functional description .................................................................... 49
DMA request mapping .............................................................. 50
DMA arbitration ..................................................................... 50
DMA cycle types ..................................................................... 50
17 Analog-to-digital converter (ADC) ................................................................. 54
Introduction ................................................................................. 54
Features ..................................................................................... 54
Functional description .................................................................... 55
Operation ADC with non-interrupt............................................... 55
Operation ADC with interrupt .................................................... 57
18 Pulse-Width Modulation (PWM) ..................................................................... 58
Introduction ................................................................................. 58
Features ..................................................................................... 58
Functional description .................................................................... 59
Timer/Counter control ............................................................ 59
Timer/Counter ...................................................................... 59
PWM mode ........................................................................... 63
Interrupt ............................................................................. 64
Dead zone generation ............................................................. 64
Capture event ....................................................................... 66
How to set the PWM ............................................................... 67
19 Dual timers ............................................................................................. 68
Introduction ................................................................................. 68
Features ..................................................................................... 68
Functional description .................................................................... 69
Clock and clock enable ............................................................ 69
Timer size ............................................................................ 69
Prescaler ............................................................................. 69
Repetition mode .................................................................... 69
Interrupt ............................................................................. 70
Operation ............................................................................ 70
How to set the dual timers ....................................................... 71
20 Watchdog timer ........................................................................................ 72
20.1
Introduction ................................................................................. 72
20.2
Features ..................................................................................... 72
W7500 Datasheet Version1.0.1
4 / 116
20.3
Functional description .................................................................... 72
Clock .................................................................................. 72
Interrupt and reset request ....................................................... 72
21 Inter-integrated circuit interface (I2C) ........................................................... 73
Introduction ................................................................................. 73
Features ..................................................................................... 73
Functional description .................................................................... 73
Data validity ......................................................................... 74
Acknowledge ........................................................................ 75
Bit Command Controller........................................................... 75
Slave address ........................................................................ 76
Read/Write bit ...................................................................... 77
Acknowledge(ACK) and Not Acknowledge(NACK) ............................. 77
Data transfer ........................................................................ 77
Operating Modes .................................................................... 77
Interrupts ............................................................................ 78
Master mode ......................................................................... 79
Slave mode .......................................................................... 82
22 UART(Universal Asynchronous Receive Transmit) .............................................. 83
Introduction ................................................................................. 83
Features ..................................................................................... 83
Functional description .................................................................... 83
Baud rate calculation .............................................................. 85
Data transmission................................................................... 86
Data receive ......................................................................... 86
Hardware flow control ............................................................. 87
23 Synchronous Serial Port (SSP) ...................................................................... 89
Introduction ................................................................................. 89
Features ..................................................................................... 89
Functional description .................................................................... 90
Clock prescaler ..................................................................... 90
Transmit FIFO ....................................................................... 90
Receive FIFO ......................................................................... 91
Interrupt generation logic ........................................................ 91
DMA interface ....................................................................... 91
Interface reset ...................................................................... 93
Configuring the SSP ................................................................ 93
Enable PrimeCell SSP operation .................................................. 94
Clock ratios .......................................................................... 94
W7500 Datasheet Version1.0.1
5 / 116
Programming the SSPCR0 Control Register ..................................... 95
Programming the SSPCR1 Control Register ..................................... 95
Frame format ....................................................................... 96
Texas Instruments synchronous serial frame format ......................... 97
Motorola SPI frame format ........................................................ 98
National Semiconductor Microwire frame format ........................... 104
Master and Slave configurations ................................................ 106
SSP Flow chart ..................................................................... 107
24 Electrical Characteristics .......................................................................... 109
Absolute maximum ratings .............................................................. 109
Voltage Characteristics ........................................................... 109
Current Characteristics ........................................................... 109
Thermal Characteristics .......................................................... 109
Operating conditions ..................................................................... 110
General Operating Conditions ................................................... 110
Supply Current Characteristics .................................................. 110
I/O PAD Characteristics .................................................................. 111
DC Specification ................................................................... 111
Flash memory .............................................................................. 111
Electrical Sensitivity Characteristics .................................................. 111
Electostatic discharge (ESD) ..................................................... 111
Static latch-up ..................................................................... 111
ADC Characteristics ....................................................................... 112
ADC Electrical characteristics ................................................... 112
ADC Transform function description ........................................... 113
I2C interface Characteristics ............................................................ 113
SSP Interface Characteristics ........................................................... 114
25 Package Characteristics ............................................................................ 115
Package dimension information ........................................................ 115
Package footprint information .......................................................... 115
Document History Information ....................................................................... 116
W7500 Datasheet Version1.0.1
6 / 116
List of table
Table 1 W7500 interrupt assignments ......................................................... 17
Table 2 W7500 sleep mode summary .......................................................... 20
Table 3. Offset Address for Common Register ............................................... 24
Table 4. Offset Address in Socket n Register Block (n = 0,…,7, where n is Socket
number) ....................................................................................... 25
Table 5 operation of mode selection .......................................................... 27
Table 6 description of Flash memory .......................................................... 28
Table 7 External oscillator clock sources ..................................................... 36
Table 8 functional description table .......................................................... 40
Table 9 Summary of the DMA requests for each channel .................................. 50
Table 10 DMA trigger points for the transmit and receive FIFOs. ........................ 92
Table 11 Voltage characteristics .............................................................. 109
Table 12 Current characteristics .............................................................. 109
Table 13 Thermal Charateristics .............................................................. 109
Table 14 General operating conditions ...................................................... 110
Table 15 Normal operation supply current .................................................. 110
Table 16 Sleep mode supply current ......................................................... 110
Table 17 Deep sleep mode supply current .................................................. 110
Table 18 DC specification of PAD .............................................................. 111
Table 19 Flash memory Reliability Characteristics ......................................... 111
Table 20 Electrostatic discharge (ESD) ....................................................... 111
Table 21 Static latch-up ........................................................................ 111
Table 22 ADC electrical characteristics ...................................................... 112
Table 23 I2C characteristics .................................................................... 113
Table 24 SSP characteristics ................................................................... 114
W7500 Datasheet Version1.0.1
7 / 116
List of figures
Figure 1 W7500 System Architecture .......................................................... 14
Figure 2 W7500 memory map ................................................................... 16
Figure 3 POR reset waveform................................................................... 19
Figure 4 TOE block diagram ..................................................................... 22
Figure 5. Register & Memory Organization ................................................... 23
Figure 6. operation of boot code .............................................................. 27
Figure 7. Flash reading sequence .............................................................. 31
Figure 8. Flash erase operations ............................................................... 32
Figure 9. main Flash memory programming sequence ..................................... 33
Figure 10 CRG block diagram ................................................................... 36
Figure 11. Random Number Generator block diagram ..................................... 38
Figure 12. Flow chart of RNG operation ...................................................... 39
Figure 13. External Interrupt diagram ........................................................ 43
Figure 14. function schematic of digital I/O pad ........................................... 44
Figure 15. function schematic of digital/analog mux IO pad ............................. 44
Figure 16. GPIO block diagram ................................................................. 46
Figure 17. GPIO Flow chart ..................................................................... 47
Figure 18. MASK LOWBYTE access ............................................................. 48
Figure 19. MASK HIGHBYTE access ............................................................. 48
Figure 20. DMA Block diagram .................................................................. 49
Figure 21. DMA ping pong cycle ................................................................ 53
Figure 22. ADC block diagram .................................................................. 55
Figure 23. The ADC operation flowchart with non-interrupt .............................. 56
Figure 24. The ADC operation flowchart with interrupt ................................... 57
Figure 25. PWM block diagram ................................................................. 58
Figure 26. Periodic mode ........................................................................ 59
Figure 27. one-shot mode ....................................................................... 60
Figure 28. Up-count mode ...................................................................... 60
Figure 29. Down-count mode ................................................................... 60
Figure 30 Counter mode with rising edge .................................................... 61
Figure 31 Counter mode with falling edge ................................................... 61
Figure 32 Counter mode with rising and falling edge ...................................... 61
Figure 33 Timer/Counter timing diagram with match interrupt ......................... 62
Figure 34 Timer/Counter timing diagram with overflow interrupt ...................... 62
Figure 35 The PWM output up to match register ............................................ 63
Figure 36 The PWM output up to limit register .............................................. 64
Figure 37 PWM waveform with dead zone time ............................................. 65
W7500 Datasheet Version1.0.1
8 / 116
Figure 38 PWM waveform with dead zone counter ......................................... 65
Figure 39 Capture event with no interrupt clear ........................................... 66
Figure 40 Capture event with interrupt clear ............................................... 66
Figure 41. The PWM setting flow .............................................................. 67
Figure 42 Block diagram of Dualtimer ........................................................ 68
Figure 43 The Dual timer setting flow ........................................................ 71
Figure 44. Watchdog timer operation flow diagram ........................................ 73
Figure 45. I2C Bus Configuration ............................................................... 74
Figure 46. I2C block diagram ................................................................... 74
Figure 47. Data Validity .......................................................................... 75
Figure 48. Bit Conditions ........................................................................ 75
Figure 49. START and STOP Conditions ........................................................ 76
Figure 50. RESTART Condition .................................................................. 76
Figure 51. 7-bit Slave address .................................................................. 76
Figure 52. Complete Data Transfer with a 7-bit slave address ........................... 77
Figure 53. I2C initial setting .................................................................... 79
Figure 54. Master TRANSMIT with ADDR10=0 in the I2Cx_CTR ............................ 80
Figure 55. Master Transmit with Repeated START ........................................... 81
Figure 56. Slave Command Sequence ......................................................... 82
Figure 57 UART0,1 Block diagram .............................................................. 84
Figure 58 UART character frame ............................................................... 84
Figure 59 UART divider flow chart ............................................................. 85
Figure 60 UART Initial setting flow chart ..................................................... 85
Figure 61 Transmit and Receive data flow chart ............................................ 86
Figure 62 Hardware flow control description ................................................ 87
Figure 63 CTS Functional Timing ............................................................... 87
Figure 64 Algorithm for setting CTS/RTS flowchart......................................... 88
Figure 65. SSP block diagram ................................................................... 90
Figure 66. DMA transfer waveforms ........................................................... 93
Figure 67. Texas Instruments synchronous serial frame format, single transfer ...... 97
Figure 68. Texas Instruments synchronous serial frame format, continuous transfers 98
Figure 69. Motorola SPI frame format, single transfer, with SPO=0 and SPH=0 ....... 99
Figure 70. Motorola SPI frame format, continuous transfers, with SPO=0 and SPH=0 99
Figure 71. Motorola SPI frame format, single and continuous transfers, with SPO=0
and SPH=1 ................................................................................... 100
Figure 72. Motorola SPI frame format, single transfer, with SPO=1 and SPH=0 ...... 101
Figure 73. Motorola SPI frame format, continuous transfers, with SPO=1 and SPH=0
................................................................................................ 102
W7500 Datasheet Version1.0.1
9 / 116
Figure 74. Motorola SPI frame format, single and continuous transfers, with SPO=1
and SPH=1 ................................................................................... 103
Figure 75. National Semiconductor Microwire frame format, single transfer ........ 104
Figure 76. National Semiconductor Microwire frame format, continuous transfers . 106
Figure 77. PrimeCell SSP master coupled to an SPI slave ................................. 106
Figure 78. SPI master coupled to a PrimeCell SSP slave .................................. 107
Figure 79. how to setting TI or Microwire mode flow chart .............................. 107
Figure 80. how to setting SPI mode flow chart ............................................. 108
Figure 81. ADC transform function ........................................................... 113
Figure 82. I2C bus AC waveform .............................................................. 114
Figure 83. Package Dimension Information ................................................. 115
Figure 84. Footprint information ............................................................. 115
W7500 Datasheet Version1.0.1
10 / 116
1
Documentation conventions
List of abbreviations
Glossary
ARP
Address Resolution Protocol
AHB
Advanced High-performance Bus
AMBA
Advanced Microcontroller Bus Architecture
APB
Advanced Peripheral Bus
AFC
Alternate Function Controller
ADC
Analog-to-Digital Converter
BOD
BrownOut Detection
CPU
Central Processing Unit
CRG
Clock Reset generator
DMA
Direct Memory Access
EOP
End Of Packet
EXTINT
External Interrupt
GPIO
General Purpose Input/Output
IrDA
Infrared Data Association
I/O
Input/Output
ICMP
Internet Control Message Protocol
IGMP
Internet Group Management Protocol
IPv4
Internet Protocol version 4
IRQ
interrupt request
NMI
NonMaskable Interrupt
PADCON
Pad Controller
PLL
Phase-Locked Loop
PHY
Physical Layer
PPPoE
Point-to-Point Protocol over Ethernet
POR
Power Of Reset
PWM
Pulse Width Modulator
RAM
Random Access Memory
W7500 Datasheet Version1.0.1
11 / 116
RNG
Random number generator
SR
Status Register
SSP
Synchronous Serial Port
SYSCFG
System configuration controller
TOE
TCPIPCore Offload Engine
TTL
Transistor-Transistor Logic
TCP
Transmission Control Protocol
UART
Universal Asynchronous Receiver/Transmitter
USB
Universal Serial Bus
UDP
User Datagram Protocol
WOL
Wake On Lan
WDT
Watchdog Timer
W7500 Datasheet Version1.0.1
12 / 116
Register Bit Conventions
Each register is shown with a key indicating the accessibility of the each individual bit, and the
initial condition:
Key
Bit Accessibility
rw
Read/Write
r
Read Only
r0
Read as 0
r1
Read as 1
W
Write Only
W7500 Datasheet Version1.0.1
13 / 116
2
System and memory overview
2.1
System architecture
Main system consists of :
Two masters :
-
Cortex-M0 core
-
uDMAC (PL230, 6channel)
Ten slaves :
-
Internal BOOT ROM
-
Internal SRAM
-
Internal Flash memory
-
Two AHB2APB bridge which connects all APB peripherals
-
Four AHB dedicated to 16bit GPIOs
-
TCPIP Hardware core
System architecture and AHB-Lite bus architecture shown in Figure 1.
POR
SWD
TCP/IP
SRAM
(32KB)
SRAM
(4KB)
Reset
Clocks
Resets
GPIOA/GPIOB
GPIO x 16
GPIOC/GPIOD
APB
APB
APB
Bridge
Bridge
Bridge
AHB-Lite BUS
APB BUS
NVIC
CM0
INTs
CRG
PLL
ROSC
32K XTAL
Ctrl
ROM
Controller
Flash
Interface
ROM
Flash
(128KB)
Flash
Controller
SRAM
Controller
SRAM
(16KB)
uDMA
(PL230)
XTAL
ADC
PWM
Dual Timer0/
Dual Timer1
WDOG
PAD Controller
Alternate Function
Controller
UART0/UART1
UART
UART
UART2
SPI0/SPI1
SPI x 2
I2C0/I2C1
I2C
RNG
Figure 1 W7500 System Architecture
AHB-Lite BUS
-
This bus connects the two masters (Cortex-M0 and uDMAC) and ten AHB slaves.
Two APB BUSs
W7500 Datasheet Version1.0.1
14 / 116
-
These buses connect Seventeen APB peripherals (Watchdog, two dual timers,
pwm, two UARTs, simple UART, two I2Cs, two SSPs, random number generator,
real time clock, 12bits analog digital converter, clock controller, IO
configuration, PAD MUX controller)
2.2
Memory organization
Introduction
Program memory, data memory, registers and I/O ports are organized within the same linear
4-Gbyte address space.
The bytes are coded in memory in Little Endian format. The lowest numbered byte in a word
is considered the word’s least significant byte and the highest numbered byte the most
significant.
W7500 Datasheet Version1.0.1
15 / 116
Memory map
0x4700_0000
TCP/IP
0x4600_0000
GPIO3
0x4500_0000
GPIO2
0x4400_0000
GPIO1
0xFFFF_FFFF
0x4300_0000
GPIO0
0x4200_0000
reserved
reserved
0xE010_0000
M0 Periphrals
0xE000_0000
0x4100_6000
0x4100_5000
0x4100_4000
0x4100_3000
0x4100_2000
0x4100_1000
0x4100_0000
Flash Control
DMA
IO CONFIG
NORMALMUX
CLKRST
ADC
reserved
reserved
0x4002_0000
0x4001_F000
System Control
0x4500_0000
reserved
Peripherals (APB, AHB)
0x4000_0000
reserved
0x4000_E000
0x4000_D000
0x4000_C000
0x4000_B000
0x4000_A000
0x4000_9000
0x4000_8000
0x4000_7000
0x4000_6000
0x4000_5000
UART1
UART0
SSP1
SSP0
I2C1
I2C0
RNG
UART2
PWM
reserved
0x4000_3000
0x4000_2000
0x4000_1000
0x4000_0000
0x2000_4000
DUAL TIMER1
DUAL TIMER0
WDOG
0x2000_4000
sram (16KB)
0x2000_0000
sram (16KB)
0x2000_0000
reserved
0x1002_0000
reserved
flash (128KB)
0x1000_0000
reserved
0x0002_0000
flash (128KB)
0x0000_0000
BOOT PIN : LOW(0)
TEST PIN : LOW(0)
Normal operation mode
0x0000_1000
0x0000_0000
boot rom
BOOT PIN : HIGH(1)
TEST PIN : LOW(0)
Boot mode
Figure 2 W7500 memory map
W7500 Datasheet Version1.0.1
16 / 116
3
System configuration controller (SYSCFG)
3.1
Introduction
Main purposes of the system configuration controller are the following
Control of the memory remap feature
The ability to enable an automatic reset if the system locks up
Information about the cause the last reset
4
Interrupt and events
4.1
Introduction
W7500 contains interrupt service and event service as below
4.2
26ea interrupt request (IRQ) lines.
One NonMaskable Interrupt (NMI).
One event signal
Interrupt assignments
Table 1 describes the W7500 interrupt assignments.
Table 1 W7500 interrupt assignments
IRQ/NMI
Device
Description
Address
NMI
Watchdog
Watchdog interrupt
0x0000_0008
IRQ[0]
SSP0
SSP0 global interrupt
0x0000_0040
IRQ[1]
SSP1
SSP1 global interrupt
0x0000_0044
IRQ[2]
UART0
UART0 global interrupt
0x0000_0048
IRQ[3]
UART1
UART1 global interrupt
0x0000_004C
IRQ[4]
UART2
UART2 global interrupt
0x0000_0050
IRQ[5]
I2C0
I2C0 global interrupt
0x0000_0054
IRQ[6]
I2C1
I2C1 global interrupt
0x0000_0058
IRQ[7]
GPIO0
GPIOA global interrupt
0x0000_005C
IRQ[8]
GPIO1
GPIOB global interrupt
0x0000_0060
IRQ[9]
GPIO2
GPIOC global interrupt
0x0000_0064
IRQ[10]
GPIO3
GPIOD global interrupt
0x0000_0068
IRQ[11]
DMA
DMA channel 1 ~ channel 5 interrupt
0x0000_006C
IRQ[12]
Dualtimer0
Dualtimer0 global interrupt
0x0000_0070
IRQ[13]
Dualtimer1
Dualtimer1 global interrupt
0x0000_0074
IRQ[14]
PWM0
PWM0 global interrupt
0x0000_0078
W7500 Datasheet Version1.0.1
17 / 116
4.3
IRQ[15]
PWM1
PWM1 global interrupt
0x0000_007C
IRQ[16]
PWM2
PWM2 global interrupt
0x0000_0080
IRQ[17]
PWM3
PWM3 global interrupt
0x0000_0084
IRQ[18]
PWM4
PWM4 global interrupt
0x0000_0088
IRQ[19]
PWM5
PWM5 global interrupt
0x0000_008C
IRQ[20]
PWM6
PWM6 global interrupt
0x0000_0090
IRQ[21]
PWM7
PWM7 global interrupt
0x0000_0094
IRQ[22]
reserved
IRQ[23]
ADC
ADC acquisition end interrupt
0x0000_009C
IRQ[24]
TCPIP
TCPIP global interrupt
0x0000_00A0
IRQ[25]
EXT_INT
External pin interrupt
0x0000_00A4
IRQ[26]
reserved
0x0000_00A8
IRQ[27]
reserved
0x0000_00AC
IRQ[28]
reserved
0x0000_00B0
IRQ[29]
reserved
0x0000_00B4
IRQ[30]
reserved
0x0000_00B8
IRQ[31]
reserved
0x0000_00BC
0x0000_0098
Event
W7500 is able to handle internal events in order to wake up the core(WFE). The wakeup event
can be generated by
When after DMA process finished
5
Power supply
5.1
Introduction
W7500 embeds a voltage regulator in order to supply the internal 1.5V digital power domain.
5.2
Require a 2.7V ~ 5.5V operating supply voltage (VDD)
ADC ref voltage is same as VDD
Voltage regulator
The voltage regulator is always enabled after Reset and works in only one mode.
In Run mode, the regulator supplies full power to the 1.5V domain.
There is no power down or sleep mode.
W7500 Datasheet Version1.0.1
18 / 116
5.3
Power supply supervisor
W7500 has an integrated reset (POR) circuit which is always active and ensure proper operation
above a threshold of 0.6V
The POR monitors only the VDD supply voltage. During the startup phase VDD
must arrive first and be greater than or equal to 0.6V
VDD15
0.6V
PORB
Figure 3 POR reset waveform
5.4
Low-power modes
W7500 is in RUN mode after a system or power reset. There are two low power modes to save
power when the CPU does not need to be kept running. These modes are useful for instances
like when the CPU is waiting for an external interrupt. Please note that there is no power-off
mode for W7500.
The device features two low-power modes:
Sleep mode
Deep Sleep mode
Additionally, the power consumption can be reducing by following methods:
User can slow down the system clocks
User can gate the clocks to the peripherals when they are unused.
Sleep mode
W7500 has two kinds of sleep modes. One is Sleep mode and the other is Deep sleep mode.
Two of them are almost the same except the clock gated peripherals kinds. Table 2 shows the
Sleep mode summary.
W7500 Datasheet Version1.0.1
19 / 116
Table 2 W7500 sleep mode summary
Mode
Entry
Wakeup
DEEPSLEEP = 0
Any interrupt
Enable WFI
Sleep mode
DEEPSLEEP = 0
Enable WFE
Wakeup event
DEEPSLEEP = 1
Deep Sleep mode
Any interrupt
Enable WFI
DEEPSLEEP = 1
Enable WFE
Wakeup event
Effect on clocks
CPU clock OFF
APB Bus Clock ON
AHB Bus clock ON
Memory clocks ON
CPU clock OFF
APB Bus Clock OFF
AHB Bus clock OFF
Memory clocks OFF
Peripheral clock gating
In Run mode, individual clocks can be stopped at any time to reduce power.
Peripheral clock gating is controlled by the CRG block.
Below is the list of clocks which can be gating in CRG block.
ADC clock (ADCCLK)
SSP0, SSP1 clock (SSPCLK)
UART0, UART1 clock (UARTCLK)
Two Timer clocks (TIMCLK0, TIMCLK1)
8ea PWM clocks (PWMCLK0 ~ PWMCLK7)
WDOG clock (WDOGCLK)
Random number generator clock (RNGCLK)
6
System tick timer
6.1
Introduction
System tick timer(SysTick) is part of the ARM Cortex-M0 core
6.2
Features
Simple 24bit timer.
Clocked internally by the system clock or the system clock/2/
6.3
Functional description
The SysTick timer is an integral part of Cortex-M0. The SysTick timer is intended to generated
a fixed 10 millisecond interrupt for use by an operating system or other system management
software.
Since the SysTick timer is a part of the Cortex-M0, it facilitates porting of software by
W7500 Datasheet Version1.0.1
20 / 116
providing a standard timer that is available on Cortex-M0 based devices. The SysTick
timer can be used for :
An RTOS tick timer which fires at a programmable rate (for example 100 Hz) and
invokes a SysTick routine.
A high-speed alarm timer using the core clock.
A simple counter. Software can use this to measure time to completion and time used.
An internal clock source control based on missing/meeting durations. The
COUNTFLAG bit-field in the control and status register can be used to determine if
an action completed within a set duration, as part of a dynamic clock management
control loop.
7
TCPIPCore Offload Engine (TOE)
Introduction
The TCP/IPCore Offlead Engine (TOE) is a Hardwired TCP/IP embedded Ethernet controller
that provides easier Internet connection to embedded systems. TOE enables users to have
Internet connectivity in their applications by using the TCP/IP stack.
WIZnet‘s Hardwired TCP/IP is the market-proven technology that supports TCP, UDP, IPv4, ICMP,
ARP, IGMP, and PPPoE protocols. TOE embeds the 32Kbyte internal memory buffer for the
Ethernet packet processing. Using TOE allows users to implement the Ethernet application by
adding the simple socket program. It’s faster and easier than using any other Embedded
Ethernet solutions. 8 independent hardware sockets can be used simultaneously.
TOE also provides WOL (Wake on LAN) to reduce power consumption of the system.
Features
Supports Hardwired TCP/IP Protocols : TCP, UDP, ICMP, IPv4, ARP, IGMP, PPPoE
Supports 8 independent sockets simultaneously
Supports Power down mode
Supports Wake on LAN over UDP
Internal 32Kbytes Memory for TX/RX Buffers
Not supports IP Fragmentation
W7500 Datasheet Version1.0.1
21 / 116
Functional description
Figure 4 shows the TOE block diagram.
Register Controller
AHB
Common
Register
Socket
Register
TCPIPCore
MII
Controller
Memory Controller
TX
Memory
RX
Memory
INT
MDC
Controller
RXC
TXC
RXC_N
TXC_N
COL
DUP
CRS
RXDV
RXD[3:0]
TXE
TXD[3:0]
MDC
MDO
MDI
Figure 4 TOE block diagram
TOE Memory map
TOE has one Common Register Block, eight Socket Register Blocks, and TX/RX Buffer Blocks
allocated to each Socket. Figure 5 shows the selected block by the base address and the
available offset address range of Socket TX/RX Buffer Blocks. Each Socket’s TX Buffer Block
physically exists in one 16KB TX memory and is initially allocated with 2KB. Also, Each Socket’s
RX Buffer Block physically exists in one 16KB RX Memory and is initially allocated with 2KB.
Regardless of the allocated size of each Socket TX/RX Buffer, it can be accessible within the
16 bits offset address range (From 0x0000 to 0xFFFF).
Refer to ‘Chapter 7.4.3’ for more information about 16KB TX/RX Memory organization and
access method.
W7500 Datasheet Version1.0.1
22 / 116
Blocks
Valid Range:
16bits Offset Address[15:0]
Base address
0x411F_0000
Socket 7 RX Buffer
Socket 7 TX Buffer
0x411D_0000
Socket 7 Register
0x411C_0000
Reserved
0x3FFF
0x3E2C
0xF800
0xF7FF
0x3800
0xF000
0xEFFF
0x3000
Socket 6 RX Buffer
Socket 6 TX Buffer
0x4119_0000
Socket 6 Register
0x4118_0000
Reserved
0x9E2C
0x280 0
0x200 0
...
0x411A_0000
Socket 7 RX Buffer
...
0x411B_0000
0xFFFF
...
0x411E_0000
Physical
16KB RX Memory
0x180 0
0x100 0
0x0FFF
0x4117_0000
Socket 5 RX Buffer
0x4116_0000
Socket 5 TX Buffer
0x4115_0000
Socket 5 Register
0x100 0
0x0FFF
0x080 0
0x07FF
0x080 0
0x000 0
0x000 0
Reserved
0x4113_0000
Socket 4 RX Buffer
0x4112_0000
Socket 4 TX Buffer
0x4111_0000
Socket 4 Register
0x4110_0000
Reserved
0x410F_0000
Socket 3 RX Buffer
0x3FFF
0x380 0
0x410D_0000
Socket 3 Register
0x410C_0000
Reserved
0xF000
0xEFFF
Socket 1 TX Buffer
Socket 2 TX Buffer
0x4109_0000
Socket 2 Register
0x4108_0000
Reserved
0x413C
0x100 0
0x0FFF
0x4106_0000)
Socket 1 TX Buffer
0x4105_0000
Socket 1 Register
0x4104_0000
Reserved
Socket 0 RX Buffer
Socket 0 TX Buffer
0x4101_0000
Socket 0 Register
0x003 1
0x003 0
Socket 4
RX Buffer (2KB)
Socket 3
RX Buffer (2KB)
Socket 2
RX Buffer (2KB)
Socket 1
RX Buffer (2KB)
Socket 0
RX Buffer (2KB)
0x000 0
Socket 7
TX Buffer (2KB)
Socket 6
TX Buffer (2KB)
Socket 5
TX Buffer (2KB)
Socket 4
TX Buffer (2KB)
Socket 3
TX Buffer (2KB)
Socket 2
TX Buffer (2KB)
Socket 1
TX Buffer (2KB)
Socket 0
TX Bufer (2KB)
Reserved
Socket 0 Register
0x000 0
0xFFFF
0x003A
0x003 9
Common Register
0x080 0
0x0000
0xFFFF
0x4102_0000
0x180 0
0x093C
...
Socket 1 RX Buffer
0x200 0
0x100 0
0x0FFF
0x080 0
0x07FF
0x4107_0000
0x4100_0000
0x2800
...
Socket 2 RX Buffer
0x410A_0000
0x4103_0000
0x3000
...
0x410B_0000
0xF800
0xF7FF
...
Socket 3 TX Buffer
Socket 5
RX Buffer (2KB)
Physical
16KB TX Memory
0xFFFF
0x410E_0000
Socket 6
RX Buffer (2KB)
...
0x4114_0000
Socket 7
RX Buffer (2KB)
Reserved
Common Register
0x000 0
Figure 5. Register & Memory Organization
W7500 Datasheet Version1.0.1
23 / 116
Common register map
Common Register Block configures the general information of TOE such as IP and MAC address.
defines the offset address of registers in this block. Refer to ‘Chapter
7.4.1’ for
more details about each register.
Table 3. Offset Address for Common Register
Address
Register
0x0000
TOE Version (VERSIONR)
0x2000
TICKCLOK (TCLKR)
0x2100
Interrupt (IR)
0x2104
Interrupt Mask (IMR)
0x2108
Interrupt Clear (IRCR)
0x2110
Socket Interrupt (SIR)
0x2114
Socket Mask (SIMR)
0x2300
Mode (MR)
0x2400
PPP Timer (PTIMER)
0x2404
PPP Magic (PMAGIC)
0x2408
PPP Destination MAC Address (PHAR1)
0x240C
PPP Destination MAC address (PHAR0)
0x2410
PPP Session Identification (PSID)
0x2414
PPP Maximum Segment Size (PMSS)
0x6000
Source Hardware Address (SHAR1)
0x6004
Source Hardware Address (SHAR0)
0x6008
Gateway Address (GA)
0x600C
Subnet Mask (SUB)
0x6010
Source IP Address (SIP)
0x6020
Network Configuration Lock (NCONFL)
0x6040
Retry Time (RTR)
0x6044
Retry Counter (RCR)
0x6050
Unreachable IP Address (UIP)
0x6054
Unreachable Port Address (UPORT)
Socket register map
TOE supports 8 Sockets for communication channel. Each Socket is controlled by Socket n
Register (n = 0,…,7
,where n is socket number). defines the 16bits Offset Address
of registers in Socket n Register Block.
Refer to ‘Chapter 7.4.2’ for more details about each register.
W7500 Datasheet Version1.0.1
24 / 116
Table 4. Offset Address in Socket n Register Block (n = 0,…,7, where n is Socket number)
Offset
Register
0x0000
Socket Mode (Sn_MR)
0x0010
Socket Command (Sn_CR)
0x0020
Socket Interrupt (Sn_IR)
0x0024
Socket Interrupt Mask (Sn_IMR)
0x0028
Socket Interrupt Clear (Sn_ICR)
0x0030
Socket Status (Sn_SR)
0x0100
Socket Protocol Number (Sn_PNR)
0x0104
Socket IP Type of Service (Sn_TOS)
0x0108
Socket TTL (Sn_TTLR)
0x010C
Socket Fragment Offset (Sn_FRAG)
0x0110
Socket Maximum Segment (Sn_MSSR)
0x0114
Socket Port Number (Sn_PORT)
0x0118
Socket Destination Hardware address0 (Sn_DHAR0)
0x011C
Socket Destination Hardware address1 (Sn_DHAR1)
0x0120
Socket Destination Port Number (Sn_DPORTR)
0x0124
Socket Destination IP Address (Sn_DIPR)
0x0180
Socket Keep Alive Timer (Sn_KATMR)
0x0184
Socket Retry Time (Sn_RTR)
0x0188
Socket Retry Counter (Sn_RCR)
0x0200
Socket TX Memory Size (Sn_TXBUF_SIZE)
0x0204
Socket TX Free Size (Sn_TX_FSR)
0x0208
Socket TX Read Pointer (Sn_TX_RD)
0x020C
Socket TX Write Pointer (Sn_TX_WR)
0x0220
Socket RX Memory Size (Sn_RXBUF_SIZE)
0x0224
Socket RX Received Size (Sn_RX_RSR)
0x0228
Socket RX Read Pointer (Sn_RX_RD)
0x022C
Socket RX Write Pointer (Sn_RX_WR)
Memory
TOE has one 16KB TX memory for Socket n TX Buffer Blocks and one 16KB RX memory for
Socket n RX buffer Blocks.
16KB TX memory is initially allocated in 2KB size for each Socket TX Buffer Block (2KB X 8 =
16KB). The initial allocated 2KB size of Socket n TX Buffer can be re-allocated by using ‘Socket
n TX Buffer Size Register (Sn_TXBUF_SIZE)’.
W7500 Datasheet Version1.0.1
25 / 116
Once all Sn_TXBUF_SIZE registers have been configured, Socket TX Buffer is allocated with the
configured size of 16KB TX Memory and is assigned sequentially from Socket 0 to Socket 7. Its
physical memory address is automatically determined in 16KB TX memory. Therefore, the total
sum of Sn_TXBUF_SIZE should not exceed 16 in case of error in data transmission.
The 16KB RX memory allocation method is the same as the 16KB TX memory allocation method.
16KB RX memory is initially allocated into 2KB size for each Socket RX Buffer Block (2KB X 8 =
16KB). The initial allocated 2KB size of Socket n RX Buffer can be re-allocated by using ‘Socket
n RX Buffer Size Register (Sn_RXBUF_SIZE)’.
When all Sn_RXBUF_SIZE registers have been configured, the Socket RX Buffer is allocated
with the configured size in 16KB RX Memory and is assigned sequentially from Socket 0 to
Socket 7. The physical memory address of the Socket RX Buffer is automatically determined
in 16KB RX memory. Therefore, the total sum of Sn_RXBUF_SIZE should not exceed 16 or data
reception error will occur.
For 16KB TX/RX memory allocation, refer to Sn_TXBUF_SIZE & Sn_RXBUF_SIZE in ‘Chapter
7.4.2’ . The Socket n TX Buffer Block allocated in 16KB TX memory is buffer for saving data to
be transmitted by host. The 16bits Offset Address of Socket n TX Buffer Block has 64KB address
space ranged from 0x0000 to 0xFFFF, and is configured with reference to ‘Socket n TX Write
Pointer Register (Sn_TX_WR)’ & ‘Socket n TX Read Pointer Register(Sn_RX_RD)’. However, the
16bits Offset Address automatically converts into the physical address to be accessible in 16KB
TX memory such as Figure 5. Refer to ‘Chapter 7.4.2’ for Sn_TX_WR & Sn_TX_RD.
The Socket n RX Buffer Block allocated in 16KB RX memory is buffer for saving the received
data through the Ethernet. The 16bits Offset Address of Socket n RX Buffer Block has 64KB
address space ranged from 0x0000 to 0xFFFF, and is configured with reference to ‘Socket n RX
RD Pointer Register (Sn_RX_RD)’ & ‘Socket n RX Write Pointer Register (Sn_RX_WR)’. However,
the 16bits Offset Address automatically converts into the physical address to be accessible in
16KB RX memory such as Figure 5. Refer to ‘Chapter 7.4.2’ for Sn_RX_RD & Sn_RX_WR.
8
Booting Sequence
W7500 has three different boot modes that can be selected through the BOOT pin and TEST
pin as shown in Table 5.
W7500 Datasheet Version1.0.1
26 / 116
Table 5 operation of mode selection
Mode
selection
Mode
TEST
BOOT
0
0
APP
0
1
ISP
1
1
PP
Aliasing
User code execute in Main Flash memory.
In this mode,W7500 can support ISP function in order to control
flash using serial interface.
When W7500 is reset by hardware, it will be operated as below in embedded boot code.
H/W reset
Boot
PP
APP
Run Application
Mode
Start PP Mode
ISP
Run ISP
Figure 6. operation of boot code
W7500 Datasheet Version1.0.1
27 / 116
9
Embedded Flash memory
Flash main features
Up to 128Kbytes of Flash memory
Memory organization:
Main Flash memory block:
Up to 128Kbytes
Information block:
Up to 512bytes
Information block is read only
Data block:
Up to 512bytes
Flash memory interface features:
Read interface with prefetch buffer( 1 x 32-bit words )
Flash Program / Erase operation
Read / Write protection
Flash memory functional description
Flash memory organization
The Flash memory is organized of 32-bit wide memory cells that can be used for storing both
code and data constants.
The memory organization is based on a main Flash memory block containing 512 sectors of
256byte or 32 blocks of 4Kbyte. The block and sector provides read/write protection.
Table 6 description of Flash memory
(bytes)
Name
256
Sector 0
0x0000 0100 ~ 0x0000 01FF
256
Sector 1
0x0000 0200 ~ 0x0000 02FF
256
Sector 2
0x0000 0300 ~ 0x0000 03FF
256
Sector 3
...
0x0000 0000 ~ 0x0000 00FF
0x0000 7000 ~ 0x0000 70FF
256
Sector112
0x0000 7100 ~ 0x0000 71FF
256
Sector113
0x0000 7200 ~ 0x0000 72FF
256
Sector114
memory
W7500 Datasheet Version1.0.1
Description
Block 0
...
Size
...
Main Flash
Flash memory address
...
Flash area
Block 7
28 / 116
0x0001 FC00 ~ 0x0001 FCFF
256
Sector509
0x0001 FD00 ~ 0x0001 FDFF
256
Sector510
0x0001 FE00 ~ 0x0001 FEFF
256
Sector511
0x0001 FF00 ~ 0x0001 FFFF
256
Sector512
Information
0x0003 FC00 ~ 0x0003 FCFF
256
block
0x0003 FD00 ~ 0x0003 FDFF
Data block
Flash
memory
Interface
register
...
...
Sector115
...
256
...
0x0000 7300 ~ 0x0000 73FF
Block 32
Lock info
Reserved
0x0003 FE00 ~ 0x0003 FEFF
256
Data0
0x0003 FF00 ~ 0x0003 FFFF
256
Data1
0x4100 5000 ~ 0x4100 5003
4
FACCR
0x4100 5004 ~ 0x4100 5007
4
FADDR
0x4100 5008 ~ 0x4100 500B
4
FDATAR
0x4100 500C ~ 0x4100 500F
4
FCTRLR
0x4100 5010 ~ 0x4100 5013
4
FSTATR
0x4100 5014 ~ 0x4100 5017
4
FLOCKR0
0x4100 5018 ~ 0x4100 501B
4
FLOCKR1
0x4100 5030 ~ 0x4100 5033
4
FKEYR0
0x4100 5034 ~ 0x4100 5037
4
FKEYR1
0x4100 5038 ~ 0x4100 503B
4
BSADDR0
0x4100 503C ~ 0x4100 503F
4
BSADDR1
The W7500 embedded Flash memory can be programmed using in-circuit programming or inapplication programming.
The in-circuit programming (ICP) method is used to update the entire contents of the Flash
memory using the SWD protocol or the boot loader to load the user application into the
microcontroller. ICP offers quick and efficient design iterations and eliminates unnecessary
package handling or socketing of devices.
In contrast to the ICP method, in-application programming (IAP) can use any communication
interface supported by the microcontroller (I/Os, UART, I2C, SPI, etc.) to download
programming data into memory. IAP allows the user to re-program the Flash memory while the
application is running. Nevertheless, part of the application has to have been previously
programmed in the Flash memory using ICP.
The program and erase operations can be performed over the whole product voltage range.
They are managed through the following seven Flash registers:
Flash access control register (FACCR)
Flash address register (FADDR)
Flash data register (FDATAR)
W7500 Datasheet Version1.0.1
29 / 116
Flash control register (FCTRLR)
Flash status register (FSTATR)
Flash lock register (FLOCKR0/R1)
Flash key register (FKEYR0/R1)
Unlocking the Flash access Control register (FACCR)
After reset, the Flash memory is protected against unwanted write or erase operations. The
FACCR register is not accessible in write mode. An unlocking sequence should be written to
the FKEYR0/R1 register to open the access to the FACCR register. This sequence consists of
two write operations:
Write KEY 0 (FKEYR0) = 0x52537175
Write KEY 1 (FKEYR1) = 0xA91875FC
Any wrong sequence locks up the FACCR register.
The FACCR register can be locked again by finishing flash control operation.
Read operations
The embedded Flash module can be addressed directly as a common memory space. Any data
read operation accesses the content of the Flash module through dedicated read senses and
provides the requested data.
The instruction fetch and the data access are both done through the same AHB bus. Read
accesses can be performed with the following options managed through the Flash control
register. (FCTRLR)
The Flash reading sequence using FCTRLR register is as below:
1. Check that no main Flash memory operation is ongoing by checking the RDY bit in the
FSTATR register.
2. Set KEY in FKEYR0/R1 for setting FACCR register.
3. Set FEN and CTRL bits in the FACCR register.
4. Write main Flash memory address or Data block address to FADDR register.
5. Set RDI or RD bit in FACTRLR to 1. If use RDI bit, don’t need to set FADDR again due to
increase automatically by SZ bit in FACCR register.
6. Read data from FDATAR register.
7. Wait until the RDY bit is 1 in the FSTATR register.( it is set when the programming
operation has succeeded)
8. Set KEY in FKEYR0/R1 for clearing FACCR register.
9. Clear FEN and CTRL bits in the FACCR register
W7500 Datasheet Version1.0.1
30 / 116
Write FKEY
FKEYR0 = 0x52537175
FKEYR1 = 0xA91875FC
FACCR[FEN] = 1
FACCR[CTRL] = 1
FADDR = Main Flash Memory
Or
FADDR = Data block
FCTRLR[RDI] = 1
Or
FCTRLR[RD] = 1
SZ == 01
SZ == 11
If FACCR[SZ]
SZ == 10
Data = FDATAR[7:0]
Data = FDATAR[15:0]
Data = FDATAR[31:0]
FSTAR[RDY] == 1
No
Yes
Yes / RD bit is set
Yes/ RDI bit is set
If remain another data
No
Write FKEY
FKEYR0 = 0x52537175
FKEYR1 = 0xA91875FC
FACCR[FEN] = 0
FACCR[CTRL] = 0
Check the read value
Figure 7. Flash reading sequence
Flash erase operations
Sector Erase
Follow the procedure below to erase a sector:
1. Check that no Flash memory operation is ongoing by checking the RDY bit in the FSTATR
register.
2. Set KEY in FKEYR0/R1 for setting FACCR register.
3. Set FEN and CTRL bits in the FACCR register.
4. Write main Flash memory address to FADDA register to erase.
5. Set SER bit in FACTRLR to 1.
6. Wait until the RDY bit is 1 in the FSTATR register.
7. Set KEY in FKEYR0/R1 for clearing FACCR register.
8. Clear FEN and CTRL bits in the FACCR register
W7500 Datasheet Version1.0.1
31 / 116
Write FKEY
FKEYR0 = 0x52537175
FKEYR1 = 0xA91875FC
FACCR[FEN] = 1
FACCR[CTRL] = 1
FADDR = Main Flash Address
Or
FADDR = Data Block Address
FCTRLR[SER] = 1
RDY bit in FSTATR
=1
No
Yes
Write FKEY
FKEYR0 = 0x52537175
FKEYR1 = 0xA91875FC
FACCR[FEN] = 0
FACCR[CTRL] = 0
Check value
Figure 8. Flash erase operations
Block Erase
To erase a block, set BER bit in FACTRLR to 1. All other procedures are the same as the sector
erase sequence.
Chip Erase ( All main Flash memory erase )
To erase chip (Main Flash memory), Set CER bit in FACTRLR to 1. All other procedures are the
same as the sector erase sequence.
Mass Erase ( All main Flash memory erase + Data block erase )
To erase mass (Main Flash memory + Data block), Set MER bit in FACTRLR to 1. All other
procedures are the same as the sector erase sequence.
W7500 Datasheet Version1.0.1
32 / 116
Flash program operation
The main Flash memory can be programmed word, half word, or 1 byte at a time by SZ bit of
FACCR. The program operation is started when the CPU writes a data into a main Flash memory
address with the WRI or WR bit of FCTRLR register set.
The main Flash memory programming sequence in standard mode is as below:
Write FKEY
FKEYR0 = 0x52537175
FKEYR1 = 0xA91875FC
FACCR[FEN] = 1
FACCR[CTRL] = 1
FADDR = Main Flash Memory
Or
FADDR = Data block
SZ == 01
If FACCR[SZ]
SZ == 11
SZ == 10
FDATAR[7:0] = 8bit data
FDATAR[15:0] = 16bit data
FDATAR[31:0] = 32bit data
FCTRLR[WRI] = 1
Or
FCTRLR[WR] = 1
FSTAR[RDY] == 1
No
Yes
Yes / WR bit is set
Yes/ WRI bit is set
If remain another data
No
Write FKEY
FKEYR0 = 0x52537175
FKEYR1 = 0xA91875FC
FACCR[FEN] = 0
FACCR[CTRL] = 0
Check the programmed value by
Reading the programmed address
Figure 9. main Flash memory programming sequence
1. Check that no main Flash memory operation is ongoing by checking the RDY bit in the
FSTATR register.
2. Set KEY in FKEYR0/R1 for setting FACCR register.
W7500 Datasheet Version1.0.1
33 / 116
3. Set FEN and CTRL bits in the FACCR register.
4. Write main Flash memory address or Data block address to FADDR register.
5. Write data to FDATAR register.
6. Set WRI or WR bit in FACTRLR to 1. If use WRI bit, don’t need to set FADDR again due
to increase automatically by SZ bit in FACCR register.
7. Wait until the RDY bit is 1 in the FSTATR register.( it is set when the programming
operation has succeeded)
8. Set KEY in FKEYR0/R1 for clearing FACCR register.
9. Clear FEN and CTRL bits in the FACCR register
Memory protection
The user area of the Flash memory can be protected against read by untrusted code. The
blocks of the Flash memory can also be protected against unwanted write due to loss of
program counter contexts. The write-protection granularity is one block (4Kbyte).
Read protection
The read protection is activated by DRL bit and CRL bit in FLOCKR0 register.
DRL0 : read protection to Data0 area in Data block.
DRL1 : read protection to Data1 area.in Data block
CRL : read protection to main Flash memory
Write protection
The write protection is implemented with a granularity of one block. It is activated by
configuring the FLOCKR1 register or DWL bit, CABWL bit in FLOCKR0 register.
FLOCKR1 : write protection to main Flash memory with a granularity of one block.
DWL0 : write protection to Data0 area in Data block.
DWL1 : write protection to Data1 area in Data block.
CABWL : write protection to main Flash memory all block.
W7500 Datasheet Version1.0.1
34 / 116
10
Clock Reset generator (CRG)
10.1
Introduction
CRG is clock reset generator block for W7500 System. It provides every clock/reset for all
other block include CPU and peripherals. CRG includes PLL and POR.
10.2
Features
Reset
•
Three types of reset – external reset, Power reset, system reset
•
External reset is generated by low level on the RSTn pin (external reset)
•
Power reset is generated by Power-on reset (POR)
•
Power on reset is generated by POR
•
System reset is generated when one of the following events occurs
Watchdog event
After remapping
Software reset (SYSRESETREQ bit in Cortex-M0. Refer to the Cortex-M0 technical
reference manual for more detail)
•
Power reset sets all registers to their reset values.
•
System reset sets all registers to their reset values except the CRG block registers and
remap register to protect remap value
Clock
Two clock sources can be used to drive the system clock.
External oscillator clock (8MHz ~ 24MHz) (OCLK)
Internal 8MHz RC oscillator clock (RCLK)
One additional clock source
32.768KHz low speed external crystal which derives the real time clock.
There is a PLL
One PLL is integrated
Input clock range is from 8MHz to 24MHz
Frequency can be generated by M/N/OD registers. (refer register description)
Bypass option enabled
There are many generated clocks for independent operating with system clock
System clock (FCLK)
ADC clock (ADCCLK)
SSP0, SSP1 clock (SSPCLK)
UART0, UART1 clock (UARTCLK)
W7500 Datasheet Version1.0.1
35 / 116
Two Timer clocks (TIMCLK0, TIMCLK1)
8ea PWM clocks (PWMCLK0 - PWMCLK7)
Real time clock (RTCCLK)
WDOG clock (WDOGCLK)
Random number generator clock (RNGCLK)
RNGCLK have only one source (pll output) and no prescaler
Some of the generated clocks turn off automatically when CPU enters sleep mode.
ADCCLK, RNGCLK
Generate two Hardware TCPIP Clocks (MII_RXC, MII_TXC) are from external PADs.
Hardware TCPIP Clocks can be gated by register control.
All clocks generated from CRG can be monitored.
10.3
Functional description
Figure 10 shows the CRG block diagram.
CRG
OSC_IN
OSC_OUT
(8~24)MHz
OSC
8MHz
RC
OCLK
SCLK
RCLK
FIN
FOUT
MCLK
PLL
RSTn
ResetN
(to Reset gen.)
POR
MCLK
MCLK
RCLK
OCLK
/1,2,4,8
FCLK
OFF
MCLK
RCLK
OCLK
/1,2,4,8
ADCCLK
OFF
MCLK
RCLK
OCLK
/1,2,4,8
SSPCLK
OFF
MCLK
RCLK
OCLK
/1,2,4,8
UARTCLK
/1,2,4,8,16,32,64,128
/1,2,4,8,16,32,64,128
TIMCLK0/TIMCLK1
OFF
MCLK
RCLK
OCLK
/1,2,4,8,16,32,64,128
/1,2,4,8,16,32,64,128
/1,2,4,8,16,32,64,128
PWMCLK0 - PWMCLK7
OFF
FCLK
/1,2,4,8,16,32,64,128
..
OFF
FCLK
WDOGCLK
Figure 10 CRG block diagram
External Oscillator Clock
External oscillator clock (OCLK) can be generated from two possible clock source
External crystal/ceramic resonator (8 to 24MHz external oscillator)
User external clock
Table 7 shows the two clock sources of external oscillator clock
Table 7 External oscillator clock sources
External clock
W7500 Datasheet Version1.0.1
Crystal/
36 / 116
Ceramic resonators
OSC_IN
External
source
OSC_IN
8~24MHz
Schematic
OSC_OUT
NC
OSC_OUT
RC oscillator clock
RC oscillator clock (RCLK) signal is generated from an internal 8MHz RC oscillator.
RC oscillator has the advantage of providing a clock source at low cost (no external
components). However the RC oscillator is less accurate than the external crystal or ceramic
resonator.
Accuracy : 1% at TA= 25oC (User don’t need to calibration)
PLL
The internal PLL can be used to multiply the External Oscillator Clock (OCLK) or RC Oscillator
Clock (RCLK). PLL input can be selected by register.
PLL output clock can be generated by following the equations below.
FOUT = FIN x M / N x 1 / OD
Where:
M = M[5] x 25 + M[4] x 24 + M[3] x 23 + M[2] x 22 + M[1] x 2 + M[0] x 1
N = N[5] x 25 + N[4] x 24 + N[3] x 23 + N[2] x 22 + N[1] x 2 + N[0] x 1
OD = 2
(2 x OD[1])
x2
(1 x OD[0])
Generated clock
Each generated clock source can be selected among 3 clock source as independent by each
clock source select register.
PLL output clock (MCLK)
Internal 8MHz RC oscillator clock (RCLK)
External oscillator clock (8MHz ~ 24MHz) (OCLK)
Each generated clock has own prescaler which can be selected individually by each prescale
value register.
FCLK, ADCCLK, SSPCLK, UARTCLK : 1/1, 1/2, 1/4, 1/8
TIMCLK0, TIMCLK1, PWMCLK0 – PWMCLK7, RTCCLK, WDOGCLK : 1/1, 1/2, 1/4,
1/8, 1/16, 1/32, 1/64, 1/128
W7500 Datasheet Version1.0.1
37 / 116
11
Random number generator (RNG)
Introduction
RNG is a 32bit random number generator. RNG generates power on random number when
power on reset. RNG can run/stop by software. RNG seed value and polynomial of RNG can be
modified by software.
Features
•
32bit pseudo random number generator
•
Formula of pseudo random number generator (polynomial) can be modified.
•
Seed value of random generator can be modified.
•
Support power on reset random value
•
Random value can be obtained by control start/stop by software.
Functional description
Figure 11 shows the RNG block diagram.
RNGCLK
PCLK
PLL_LOCK
RSTn
ADCCLK
Controller
(Registers)
APB IF
RN[31;0]
SEED[31:0]
1
POLY[31:0]
MODE
CLKSEL
RUN
CLK
RSTn
0
n-4
n-3
n-2
n-1
Polynomial
Registers
0
1
2
n-3
n-2
n-1
Shift
Registers
0
1
2
n-3
n-2
n-1
Seed
Registers
n = 32
Figure 11. Random Number Generator block diagram
W7500 Datasheet Version1.0.1
38 / 116
Operation RNG
Figure 12 show the flowchart of RNG operation.
A random number is automatically generated after powering on reset,
Follow the procedure below to manually generate a random number.
1. Change MODE to start/stop by register.
2. Change clock source / seed value / polynomial value if need.
3. Run and Stop the RNG.
4. Read Random value.
START
Change RNG_MODE
(RNG_MODE = 1)
Change clock source (if need)
(RNG_CLK_SEL)
Change seed value (if need)
(RNG_SEED)
Change polynomial value
(if need)
(RNG_POLY)
Run RNG
(RNG_RUN = 1)
STOP RNG
(RNG_RUN = 0)
Read generated random
number
(RN)
DONE
Figure 12. Flow chart of RNG operation
W7500 Datasheet Version1.0.1
39 / 116
12
Alternate Function Controller (AFC)
Introduction
Each functional PADs have several functions.
Users can select a function in Alternate Function Controller block.
Features
Each functional pad has 2 ~ 4 functions.
Pads can be selected by each registers individually.
Each pad can be used as external interrupt source.
Functional description
Table 8 shows the function table of each functional pad.
Table 8 functional description table
function selection register value
00 (reset value)
01
10
11
4th Function
PAD
PIN
Normal Function
2nd Function
3rd Function
PA_00
NAME
29
NUM
GPIOA_0
GPIOA_0
PWM6/CAP6
PA_01
30
GPIOA_1
GPIOA_1
PWM7/CAP7
PA_02
31
GPIOA_2
GPIOA_2
CLKOUT
PA_03
49
SWCLK
GPIOA_3
PA_04
50
SWDIO
GPIOA_4
PA_05
33
SSEL0
GPIOA_5
SCL1
PWM2/CAP2
PA_06
34
SCLK0
GPIOA_6
SDA1
PWM3/CAP3
PA_07
35
MISO0
GPIOA_7
U_CTS1
PWM4/CAP4
PA_08
36
MOSI0
GPIOA_8
U_RTS1
PWM5/CAP5
PA_09
37
SCL0
GPIOA_9
U_TXD1
PWM6/CAP6
PA_10
38
SDA0
GPIOA_10
U_RXD1
PWM7/CAP7
PA_11
40
U_CTS0
GPIOA_11
SSEL1
PA_12
41
U_RTS0
GPIOA_12
SCLK1
PA_13
42
U_TXD0
GPIOA_13
MISO1
PA_14
43
U_RXD0
GPIOA_14
MOSI1
PA_15
44
GPIOA_15
GPIOA_15
PB_00
45
SSEL1
GPIOB_0
U_CTS0
PB_01
46
SCLK1
GPIOB_1
U_RTS0
PB_02
47
MISO1
GPIOB_2
U_TXD0
W7500 Datasheet Version1.0.1
40 / 116
PB_03
48
MOSI1
GPIOB_3
PB_04
24
TXEN
GPIOB_4
PB_05
25
COL
GPIOB_5
PB_06
16
RXD3
GPIOB_6
PB_07
17
RXCLK
GPIOB_7
PB_08
18
DUP
GPIOB_8
PB_09
19
TXCLK
GPIOB_9
PB_10
20
TXD0
GPIOB_10
PB_11
21
TXD1
GPIOB_11
PB_12
22
TXD2
GPIOB_12
PB_13
23
TXD3
GPIOB_13
PB_14
26
GPIOB_14
PB_15
27
GPIOB_15
PC_00
53
U_CTS1
GPIOC_0
PWM0/CAP0
PC_01
54
U_RTS1
GPIOC_1
PWM1/CAP1
PC_02
55
U_TXD1
GPIOC_2
PWM2/CAP2
PC_03
56
U_RXD1
GPIOC_3
PWM3/CAP3
PC_04
57
SCL1
GPIOC_4
PWM4/CAP4
PC_05
58
SDA1
GPIOC_5
PWM5/CAP5
PC_06
51
GPIOC_6
GPIOC_6
U_TXD2
PC_07
52
GPIOC_7
GPIOC_7
U_RXD2
PC_08
1
PWM0/CAP0
GPIOC_8
SCL0
AIN7
PC_09
2
PWM1/CAP1
GPIOC_9
SDA0
AIN6
PC_10
3
U_TXD2
GPIOC_10
PWM2/CAP2
AIN5
PC_11
4
U_RXD2
GPIOC_11
PWM3/CAP3
AIN4
PC_12
5
AIN3
GPIOC_12
SSEL0
AIN3
PC_13
6
AIN2
GPIOC_13
SCLK0
AIN2
PC_14
7
AIN1
GPIOC_14
MISO0
AIN1
PC_15
8
AIN0
GPIOC_15
MOSI0
AIN0
PD_00
11
CRS
GPIOD_0
PD_01
12
RXDV
GPIOD_1
PD_02
13
RXD0
GPIOD_2
PD_03
14
RXD1
GPIOD_3
PD_04
15
RXD2
GPIOD_4
W7500 Datasheet Version1.0.1
U_RXD0
41 / 116
13
External Interrupt (EXTI)
Introduction
Each functional pads are connected to the external interrupt(EXTINT) source.
Features
•
All functional pads can be used as an external interrupt source regardless of any set of
pad function.
•
External Interrupt controller has the following functions and can be controlled by registers.
Interrupt mask (enable or disable, default : disable)
Interrupt polarity (rising or falling, default : rising)
Functional description
All pads are connected to the control register individually. (External interrupt mask register
and External Interrupt polarity register)
External interrupt working as following expression:
Each pad interrupt = Interrupt mask & (Interrupt polarity ^ Pad input)
EXTINT = any Each pad interrupt
Figure 13 shows the External Interrupt diagram.
W7500 Datasheet Version1.0.1
42 / 116
PA_00_mask
PA_00_Polarity
...
PA_00
...
PA_15_mask
PA_15
PA_15_Polarity
PB_00_mask
PB_00_Polarity
...
PB_00
...
PB_15_mask
EXTINT
PB_15
PB_15_Polarity
PC_00_mask
PC_00_Polarity
...
PC_00
...
PC_15_mask
PC_15
PC_15_Polarity
PD_00_mask
PD_00_Polarity
...
PD_00
...
PD_04_mask
PD_04
PD_04_Polarity
Figure 13. External Interrupt diagram
W7500 Datasheet Version1.0.1
43 / 116
14
Pad Controller (PADCON)
Introduction
Pads of W7500 are controllable. User can control pad’s characteristic.
Features
•
W7500 has digital I/O pads and digital/analog mux I/O pads
•
Controllable characteristics of pads are pull-up, pull-down, driving strength, input enable,
and CMOS/Schmitt trigger input buffer
•
Each pad can be controled individually by register.
Functional description
Figure 14 shows the function schematic of digital I/O pad of W7500.
Y
IE
CS
PU
A
P
DS
PD
Figure 14. function schematic of digital I/O pad
Figure 15 shows the function schematic of digital/analog mux IO pad of W7500
YA
Y
IE
CS
PU
A
P
DS
PD
Figure 15. function schematic of digital/analog mux IO pad
W7500 Datasheet Version1.0.1
44 / 116
Initials of Pad diagram is same as below.
P - PAD
YA – Analog Input (connect to ADC input)
Y – Digital Input
IE – Input buffer enable
Condition
A
Y
P
Input buffer enable
Output mode
OUT
OUT
OUT
(IE = 1)
Input mode
No use
IN
IN
Input buffer disable
Output mode
OUT
Low (0)
OUT
(IE = 0)
Input mode
No use
IN
IN
CS – CMOS/Schmitt trigger input buffer select
PU – Pull-up enable
A – Digital Output
DS – Driving strength select
Condition
Driving Strength
Rise/Fall Time (nSec)
Capacitance
loading
Propagation Delay (nSec)
Min
Max
Min
Max
High
25pF
4
18
7
27
(DS = 1)
100pF
11
53
11
44
Low
25pF
1
8
4
16
(DS = 0)
100pF
4
23
7
24
PD – Pull-down enable
User can set pad condition with IE, CS, PU/PD, DS by register.
And pads are can be controlled individually.
15
General-purpose I/Os(GPIO)
Introduction
The GPIO(General-Purpose I/O Port) is composed of four physical GPIO blocks, each
corresponding to an individual GPIO port(PORT A, PORT B, PORT C, PORT D). The GPIO supports
up to 53 programmable input/output pins, depending on the peripherals being used.
Features
•
The GPIO peripheral consists the following features.
GPIO_DATAOUT can SET/CLEAR by the SET register and CLEAR register. (1 for set and
0 for clear)
W7500 Datasheet Version1.0.1
45 / 116
Mask registers allow treating sets of port bits as a group leaving other bits unchanged.
Up to 53 GPIOs depending on configuration
Programmable control for GPIO interrupts
Interrupt generation masking
Edge-triggered on rising, falling, or both
Functional description
Figure 16 shows the GPIO block diagram.
AHB
interface
GPIO_DATDAIN
0
1
GPIO_DATAOUT
I/O pad
ALTF_SET
Register
Block
0
1
GPIO_SET[15:0]
GPIOINT[15:0]
Pin Mux
Alternate
function signals
Figure 16. GPIO block diagram
Figure 17 shows the operation sequences available for the GPIO.
The pad alternate function is using the pad alternate function select register.
Refer to ‘12. Alternate Function Controller (AFC)’ for more details about each register.
The pad control supports pull-down, pull-up, input buffer, and summit trigger input buffer.
Refer to ‘14. Pad Controller (PADCON)’ for more details about each register.
W7500 Datasheet Version1.0.1
46 / 116
Initia l setting Sta rt
GPIO Mode =
GPIO mode Out ?
Yes
No
Set GPIOxOUTENSET
Set GPIOxOUTENCLR
Set PADCON
Set PADCON
Transmit DATA
Receive DATA
END
Figure 17. GPIO Flow chart
Masked access
The masked access feature permits individual bits or multiple bits to be read from or written
to in a single transfer. This avoids software-based read-modify-write operations that are not
thread safe. With the masked access operations, the 16-bit I/O is divided into two halves,
lower byte and upper byte. The bit mask address spaces are defined as two arrays each
containing 256 words.
For example, to set bits[1:0] to 1 and clear bits[7:6] in a single operation, users can carry out
the write to the lower byte mask access address space. The required bit mask is 0xC3, and
users can write the operation as MASKLOWBYTE[0xC3] = 0x03. Refer Figure 18 below.
W7500 Datasheet Version1.0.1
47 / 116
Address
offset
Upper byte masked
access
register
DATAOUT = 0x322B
MASKLOWBYTE is a data
array of 32-bit x 256
MASK_LOWBYTE[0xC3] = 0x03
0x0800
Address offset =
0x0400 + 0xC3*4 = 0x70C
lower byte masked
access
register
bit mask : 'b1100_0011(0xC3)
0x0400
set bit[1:0] to 1
clear bit[7:6] to 0
DATA /Control
register
DATAOUT = 0x32E8
0x0000
Figure 18. MASK LOWBYTE access
To update some of the bits in the upper eight bits of the GPIO port, users can use the
MASKHIGHBYTE array as Figure 19 below.
Address
offset
DATAOUT = 0xA22B
MASKHIGHBYTE is a data
array of 32-bit x 256
MASK_LOWBYTE[0x98] = 0x8000
Address offset =
0x0800 + 0x98*4 = 0xA60
Upper byte masked
access
register
bit mask : 'b1001_1000(0x98)
set bit[12:11] to 0
clear bit[15] to 1
0x0800
DATAOUT = 0x322B
lower byte masked
access
register
0x0400
DATA /Control
register
0x0000
Figure 19 MASK HIGHBYTE access
W7500 Datasheet Version1.0.1
48 / 116
16
Direct memory access controller (DMA)
Introduction
Direct memory access (DMA) is used in order to provide high-speed data transfer between
peripherals and memory as well as memory to memory. Data can be quickly moved by DMA
without any CPU actions. This keeps CPU resources free for other operations.
The DMA controller has up to 6 channels in total, each dedicated to managing memory access
requests from one or more peripherals. It has an arbiter for handling the priority between DMA
requests. For more details, refer to “PrimeCell® μDMA Controller (PL230)” from the Technical
Reference Manual
Features
•
6 channels
•
Each channel is connected to dedicated hardware DMA requests and software trigger is
also supported on each channel.
•
Priorities between requests from the DMA channels are software programmable (2 levels
consisting of high, default)
•
Memory-to-memory transfer (software request only)
•
TCP/IP-to-memory transfer (software request only)
•
SPI/UART-to-memory transfer (hardware request and software request)
•
Access to Flash, SRAM, APB and AHB peripherals as source and destination
Functional description
Figure 20 shows the DMA block diagram.
TCP/IP
SRAM
GPIOA/GPIOB
GPIO x 16
GPIOC/GPIOD
APB
Bridge
AHB-Lite BUS
Flash
Interface
SRAM
Controller
Flash
SRAM
APB BUS
CM0
Other
APB
Peripherals
SPI0
SPI1
uDMA
(PL230)
UART0
DMA request
UART1
Figure 20. DMA Block diagram
W7500 Datasheet Version1.0.1
49 / 116
DMA request mapping
The hardware requests from the peripherals (UART0, UART1, SSP0, SSP1) are simply connected
to the DMA. Refer to Table 9 which lists the DMA requests for each channel.
Table 9 Summary of the DMA requests for each channel
Channel 1
Channel 2
Channel 3
Channel 4
Hardware
SSP0_TX
SSP1_TX
UART0_TX
UART1_TX
Request
SSP0_RX
SSP1_RX
UART0_RX
UART1_RX
Support
Support
Support
Support
Software
Request(1)
Channel 5
Channel 6
NONE
NONE
Support
Support
1. Software request is the only way to use DMA for memory-to-memory or TCP/IP-to-memory.
DMA arbitration
The controller can be configured to perform arbitration during a DMA cycle before and after a
programmable number of transfers. This reduces the latency for servicing a higher priority
channel.
The controller uses four bits in the channel control data structure that configures how many
AHB bus transfers occur before the controller re-arbitrates. These bits are known as the
R_power bits because the value R is raised to the power of two and this determines the
arbitration rate. For example, if R = 4, then the arbitration rate is 24 , which means the
controller arbitrates every 16 DMA transfers.
Remark: Do not assign a low-priority channel with a large R_power value because this prevents
the controller from servicing high-priority requests until it re-arbitrates.
When N > 2R and is not an integer multiple of 2R , then the controller always performs
sequences of 2R transfers until N < 2R remain to be transferred. The controller performs the
remaining N transfers at the end of the DMA cycle.
DMA cycle types
The cycle_ctrl bits in the channel control data structure contril how the DMA controller
performs a cycle.
The controller uses four cycle types described in this manual:
Invalid
Basic
W7500 Datasheet Version1.0.1
50 / 116
Auto-request
Ping-pong
See ARM micro DMA (PL230) documentation for additional cycle types.
For all cycle types, the controller arbitrates after 2R DMA transfers. If a low-priority channel
is set to a large 2R value then it prevents all other channels from performing a DMA transfer
until the low-priority DMA transfer completes. Therefore, the user must be cautious when
setting the R_power bit in the channel_cfg data structure so that the latency for high-priority
channels is not significantly increased.
16.3.3.1 Invalid cycle
After the controller completes a DMA cycle, it sets the cycle type to invalid to prevent it from
repeating the same DMA cycle.
16.3.3.2 Basic cycle
In this mode, the controller can be configured to use either the primary or the alternate
channel control data structure. After the channel is enabled and the controller receives a
request for this channel, the flow for basic cycle is as below:
1. The controller performs 2R transfers.
If the number of transfers remaining is zero the flow continues at step 3.
2. The controller arbitrates:
-
If a higher-priority channel is requesting service, then the controller services that
channel.
-
If the peripheral or software signals a request to the controller, then it continues at
step 1.
3. The controller sets dma_done[c] signal for this channel HIGH for one system clock cycle.
This indicates to the host processor that the DMA cycle is complete.
16.3.3.3 Auto-request cycle
When the controller operates in this mode, it is only necessary to receive a single request to
enable the controller to complete the entire DMA cycle. This enables a large data transfer to
occur, without significantly increasing the latency for servicing higher priority requests or
requiring multiple requests from the processor or peripheral.
The auto-request cycle is typically used for memory-to-memory requests. In this case,
software generates the starting request for the 2R transfers after setting up the DMA control
data structure.
W7500 Datasheet Version1.0.1
51 / 116
In this mode, the controller can be configured to use either the primary or the alternate
channel control data structure. After the channel is enabled and the controller receives a
request for this channel, the flow for the auto-request cycle is as below:
1.
The controller performs 2R transfers. If the number of transfers remaining is
zero the flow continues at step 3.
2.
The controller arbitrates if there are any transfers remaining after 2R
transfers. If the current channel c has the highest priority, the cycle continues
at step 1.
3.
The controller sets dma_done[c] signal for this channel HIGH for one system
clock cycle. This indicates to the host processor that the DMA cycle is
complete.
16.3.3.4 Ping-pong cycle
In this mode, the controller performs a DMA cycle using one of the data structures and then
performs a DMA cycle using the other data structure. The controller continues to switch
between primary and alternate structures until it either reads a data structure that is invalid,
or until the user reprograms the cycle_type to basic, or until the host processor disables the
channel.
In ping-pong mode, the user can program or reprogram one of the two channel data structures
(primary or alternate) while using the other channel data structure for the active transfer.
When a transfer is done, the next transfer can be started immediately using the prepared
channel data structure – provided that a higher priority channel does not require servicing. If
the user does not reprogram the channel control data structure not in use for a transfer, the
cycle type remains invalid (which is the value at the end of the last transfer using that
structure) and the ping-pong cycle completes.
The ping-pong cycle can be used for transfers to or from peripherals or for memory-to-memory
transfers.
W7500 Datasheet Version1.0.1
52 / 116
Figure 21. DMA ping pong cycle
W7500 Datasheet Version1.0.1
53 / 116
17
Analog-to-digital converter (ADC)
Introduction
ADC is a 12bit analog-to-digital converter. It has up to 9 multiplexed channels allowing it to
measure signals from 8 externals and 1 internal source.
ADC of various channels can be performed in single mode. The result of the ADC is stored in
12 bit register.
Features
•
12bit configuration resolution
•
Conversion time : Max 10MHz (Sampling time can be programmable)
8 channel for external analog inputs
CH0 : PC_15
CH1 : PC_14
CH2 : PC_13
CH3 : PC_12
CH4 : PC_11
CH5 : PC_10
CH6 : PC_09
CH7 : PC_08
1 channel for internal LDO(1.5v) voltage.
CH15 : Internal voltage
•
Start of conversion can be initiated by software.
•
Convert selected inputs once per trigger.
•
Interrupt generation at the end of conversion.
W7500 Datasheet Version1.0.1
54 / 116
Functional description
Figure 22 shows the ADC block diagram.
INT
MASK
INTCLR
INT
RSTn
ADCCLK
APB IF
Controller
(Registers)
INT CTRL
EOC
SMPSEL
PWD
START
CLK
RST
CHSEL[3:0]
REF
-
+
+
CMP
-
Digital&SAR
Logic
DATA[11:0]
+
ADC_IN[9:0]
9-to-1
MUX
DAC
Figure 22. ADC block diagram
Operation ADC with non-interrupt
Figure 23 shows the flowchart of ADC operation with non-interrupt.
ADC can be used as below:
1. ADC needs to be initialized before operation.
To initialize the ADC, clear the PWD bit first.
2. Select the ADC channel from 0 to 7 and 15 (initial core voltage).
3. Run start ADC conversion by set ADC_SRT bit.
4. Check INT bit to know finish of conversion.
5. If INT bit is high (1), read ADC conversion data.
6. Finally, ADC operation is finished by setting the PWD bit.
W7500 Datasheet Version1.0.1
55 / 116
START
ADC Power On
(PWD = 0)
Select Channel
(ADC_CHSEL)
ADC Start
(ADC_SRT)
CHECK INT bit
(INT == 1 ??)
NO
YES
Read ADC conversion data
(ADC_DATA)
YES
ADC again?
NO
ADC Power off
(PWD = 1)
Figure 23. The ADC operation flowchart with non-interrupt
W7500 Datasheet Version1.0.1
56 / 116
Operation ADC with interrupt
Figure 24 shows the flowchart of ADC operation with interrupt.
Operation is almost the same as the non-interrupt mode except polling INT bit to know when
enabling interrupt mask bit and conversion is completed.
START
ADC Power On
(PWD = 0)
Interrupt MASK enable
(MASK = 1)
Select Channel
(ADC_CHSEL)
ADC Start
(ADC_SRT)
Wait until
Interrupt occured
Read ADC conversion data
(ADC_DATA)
YES
ADC again?
NO
ADC Power off
(PWD = 1)
Figure 24. The ADC operation flowchart with interrupt
W7500 Datasheet Version1.0.1
57 / 116
18
Pulse-Width Modulation (PWM)
Introduction
The PWM consists a 8-channel 32-bit Timer/Counter driven by a programmable prescaler. The
function of the PWM is based on the basic Timer. Each timer and counter runs independently.
The PWM can be used to control the width of the pulse, formally the pulse duration, to generate
output waveform or to count the counter triggered by external input.
Features
Counter or Timer operation can use the peripheral clock, external clock source, or
one of the capture inputs as the clock source.
Eight independent 32-bit Timer/Counter driven by a programmable 6 bits prescaler
runs as the PWM or standard timer if the PWM mode is not enabled.
Eight PWM output waveforms.
Each of Timer/Counter can have different or same clock source.
Counter or timer operation.
Eight capture registers that can take the timer value when an external input signal.
A capture event can generate an interrupt signal optionally.
32-bit match register and limit register.
Channel 0 PWM output
Match Register 0 ~ 7
PWM 0
Channel 0
Dead Zone generator
Limit Register 0 ~ 7
Channel 1
Dead Zone generator
Channel 1 PWM output
Timer/Counter control
Register 0 ~ 7
Channel 2 PWM output
=
Channel 2
Dead Zone generator
Counter
Reset
Channel 3
Dead Zone generator
=
Timer
Counter 0 ~ 7
Channel 3 PWM output
Channel 4 PWM output
Capture
Register 0 ~ 7
Channel 4
Dead Zone generator
Channel 5
Dead Zone generator
Overflow
Overflow
Interrupt
Prescale
Counter 0 ~ 7
Capture
Interrupt
Prescale
Register 0 ~ 7
Match
Interrupt
Channel 5 PWM output
Channel 6 PWM output
PWM 2
PWM 3
PWM 4
PWM 5
PWM 6
Channel 6
Dead Zone generator
Channel 7
Dead Zone generator
Interrupt Register
PWM 1
Channel 7 PWM output
PWM 7
External input
Figure 25. PWM block diagram
W7500 Datasheet Version1.0.1
58 / 116
Functional description
Timer/Counter control
The PWM has Start/Stop register. It controls start or stop of the Timer/Counter. If you set this
register, the Timer/Counter starts to run. If you reset this register, the Timer/Counter stops
immediately. Also there is a pause register. The pause register is used to stop temporarily after
one period. Although you set this register while the Timer/Counter is running, the
Timer/Counter will stop when the period ends.
The registers of PWM can be updated when it stops or pauses. Users cannot update the
registers while PWM is running.
Timer/Counter
The PWM has 8 Timer/Counter clocks, which can be divided by a prescaler. Each Timer/Counter
runs independently. The Timer/Counter is designed to count cycles of the clocks or external
input signal and generate interrupts when specified timer values are occurred based on match
register and limit register. The Timer/Counter can count up or down.
The PWM has match registers and limit registers. The match registers control the duty cycle
of PWM output waveform. The limit registers control the period of the PWM output waveform.
The Timer/Counter becomes 0 when it reaches value of the limit register. If PDMR(Periodic
Mode Register) is set, the Timer/Counter counts repeatedly and if PDMR is reset, the
Timer/Counter stops counting.
Match register should be smaller than limit register(LR). If not, match interrupt is not occurred
and PWM output waveform is always 1.
Repetition mode
The Timer/Counter has two repetition mode: periodic and one-shot mode. In periodic mode,
the Timer/Counter recycles and then restarts when the Timer/Counter reaches the value of
limit register.
Figure 26 shows periodic mode timing diagram.
PWMCLK
Prescale
Counter
Timer/Counter
1
2
0
10
1
11
2
0
1
12
2
0
1
0
2
0
1
1
2
0
1
2
Overflow
Interrupt
Figure 26. Periodic mode
W7500 Datasheet Version1.0.1
59 / 116
2
In one-shot mode, the Timer/Counter resets to the initial value and then stops when the
Timer/Counter reaches the value of limit register. Figure 27 shows one-shot mode timing
diagram.
PWMCLK
Prescale
Counter
Timer/Counter
1
2
0
10
1
2
0
11
1
2
0
12
0
Overflow
Interrupt
Figure 27. one-shot mode
Counting mode
The Timer/Counter has two counting mode: Up-count and Down-count mode. In up-count
mode, the Timer/Counter counts up from 0 to the limit register value and then recycles. If
repetition mode is periodic, the Timer/Counter restarts and if repetition mode is one-shot
mode, the Timer/Counter stops. Figure 28 shows up-count mode timing diagram.
PWMCLK
Prescale
Counter
Timer/Counter
1
2
0
10
1
2
0
11
1
2
0
12
1
2
0
13
1
2
0
14
1
2
15
Figure 28. Up-count mode
In Down-count mode, the Timer/Counter counts from 0xFFFF_FFFF, then recycles. If repetition
mode is periodic, the Timer/Counter restarts and if repetition mode is one-shot mode, the
Timer/Counter stops. Figure 29 shows down-count mode timing diagram.
PWMCLK
Prescale
Counter
Timer/Counter
1
2
0
15
1
14
2
0
1
13
2
0
1
12
2
0
1
11
2
0
1
2
10
Figure 29. Down-count mode
Timer and Counter mode
The Timer/Counter can run in timer mode or counter mode. In timer mode, the Timer/Counter
is counted by PWMCLK after Prescale counter is overflowed. If prescale is set by 0, the
Timer/Counter counts every PWMCLK period. In counter mode, the Timer/Counter is counted
by external input signal. There are three counting method: rising edge, falling edge, and both
W7500 Datasheet Version1.0.1
60 / 116
edge. The counter mode has up-count or down-count mode and also has periodic or one-shot
mode. The external input pin and PWM output pin are the same, so PWM output is disabled in
counter mode.
Figure 30 is counter mode example with rising edge mode,
Figure 31 is with falling edge mode and
Figure 32 is with both rising and falling edge mode.
External
Input
Start/Stop
Register
Rising edge
detect
Timer/Counter
0
1
2
Figure 30 Counter mode with rising edge
External
Input
Start/Stop
Register
Falling edge
detect
0
Timer/Counter
1
2
Figure 31 Counter mode with falling edge
External
Input
Start/Stop
Register
Rising edge
detect
Falling edge
detect
Timer/Counter
0
1
2
3
4
Figure 32 Counter mode with rising and falling edge
W7500 Datasheet Version1.0.1
61 / 116
Prescaler description
The PWM has 6-bit prescale counter(PC) and the prescaler can divide the Timer/Counter clock
frequency. Users can control it by Prescale Register(PR).
Figure 33 and Figure 34 shows some examples of the Timer/Counter timing with prescale
register is 2, match register is 2, limit register is 12, timer mode, periodic mode, up-count
mode, and no interrupt clear.
PWMCLK
Start/Stop
Register
Prescale
Counter
0
1
2
0
1
0
Timer/Counter
2
0
1
1
2
0
2
1
2
0
1
3
2
4
Prescale Counter
Overflow
Match Interrupt
Interrupt
Register[2:0]
1
0
Figure 33 Timer/Counter timing diagram with match interrupt
PWMCLK
Start/Stop
Register
Prescale
Counter
1
Timer/Counter
10
2
0
1
2
11
0
1
12
2
0
1
0
2
0
1
2
1
0
1
2
Prescale Counter
Overflow
Overflow
Interrupt
Interrupt
Register[2:0]
1
3
Figure 34 Timer/Counter timing diagram with overflow interrupt
W7500 Datasheet Version1.0.1
62 / 116
2
PWM mode
Pulse Width Modulation mode generates a waveform with a period determined by the value of
limit register and a duty cycle determined by the value of the match register.
The PWM output becomes always 1 when the Timer/Counter starts to count. Then the PWM
output becomes 0 when the Timer/Counter reaches the value of match register. If the
Timer/Counter is in periodic mode, the PWM output becomes 1 again when the Timer/Counter
reaches the value of limit register. In one-shot mode, the PWM output does not change to 1
but stays 0 and the Timer/Counter stops.
The PWM mode can be selected independently on each channel(0~7) by PWM output enable
and external input enable register. The external input pin and PWM output pin are the same,
so external input is disabled in PWM mode.
Figure 35 is an example of the PWM output waveform when the Timer/Counter is reached to
the value of match register.
Figure 36 is example of the PWM output waveform when to the Timer/Counter is reached to
the value of limit register.
PWMCLK
Start/Stop
Register
0
Timer/Counter
1
2
3
4
PWM output
Match Interrupt
Match
register
3
Figure 35 The PWM output up to match register
W7500 Datasheet Version1.0.1
63 / 116
PWMCLK
Start/Stop
Register
Timer/Counter
3
4
5
6
7
0
PWM output
Overflow
Interrupt
Limit
register
7
Figure 36 The PWM output up to limit register
If match register is set as 0, the PWM output will be 1 while the Timer/Counter is 0.
If the match register is bigger than the limit register, the PWM output is always 1.
Interrupt
The PWM has 8-bit interrupt enable register(IER) and each bit of IER corresponds to each
interrupt of channel. Each PWM channel has Channel-n Interrupt Enable register(CHn_IER).
The CHn_IER includes three types of interrupt: match, overflow, and capture. The match
interrupt occurs when the Timer/Counter is reached to value of match register. The overflow
interrupt occurs when the Timer/Counter is reached to value of limit register. The capture
interrupt occurs when external input is entered for capture.
If interrupt occurs, corresponded bit of Channel-x interrupt register(CHn_IR) bit is set and
PWM channel-n interrupt signal is generated. All CHn_IR is cleared by channel-n interrupt clear
register(CHn_ICR) and then PWM channel-n interrupt signal is cleared.
Dead zone generation
Each PWM channel can output two complementary signals with dead zone time and it can be
enabled by Channel-n Dead Zone Enable Register(CHn_DZER). Only 4 channels can be enabled
because there are 8 PWM output pins. Channel 0 and 1 are a pair, channel 2 and 3 are a pair,
channel 4 and 5 are a pair, and channel 6 and 7 are a pair. If users want to use channel-0 dead
zone generation, channel-1 should be disabled. If channel 0 and 1 dead zone generation are
enabled both, all outputs are 0. In that case, users should choose 1 channel.
Dead zone time are generated by the value of Channel-n Dead Zone Counter Register(DZCR).
The dead zone counter counts up to value of DZCR. During the dead zone time, both
W7500 Datasheet Version1.0.1
64 / 116
complementary signals are both 0. Users have to adjust the signal depending on the devices
that are connected to the outputs and their characteristics. If DZCR is bigger than the limit
register, main output signal is toggled 0 to1 and then 1 to 0 while 1 PWMCLK and inverted
output signal is always 0.
Figure 37 shows two complementary PWM outputs with dead zone time. During dead zone time,
both outputs are 0.Figure 38 shows a more detailed timing with dead zone counter. The dead
zone counter and the Timer/Counter starts to count together and PWM output is 0 until dead
zone counter is reached to value of dead zone counter register. The PWM output becomes 1
and 0 when the Timer/Counter is reached to value of match register. The inverted PWM output
is also 0 until dead zone counter is reached to value of dead zone counter register. Then
inverted PWM output becomes 1 after dead zone counter is reached to the value of dead zone
counter register.
PWM
output
Inverted PWM
output
Dead zone
time
Dead zone
time
Dead zone
time
Dead zone
time
Dead zone
time
Figure 37 PWM waveform with dead zone time
PWMCLK
Start/Stop
Register
Dead zone
Counter
Timer/Counter
0
1
2
3
0
0
1
2
3
4
1
2
5
3
6
11
PWM
output
Inverted PWM
output
Dead zone
counter register
3
Match
register
4
Figure 38 PWM waveform with dead zone counter
W7500 Datasheet Version1.0.1
65 / 116
Capture event
Each PWM channel can capture its Timer/Counter value when an external input signal changes.
Any channel could use any method of rising or falling edges. If capture interrupt is enabled,
capture interrupt occurs when the external input signal is toggled. The Timer/Counter value
is saved in Channel-n Capture Register(CHn_CR) and the capture register is not overwritten
until capture interrupt is cleared. Figure 39 shows the capture event timing diagram. There is
no interrupt clear, so second capture does not save during second rising edge detection.
External
Input
Rising edge
detect
10
Timer/Counter
11
12
13
14
Capture Interrupt
Capture
register
0
10
0
4
Capture Interrupt
clear
Interrupt
Register[2:0]
Figure 39 Capture event with no interrupt clear
Figure 40 shows, the capture event timing diagram with interrupt clear. The second capture
is saved at the second rising edge detection because there is interrupt clear.
External
Input
Rising edge
detect
10
Timer/Counter
11
12
13
14
Capture Interrupt
0
10
13
Capture Interrupt
clear
0
4
0
4
Figure 40 Capture event with interrupt clear
W7500 Datasheet Version1.0.1
66 / 116
How to set the PWM
Figure 41 shows the PWM setting flow step by step.
Set the registers:
CHn_PR, CHn_MR,
CHn_LR, CHn_UDMR,
CHn_PDMR
Timer
Counter
Timer or Counter
mode?
CHn_TCMR[1:0] =
01 / Rising edge
10 / Falling edge
11 / both edge
CHn_TCMR[1:0] =
00 / Timer mode
CHn_PEEER[1:0] =
01 / PWM output disable
Yes
and external input enable
No
PWM output?
CHn_PEEER[1:0] =
Yes
10 / PWM output enable
and external input disable
Capture?
CHn_PEEER[1:0] =
01 / PWM output disable
CHn_PEEER[1:0] =
00, 11 / PWM output disable
and external input enable
Yes
Dead zone
generation?
CHn_DZER =
1 / Dead zone enable
No
and external input disable
No
CHn_DZER =
0 / Dead zone disable
Falling
edge
CHn_CMR =
0 / rising edge capture
Capture mode?
Rising
edge
CHn_CMR =
1 / falling edge capture
Set the register:
CHn_DZER
Figure 41. The PWM setting flow
W7500 Datasheet Version1.0.1
67 / 116
19
Dual timers
Introduction
The dual timer consists two programmable 32-bit or 16-bit Free-running counters(FRCs) that
can generate interrupts when they reach 0. There are two dual timers and 4 FRCs. One dual
timers has one interrupt handler, resulting in two interrupts of timers. Also one dual timer has
one clock but two clock enable signals. Users can select one repetition modes one-shot or
wrapping mode, and wrapping mode consists free-running and periodic mode. Two FRCs are
one set so two FRCs has one clock, reset, and interrupt but each FRC has an individual clock
enable.
Features
One dual timer has two Free-Running Counters(FRCs).
One dual timer has one interrupt handler and one clock.
One dual timer has two clock enable signals.
There are 2 dual timers.
A 32-bit or a 16-bit down counter.
One of the following repetition modes: one-shot and wrapping mode.
One of the following wrapping modes: Free-running and periodic mode.
There is a prescaler that can divide down the clock rate by 1, 16, or 256.
Control
Load
Load
BG Load
BG Load
Value
Control
IntClear
RIS
MIS
Value
Prescale counter
16-bit or 32-bit
Counter
0x0000_0000
Clear
Interrupt
Interrupt Register
Interrupt
=
Figure 42 Block diagram of Dualtimer
W7500 Datasheet Version1.0.1
68 / 116
Functional description
Clock and clock enable
The dual timers contain PCLK and TIMERCLK clock inputs. PCLK is the main APB system clock
and is used by the register interface. TIMERCLK is the input to the prescale units and the
decrementing counters. PCLK and TIMERCLK are synchronous.
The dual timers consist two programmable 32-bit Free-Running Counters(FRC) which operate
independently. The two timers operate from one TIMERCLK but Each FRC is controlled
independently by individual clock enable.
Timer size
Users can select FRC as 16-bit or 32-bit using the control register.
Prescaler
The timer has a prescaler that can divide down the enabled clock rate by 1, 16 or 256.
Repetition mode
There are two repetition mode: one-shot and wrapping mode. Wrapping mode has two modes:
free-running and periodic mode.
One-shot mode
The counter generates an interrupt once. When the counter reaches 0, it halts until
users reprogram it. Users can do this as below:
Clear the one-shot count bit in the control register, in which case the count
proceeds according to the selection of wrapping mode(free-running or
periodic mode).
Write a new value to the Load Value register.
Wrapping mode
Free-running mode
The counter wraps after reaching its zero value, and continues to count down from
the maximum value. This is the default mode.
Periodic mode
The counter generates an interrupt at a constant interval, reloading the original value
after wrapping past zero.
W7500 Datasheet Version1.0.1
69 / 116
Interrupt
An interrupt is generated when the counter reaches 0 and is only cleared when the interrupt
clear register is accessed.
The register holds the value until the interrupt is cleared.
Users can mask interrupts by writing 0 to the Interrupt Enable bit in the control register. Users
can read the following from status registers:
Raw interrupt status before masking.
Final interrupt status after masking.
The interrupts from the individual timers after masking are logically ORed into a combined
interrupt.
Operation
The operation of each timer is identical. The timer is loaded by writing to the load register
and counts down to 0 if enabled. When a counter is already running, writing to the load register
causes the counter to immediately restart at the new value. Writing to the background load
value has no effect on the current count. In periodic mode, the counter continues to decrease
to 0 and restart from the new load value.
An interrupt is generated when 0 is reached. Users can clear the interrupt by writing to the
clear register. If users select one-shot mode, the counter halts when it reaches 0 until users
deselect one-shot mode or write a new load value.
Otherwise, after reaching a zero count, if the timer is operating in free-running mode, it
continues to decrease from its maximum value. If users select periodic mode, the timer
reloads the count value from the load register and continues to decrease. In this mode, the
counter effectively generates a periodic interrupt.
W7500 Datasheet Version1.0.1
70 / 116
How to set the dual timers
Set the clock enable
Set the Load register
Timer size :
16-bit or 32-bit
16-bit : TimerControl[1] = 0
32-bit : TimerControl[1] = 1
Prescale :
1, 16, or 256
1 : TimerControl[3:2] = 0
16 : TimerControl[3:2] = 1
256 : TimerControl[3:2] = 2
Interrupt :
enable or disable
Disable : TimerControl[5] = 0
Ensable : TimerControl[5] = 1
One-shot count mode
Repetition mode :
Wrapping or one-shot
One-shot mode
Wrapping mode
TimerControl[0] =0
TimerControl[0] = 1
Wrapping mode :
Free-running or
Periodic mode
Free-running mode
Periodic mode
TimerControl[0] =0
TimerControl[0] =1
Figure 43 The Dual timer setting flow
W7500 Datasheet Version1.0.1
71 / 116
20
Watchdog timer
20.1
Introduction
The watchdog is based on a 32-bit down-counter that is initialized from the Reload Register,
WDTLoad. The watchdog generates a regular interrupt depending on a programmed value. The
counter decreases by one on each positive clock edge of watchdog clock.
The watchdog monitors the interrupt and asserts a reset request signal when the counter
reaches 0 and the counter is stopped. On the next enabled watchdog clock edge, the counter
is reloaded from the WDTLoad Register and the countdown sequence continues. The watchdog
reasserts the reset signal if the interrupt is not cleared by the time the counter next reaches
0.
The watchdog applies a reset to a system in the event of a software failure to provide a way
to recover from software crashes. Users can enable or disable the watchdog unit as required.
20.2
Features
-
32-bit down counter.
-
Internally resets chip if not periodically reloaded.
-
The watchdog timer has lock register for to prevent rogue software from disabling the
watchdog timer functionality.
-
20.3
The watchdog timer clock(WDTCLK) and system clock(PCLK) are synchronous.
Functional description
Clock
The watchdog timer contains PCLK and WDTCLK clock inputs.
PCLK is the main APB system clock and is used by the register interface.
Interrupt and reset request
An interrupt is generated when the counter reaches 0 and is only cleared when the
interrupt clear register is accessed.
The register holds the value until the interrupt is cleared.
Reset request is asserted when the counter reaches 0 repeatedly and is not
reprogrammed.
W7500 Datasheet Version1.0.1
72 / 116
Users can mask interrupts by writing 0 to the Interrupt Enable bit in the control register.
Users can read the following from status registers:
-
Raw interrupt status, before masking.
-
Final interrupt status, after masking.
Counter reloaded
and count down
without reprotram
Count down
without reprogram
Watchdog timer is
programmed
Counter reaches zero
Counter reaches zero
If the interrupt enable bit in the
WDTControl register is set to 1,
interrupt is asserted.
If the reset enable bit in the
WDTControl register is set to 1, reset
request signal is asserted.
Figure 44. Watchdog timer operation flow diagram
21
Inter-integrated circuit interface (I2C)
Introduction
The 𝐼 2 𝐶 (inter-integrated circuit) bus interface handles communications between the
microcontroller and the serial 𝐼 2 𝐶 bus. It supports standard speed mode(100Kbps).
Features
•
Use APB interface
•
Supports Slave and Master Mode
•
Standard mode (up to 100 KHz)
•
Supports 7 bit Slave address mode
•
Start/Stop/Repeated Start detection
•
Start/Stop/Repeated Start/Acknowledge generation
•
Control the Read/Write operation
•
General Call enable or disable
•
Slave busy detection
•
Repeated START
Functional description
𝐼 2 𝐶 is comprised of both master and slave functions. For proper operation, the SDA and SCL
pins must be configured as open-drain signals. A 𝐼 2 𝐶 bus configuration is shown in Figure 45.
W7500 Datasheet Version1.0.1
73 / 116
RPUP
RPUP
SCL
I2C Bus
SDA
Figure 45. I2C Bus Configuration
Figure 46 shows the I2C block diagram.
In addition to receiving and transmitting data, this interface converts it from serial to parallel
format and vice versa. The interrupt is enabled or disabled by software. The interface is
connected to the 𝐼 2 𝐶 bus by a data pin (SDA) and by a Clock pin (SCL). It can be connected
with a standard (up to 100 KHz) 𝐼 2 𝐶 bus.
I2C
APB
interface
SDA_OEn
DATA
Register
Block
Prescale
I2C clk
generator
I2C
Core
I2C clk
SCL_OEn
I2C Interrupt
PCLK
Figure 46. I2C block diagram
SDA is the bi- directions serial data line and SCL is the bi-directions serial clock line. The bus
is considered idle when both lines are high. Every transaction on the 𝐼 2 𝐶 bus is nine bits long,
consisting of eight data bits and a single acknowledge bit and data must be transferred MSB
first.
Data validity
The data on the SDA line must be stable during the HIGH period of the SCL. The HIGH or LOW
state of the data line can only change when the clock signal on the SCL line is LOW (Figure 47).
One clock pulse is generated for each data bit transferred.
W7500 Datasheet Version1.0.1
74 / 116
SDA
SCL
Data line
Stable
Change of
data allowed
Figure 47. Data Validity
Acknowledge
All bus transactions have a required acknowledge clock cycle that is generated by the master.
During the acknowledge cycle, the transmitter cannot operate the next operation.
Bit Command Controller
The Bit command Controller handles the actual transmission of data and the generation of the
specific levels for START, STOP and Repeated START signals by controlling the SCL and SDA lines.
The Byte Command controller tells the Bit command Controller which operation has to be
performed. For a single byte read, the Bit command Controller receives 8 separate read
command. Each bit-operation is divided into 5 pieces (idle and A,B,C,and D) except for a STOP
operation which is divided into 4 pieces(idle and A, B,C)
Start
SDA
A B C D
SCL
Rep Start SDA
SCL
Stop
Write
Read
SDA
SCL
SDA
SCL
SDA
SCL
Figure 48. Bit Conditions
W7500 Datasheet Version1.0.1
75 / 116
21.3.3.1 START and STOP Conditions
The protocol of the 𝐼 2 𝐶 bus defines two states to START and STOP conditions.
A High to Low transition on the SDA line while SCL is High is one unique case and indicates a
START condition. A Low to High transition on the SDA line while SCL is high defines a STOP
condition.
SDA
SDA
SCL
SCL
S
P
START Condition
STOP Condition
Figure 49. START and STOP Conditions
START and STOP conditions are always generated by the master.
This bus is considered to be again a certain time after the STOP condition. The bus stays busy
if a Repeated START is generated instead of a STOP condition.
21.3.3.2 RESTART Condition
SDA
SDA
SCL
SCL
S
P
RES
RESTART Condition
Figure 50. RESTART Condition
Slave address
The SDA line must be eight bits long.
Each byte must be followed by an Acknowledge bit.
S
Slave Address
7bits
r/w
A
Data
A
NA
P
Figure 51. 7-bit Slave address
W7500 Datasheet Version1.0.1
76 / 116
Read/Write bit
This address is seven bits followed by an eight bit which is a data direction bit(R/W) :
‘0’ indicates a WRITE, ‘1’ indicates a READ
There are two methods of setting data direction bit by I2Cx_CTR.
The 32-bits I2Cx_CTR is reconfigured with COREEN, INTEREN, MODE, ADDR10, CTRRWN, CTREN.
CTREN bit select the R/W – a ‘Zero’ indicates the slave address bit 0, a ‘one’ indicates a
CTRRWN bit.
Acknowledge(ACK) and Not Acknowledge(NACK)
The acknowledge bit takes place after every bytes. The acknowledge bit allows the receiver
to signal the transmitter that the byte was successfully received and another byte may be sent.
The master generates all clock pulses, including acknowledge ninth clock.
Data transfer
The data transfer is managed through the shift, transmit data, and receive data registers.
Data transfers follow the format shown in Figure 52. After START condition, a Slave address is
transmitted. If CTREN bit in the I2Cx_CTR register is enable, LSB of Slave address (bit 0) is
superseded by value of CTRRWN bit in the I2Cx_CTR register.
If CTREN bit in the I2Cx_CTR register is disable, LSB of slave address is used for Read/Write
operation.
Slave addr
rw
SDA
A
C
K
Data
A
C
K
Data
A
C
K
SCL
P
S
Figure 52. Complete Data Transfer with a 7-bit slave address
Operating Modes
The interface can operate in one of four following:
Master Transmitter Mode
Master Receiver Mode
Slave Transmitter Mode
Slave Receiver Mode
W7500 Datasheet Version1.0.1
77 / 116
By default, it operates in slave mode. The interface switches from slave to master when it
generates the mode bit in the I2Cx_CTR. And COREEN bit in the I2Cx_CTR must be switched
from 1 to 0.
In Master mode
Master Transmitter Mode:
In this mode, data is transmitted from master to slave before the master transmitter mode
can be entered and I2Cx_CTR must be initialized
Master Receiver Mode:
In this mode, data is received from slave to master before the master receive mode can be
entered and I2Cx_CTR must be initialized
In Slave mode
Slave Transmitter Mode:
In this mode, data is transmitted from slave to master and setting of I2Cx_SADDR must be
done.
Slave Receiver Mode:
In this mode, data is received from master to slave before the master transmitter mode can
be entered and setting of I2Cx_SADDR must be done.
Interrupts
The 𝐼 2 𝐶 can generate interrupt when the following conditions are observed:
Start conditions on bus detected
Stop conditions on bus detected
Timeout error
Master transaction completed
Slave transaction received
𝐼 2 𝐶 bus have separate interrupt signals.
W7500 Datasheet Version1.0.1
78 / 116
Master mode
21.3.10.1
Initialization
Figure 53 shows the command sequences available for the 𝐼 2 𝐶 master.
initial setting
Enable interrupts and/or in I2Cx_CTR
CORE_EN in I2Cx_CTR =1
ADDR10 in I2Cx_CTR =0
CTEN in I2Cx_CTR =1?
CTRW in I2Cx_CTR =1?
CTEN in I2Cx_CTR =1?
CTRW in I2Cx_CTR =0?
CTEN in I2Cx_CTR =0
CTR_WRITE
CTR_READ
depending on bit 0 of first byte
MO DE in I2Cx_CTR =1
clear CORE_EN in I2Cx_CTR =1
Set I2Cx_PRE / I2Cx_TO
Initia l E nd
Figure 53. I2C initial setting
W7500 Datasheet Version1.0.1
79 / 116
Figure 54 shows the master operation using a 7-bit slave address.
Master
Transmisson
initial setting
CTEN in I2Cx_CTR
=1?
YES
NO
I2Cx_TR = {Slave Addr[7:1] ,READ or
WRITE}
I2Cx_TR = Slave Addr[7:0]
STA/ACK in I2Cx_CMD = 1
NO
ACK in I2Cx_SR
=1?
YES
NO
ACK in I2Cx_SR
=0?
YES
Write I2Cx_TR
NO
ACK in I2Cx_SR
=1?
YES
NO
ACK in I2Cx_SR
=0?
YES
End
Figure 54. Master TRANSMIT with ADDR10=0 in the I2Cx_CTR
W7500 Datasheet Version1.0.1
80 / 116
Figure 55 shows the operation of repeated START.
The repeated START operates for data read operation execution.
The operation sequences are Slave address, send data, repeated START, and send data.
Master
Transmisson
initial setting
CTEN in I2Cx_CTR
=1?
CTEN in I2Cx_CTR
=1?
YES
YES
NO
I2Cx_TR = {Slave Addr[7:1] ,READ or
WRITE}
I2Cx_TR = Slave Addr[7:0]
ReStart
RESTA in I2Cx_CMD=1
NO
I2Cx_TR = {Slave Addr[7:1] ,READ or
WRITE}
I2Cx_TR = Slave Addr[7:0]
NO
STA/ACK in I2Cx_CMD = 1
ACK in I2Cx_SR
=1?
NO
YES
ACK in I2Cx_SR
=1?
NO
ACK in I2Cx_SR
=0?
YES
NO
ACK in I2Cx_SR
=0?
YES
clear RESTA in I2Cx_CMD =1
YES
NO
Write I2Cx_TR
BT in I2Cx_SR
=0?
NO
YES
ACK in I2Cx_SR
=1?
End
YES
NO
ACK in I2Cx_SR
=0?
YES
Figure 55. Master Transmit with Repeated START
W7500 Datasheet Version1.0.1
81 / 116
Slave mode
Figure 56 shows the command sequences available for the 𝐼 2 𝐶 slave.
Slave
initialization
Set I2Cx_SADDR
NO
I2CxSADDR = Data?
YES
Send Ack
YES
I2CxSADDR[0] =1?
NO
Transmit Data
Receive Data
Receive Ack
Send Ack
STOE in I2Cx_ISR
=1?
NO
YES
End
Figure 56. Slave Command Sequence
W7500 Datasheet Version1.0.1
82 / 116
22
UART(Universal Asynchronous Receive Transmit)
Introduction
The
UART supports
synchronous
one-way
communication,
half-duplex
single
wire
communication, and multiprocessor communications(CTS/RTS).
Features
-
Serial-to-parallel conversion on data received from a peripheral device
-
Parallel-to-serial conversion on data transmitted to the peripheral device
-
Data size of 5,6,7 and 8 its
-
One or two stop bits
-
Even, odd, stick, or no-parity bit generation and detection
-
Support of hardware flow control
-
Programmable FIFO disabling for 1-byte depth.
-
Programmable use of UART or IrDA SIR input/output
-
False start bit detection
Functional description
UART bidirectional communication requires a minimum of two pins: RX, TX
The frame are comprised of:
An Idle Line prior to transmission or reception
A baud rate register (UART1_IBRD,UART1_FBRD)
A start bit
A data word (8 or 9 bits) least significant bit first
1, 1.5, 2 Stop bits indicating that the frame is complete
The USART interface uses a baud rate generator
A status register (UART1_RISR)
data registers (UART1DR)
W7500 Datasheet Version1.0.1
83 / 116
UART
Read data[11:0]
Write data[7:0]
32x8
transmit
FIFO
APB interface
Register
Block
txd[7:0]
rxd[11:0]
Control and Status
Transmitter
Baud rate divisor
Baud rate
generator
Baud16
Receiver
Transmit
FIFO
status
FIFO flags
UARTCLK
nUARTRI
nUARTDSR
UARTMSINTR
UARTRTINTR
UARTRXD
nUARTCTS
UARTRXINTR
Interrupt
Control &
Status
UARTTXD
Receive
FIFO
status
UARTTXINTR
UARTn Interrupt
32x12
receive
FIFO
FIFO status and Interrupt
UARTEINTR
nUARTDCD
nUARTDTR
nUARTRTS
UARTINTR
nUARTOut1
nUARTOut2
Figure 57 UART0,1 Block diagram
Figure 58 shows the UART character frame
LSB
1
0
n
MSB
1-2
Stop bits
5-8 data bits
Start
Parity bit,
if enabled
Figure 58 UART character frame
W7500 Datasheet Version1.0.1
84 / 116
Baud rate calculation
UARTx can operate with or without using the Fractional Divider. The baud rate divisor is a 22bit number consisting the UARTxIBRD(16-bit integer) and the UARTxFBRD(6-bit fractional).
This is used by the baud rate generator to determine the bit period.
-
Baud Rate Divisor =
UARTCLK
(16∗𝑏𝑎𝑢𝑑 𝑟𝑎𝑡𝑒)
= 𝐵𝑅𝐷𝐼 + 𝐵𝑅𝐷𝐹
Calculating UART
baudrate (BR)
PCLK,
BR
DL = PCLK/(16 *BR)
UARTxIBRD = Dlinteger
UARTxFBRD = ((DLfloat – DLinteger)*64 +0.5)
END
Figure 59 UART divider flow chart
Figure 60 shows how to set the UART Initial value.
Initia l setting Start
Setting UART baudra te
Set UARTxLCR_H
(Word length/Stop bit/Parity)
Set UARTxCR
(Mode/Hardwa reFlowControl)
END
Figure 60 UART Initial setting flow chart
W7500 Datasheet Version1.0.1
85 / 116
Data transmission
Data transmitted is stored in a 32-byte FIFOs. Transmit data is written into the transmit FIFO
for transmission. If UART is enabled, it causes a data frame to start transmitting with
parameters indicated in the UARTxLCR_H.
Data continues to transmit until there is no data left in the transmit FIFO. The BUSY bit of
UARTxFR is ‘1’ as soon as data is written to the transmit FIFO, which means the FIFO is not
empty, and remains as ‘1’ while data is being transmitted.
Data receive
Received data is stored in the 32-byte FIFOs. When a start bit has been received, it begins
running and data is sampled on the eighth cycle of that counter in UART mode. A valid stop
bit is confirmed if UARTRXD is ‘1’. When a full word is received, the data is stored in the
receive FIFO. Error bit is stored in bit[10:8] of UARTxCR and overrun is stored in bit[11] of
UARTxCR.
Initia l setting
Set RTS/CTS of UARTxCR
Set FEN of UARTxLCR_H
Set RxSel/TxSel of UARTxIFLS
RX
TX
Send Tx da ta
receive Rx da ta
END
Figure 61 Transmit and Receive data flow chart
W7500 Datasheet Version1.0.1
86 / 116
Hardware flow control
UARTx
RX FIFO
and
flow control
TX FIFO
and
flow control
nUARTRTS
nUARTRTS
nUARTCTS
nUARTCTS
another UARTx
RX FIFO
and
flow control
TX FIFO
and
flow control
Figure 62 Hardware flow control description
The RTS flow control is enabled by setting the RTSen of UARTxCR. If RTS is enabled, the data
flow is controlled as follows.
When the receiver FIFO level reaches the programmed trigger level, nUARTRTS(pin) is
asserted(to a high value). nUARTRTS is reasserted(to a low level) once the receiver FIFO has
reached the previous trigger level. The reasserted of nUARTRTS signals to the sending UART to
continue transmitting data.
The CTS flow control is enabled, the transmitter can only transmit data when nUARTCTS is
asserted. When nUARTCTR is de-asserted(to a low) the transmitter sends the next byte. To
stop the transmitter from sending the following byte, nUARTCTS must be released before the
middle of the last stop bit that is currently being sent.
UARTx_TX
start
bit0..7
stop
start
bits0..7
stop
start bits0..7 stop
nUARTCTS
Figure 63 CTS Functional Timing
W7500 Datasheet Version1.0.1
87 / 116
Figure 64 shows how software should use the RTS/CTR.
Initia l setting
Set RTS/CTS of UARTxCR
Set FEN of UARTxLCR_H
Set RxSel/TxSel of UARTxIFLS
RX
TX
CTS of UARTxFR =0?
RXFE of UARTxFR =0?
Yes
Yes
Send Tx da ta
receive Rx da ta
Yes
BUSY of UARTxFR =1?
No
No
END
No
Figure 64 Algorithm for setting CTS/RTS flowchart
W7500 Datasheet Version1.0.1
88 / 116
23
Synchronous Serial Port (SSP)
Introduction
The SSP block is an IP provided by ARM (PL022 “PrimeCell® Synchronous Serial Port”).
Additional details about its functional blocks may be found in “ARM PrimeCell® Synchronous
Serial Port (PL022) Technical Reference Manual”.
Features
•
The SSP is a master or slave interface that enables synchronous serial communication with
slave or master peripherals having one of the following:
•
A MOTOROLA SPI-compatible interface
A TEXAS INSTRUMENTS synchronous serial interface
A National Semiconductor MICROWIRE® interface.
The SPI interface operates as a master or slave interface. It supports bit rates up to 2 MHz
and higher in both master and slave configurations. The SPI has the following features:
Parallel-to-serial conversion on data written to an internal 16-bit wide, 8location deep transmit FIFO
Serial-to-parallel conversion on received data, buffering it in a 16-bit wide, 8location deep receive FIFO
Programmable data frame size from 4 to 16 bits
Programmable clock bit rate and prescaler. The input clock may be divided by a
factor of 2 to 254 in steps of two to provide the serial output clock
Programmable clock phase and polarity.
W7500 Datasheet Version1.0.1
89 / 116
Functional description
Figure 65 shows the SSP block diagram.
SSPTXINTR
TxFIFO
APB
FIFO Status
and
Interrupt
Generation
Bus
Interface
RxFIFO
SSPINTR
SSPRXINTR
SSPCLK
SSPTXD
Register
block
DMA
signals
Prescale
value
Clock
Prescaler
SSPCLKDIV
Transmit
and
Receive
logic
SSPCLKOUT
SSPCLKIN
SSPRXD
DMA
interface
Figure 65. SSP block diagram
Clock prescaler
When configured as a master, an internal prescaler is used to provide the serial output clock.
The prescaler may be programmed through the SSPCPSR register to divide the SSPCLK by a
factor of 2 to 254 in two steps. As the least significant bit of the SSPCPSR register is not used,
division by an odd number is impossible and this ensures a symmetrical (equal mark space
ratio) clock is generated.
The output of this prescaler is further divided by a factor 1 to 256 through the programming
of the SSPCR0 control register, to give a final master output clock.
Transmit FIFO
The common transmit FIFO is a 16-bit wide, 8-locations deep, First-In, First-Out (FIFO) memory
buffer. CPU data written across the AMBA APB interface are stored in the buffer until it is read
out by the transmit logic.
When configured as a master or a slave, parallel data is written into the transmit FIFO prior
to serial conversion and is transmitted to the attached slave or master through the SSPTXD
pin.
W7500 Datasheet Version1.0.1
90 / 116
Receive FIFO
The common receive FIFO is a 16-bit wide, 8-locations deep, first-in, first-out memory buffer.
Received data from the serial interface are stored in the buffer until it is read out by the CPU
across the AMBA APB interface.
When configured as a master or slave, serial data received through the SSPRXD pin is registered
prior to parallel loading into the attached slave or master receive FIFO.
Interrupt generation logic
The PrimeCell SSP generates four individual maskable, active-HIGH interrupts. A combined
interrupt output is also generated as an OR function of the individual interrupt requests.
Users can use the single combined interrupt with a system interrupt controller that provides
another level of masking on a per-peripheral basis. This enables use of modular device drivers
that always know where to find the interrupt source control register bits.
Users can also use the individual interrupt requests with a system interrupt controller that
provides masking for the outputs of each peripheral. In this way, a global interrupt controller
service routine can read the entire set of sources from one wide register in the system
interrupt controller. This is attractive when the time to read from the peripheral registers is
significant compared to the CPU clock speed in a real-time system.
The peripheral supports both methods above.
The transmit and receive dynamic data-flow interrupts, SSPTXINTR and SSPRXINTR, are
separated from the status interrupts so that data can be read or written in response to the
FIFO trigger levels.
DMA interface
The PrimeCell SSP provides an interface to connect to the DMA controller. The PrimeCell SSP
DMA control register, SSPDMACR controls the DMA operation of the PrimeCell SSP.
Receive – The DMA interface includes the following signals for receive:
-
SSPRXDMASREQ
Single-character DMA transfer request asserted by the SSP. This signal is
asserted when the receive FIFO contains at least one character.
-
SSPRXDMABREQ
W7500 Datasheet Version1.0.1
91 / 116
Burst DMA transfer request, asserted by the SSP. This signal is asserted when
the receive FIFO contains four or more characters.
-
SSPRXDMACLR
DMA request clear asserted by the DMA controller to clear the receive request
signals. If DMA burst transfer is requested, the clear signal is asserted during
the transfer of the last data in the burst.
Transmit – The DMA interface includes the following signals for transmit:
-
SSPTXDMASREQ
Single-character DMA transfer request asserted by the SSP. This signal is
asserted when there is at least one empty location in the transmit FIFO.
-
SSPTXDMABREQ
Burst DMA transfer request asserted by the SSP. This signal is asserted when
the transmit FIFO contains four characters or fewer.
-
SSPTXDMACLR
DMA request clear asserted by the DMA controller to clear the transmit
request signals. If a DMA burst transfer is requested, the clear signal is
asserted during the transfer of the last data in the burst.
The burst transfer and single transfer request signals are not mutually exclusive. They can
both be asserted at the same time. For example, when there is more data than the watermark
level of four in the receive FIFO, the burst transfer request and the single transfer request are
asserted.
When the amount of data left in the receive FIFO is less than the watermark level, the single
request only is asserted. This is useful for situations when the number of characters left to be
received in the stream is less than a burst.
For example, if 19 characters must be received, the DMA controller then transfers four bursts
of four characters and three single transfers to complete the stream.
The PrimeCell SSP does not assert the burst request for the remaining three characters.
Each request signal remains asserted until the relevant DMA clear signal is asserted. After the
request clear signal is de-asserted, a request signal can become active again depending on the
conditions that previous sections describe. All request signals are de-asserted if the PrimeCell
SSP is disabled or the DMA enable signal is cleared.
Table 10 shows the trigger points for DMABREQ of both the transmit and receive FIFOs.
Table 10 DMA trigger points for the transmit and receive FIFOs.
Burst length
W7500 Datasheet Version1.0.1
92 / 116
Watermark
Transmit, number of empty locations
Receive, number of filled locations
4
4
level
1/2
Figure 66 shows the timing diagram for both a single transfer request and a burst transfer
request with the appropriate DMA clear signal. The signals are all synchronous to PCLK.
PCLK
DMASREQ
DMABREQ
DMACLR
Figure 66. DMA transfer waveforms
Interface reset
The PrimeCell SSP is reset by the global reset signal PRESETn and a block-specific reset signal
nSSPRST. An external reset controller must use PRESETn to assert nSSPRST asynchronously and
negate it synchronously to SSPCLK. PRESETn must be asserted LOW for a period long enough
to reset the slowest block in the on-chip system, and then taken HIGH again. The PrimeCell
SSP requires PRESETn to be asserted LOW for at least one period of PCLK.
Configuring the SSP
The Following reset, the PrimeCell SSP logic is disabled and must be configured when in this
state.
It is necessary to program control registers SSPCR0 and SSPCR1 to configure the peripheral as
a master or slave operating under one of the following protocols:
• Motorola SPI
• Texas Instruments SSI
• National Semiconductor.
The bit rate derived from the external SSPCLK requires the programming of the clock prescale
register SSPCPSR.
W7500 Datasheet Version1.0.1
93 / 116
Enable PrimeCell SSP operation
You can either prime the transmit FIFO, by writing up to eight 16-bit values when the PrimeCell
SSP is disabled, or permit the transmit FIFO service request to interrupt the CPU. Once enabled,
transmission or reception of data begins on the transmit, SSPTXD, and receive, SSPRXD, pins.
Clock ratios
There is a constraint on the ratio of the frequencies of PCLK to SSPCLK. The frequency of
SSPCLK must be less or equal to that of PCLK. This ensures that control signals from the SSPCLK
domain to the PCLK domain are guaranteed to get synchronized before one frame duration:
FSSPCLK 2 x FSSPCLKOUT(max), for master mode
W7500 Datasheet Version1.0.1
94 / 116
FSSPCLK(min) => 12 x FSSPCLKIN(max), for slave mode.
The maximum frequency of SSPCLK is calculated by the following equations, both of which
must be satisfied:
FSSPCLK(max)