Bluetooth Low Energy 4.2 Soc General Description: Final
Bluetooth Low Energy 4.2 Soc General Description: Final
Bluetooth Low Energy 4.2 Soc General Description: Final
Contents
General Description . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 11.4 GENERAL CLOCK CONSTRAINTS . . . . . . . 32
21 Input/Output Ports. . . . . . . . . . . . . . . . . . . . . . . . . 63
21.1 PROGRAMMABLE PIN ASSIGNMENT . . . . 63
21.2 GENERAL PURPOSE PORT REGISTERS . 63
21.2.1 Port Data Register . . . . . . . . . . . . . . . . 64
21.2.2 Port Set Data Output Register . . . . . . . 64
21.2.3 Port Reset Data Output Register . . . . . 64
21.3 FIXED ASSIGNMENT FUNCTIONALITY . . . 64
23 Power Management. . . . . . . . . . . . . . . . . . . . . . . . 69
24 BLE Core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
24.1 EXCHANGE MEMORY . . . . . . . . . . . . . . . . . 72
24.2 PROGRAMMING BLE WAKE UP IRQ . . . . . 74
24.3 SWITCH FROM ACTIVE MODE TO DEEP
SLEEP MODE . . . . . . . . . . . . . . . . . . . . . . . . . 74
24.4 SWITCH FROM DEEP SLEEP MODE TO AC-
TIVE MODE. . . . . . . . . . . . . . . . . . . . . . . . . . . 75
24.4.1 Switching at Anchor Points . . . . . . . . . 75
24.4.2 Switching Due to an External Event . . 77
25 Radio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
25.1 RECEIVER . . . . . . . . . . . . . . . . . . . . . . . . . . 78
25.2 SYNTHESIZER . . . . . . . . . . . . . . . . . . . . . . . 78
25.3 TRANSMITTER . . . . . . . . . . . . . . . . . . . . . . . 78
25.4 RFIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
25.5 BIASING . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
25.6 CONTROL . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
26 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
27 Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
1 Block Diagram
24 April 2012
DCDC
ARM Cortex M0 RC RC RCX
(BUCK/BOOST)
XTAL XTAL 16 MHz 32 kHz
32.768 kHz 16 MHz LDO LDO LDO
LDO
LDO
CORE SYS RET SYS
SYS
RF POReset
BLE Core
SWD (JTAG)
Radio
LINK LAYER
System/ AES-128 Transceiver
HARDWARE
Exchange
RAM
42 kB
Ret. RAM
Memory Controller
2 kB
APB bridge
Ret. RAM2
3 kB
Ret. RAM3
2 kB
Ret. RAM4 SW TIMER
Management (PMU)
KEYBOARD
DECODER
1 kB
POWER/CLOCK
WAKE UP
GP ADC
UART2
TIMER
QUAD
UART
CTRL
SPI
I2C
OTP DMA Timer 0
1x PWM
FIFO
FIFO
FIFO
32 kB OTPC
Timer 2
ROM 3x PWM GPIO MULTIPLEXING
84 kB
1 2 3 4 5 6
F
M
D
16
A
C_
P
O
O
VP
FI
AL
FI
G
D
R
R
C
XT
VD
p
M
16
_3
_1
_0
B
D
AL
N
P1
P0
P0
G
XT
LK
3
C
ND
_C
_
P1
P0
P0
SW
G
IO
_5
D
D
4
D _1
_
N
D
P0
P0
P1
G
SW
F
V
_R
0
E
1
_6
_7
T
_
AT
RS
AT
P1
P0
P0
VB
VB
Km
Kp
H
V
C
32
D
CD
32
3
IT
AT
AL
G
AL
SW
VD
XT
VB
VDCDC_RF
RFIOm
RFIOp
P3_7
P2_0
P2_9
P2_8
P2_7
P2_6
P2_5
VPP
NC
48
47
46
45
44
43
42
41
40
39
38
37
P0_0 1 36 P3_6
P0_1 2 35 XTAL16Mm
P0_2 3 34 XTAL16Mp
P0_3 4 33 P1_3
P3_0 5 32 P1_2
P0_5 7 30 SWDIO
(Top View)
P2_1 8 29 P1_1
P0_6 9 28 VBAT1V
P3_1 10 27 P1_0
P0_7 11 26 SWITCH
P3_2 12 25 P3_5
13
14
15
16
17
18
19
20
21
22
23
24
P3_4
XTAL32Kp
P3_3
P2_2
RST
XTAL32Km
GND
P2_3
P2_4
VDCDC
VBAT3V
VDCDC_RF
RFIOm
RFIOp
P2_0
P2_9
P2_8
P2_7
P2_6
P2_5
VPP
40
39
38
37
36
35
34
33
32
31
P0_0 1 30 XTAL16Mm
P0_1 2 29 XTAL16Mp
P0_2 3 28 P1_3
P0_3 4 27 P1_2
NC 5 DA14580 26 SW_CLK
P0_4 6 25 SWDIO
(Top View)
P0_5 7 24 P1_1
P2_1 8 23 VBAT1V
P0_6 9 22 P1_0
P0_7 10 21 SWITCH
11
12
13
14
15
16
17
18
19
20
VBAT_RF
VBAT3V
XTAL32Kp
P2_2
P2_3
XTAL32Km
VDCDC
P2_4
RST
GND
Pin 0: GND
plane
Drive Reset
Pin Name Type Description
(mA) State
General Purpose I/Os
P0_0 DIO 4.8 I-PD INPUT/OUTPUT with selectable pull up/down resistor. Pull-down
P0_1 DIO I-PD enabled during and after reset. General purpose I/O port bit or
P0_2 DIO I-PD alternate function nodes. Contains state retention mechanism
P0_3 DIO I-PD during power down.
P0_4 DIO I-PD
P0_5 DIO I-PD
P0_6 DIO I-PD
P0_7 DIO I-PD
P1_0 DIO 4.8 I-PD INPUT/OUTPUT with selectable pull up/down resistor. Pull-down
P1_1 DIO I-PD enabled during and after reset. General purpose I/O port bit or
P1_2 DIO I-PD alternate function nodes. Contains state retention mechanism
P1_3 DIO I-PD during power down.
P1_4/SWCLK DIO I-PD This signal is the JTAG clock by default
P1_5/SW_DIO DIO I-PU This signal is the JTAG data I/O by default
P2_0 DIO 4.8 I-PD INPUT/OUTPUT with selectable pull up/down resistor. Pull-down
P2_1 DIO I-PD enabled during and after reset. General purpose I/O port bit or
P2_2 DIO I-PD alternate function nodes. Contains state retention mechanism
P2_3 DIO I-PD during power down.
P2_4 DIO I-PD NOTE: This port is only available on the QFN40/QFN48 pack-
P2_5 DIO I-PD ages.
P2_6 DIO I-PD
P2_7 DIO I-PD
P2_8 DIO I-PD
P2_9 DIO I-PD
Drive Reset
Pin Name Type Description
(mA) State
P3_0 DIO 4.8 I-PD INPUT/OUTPUT with selectable pull up/down resistor. Pull-down
P3_1 DIO I-PD enabled during and after reset. General purpose I/O port bit or
P3_2 DIO I-PD alternate function nodes. Contain state retention mechanism dur-
P3_3 DIO I-PD ing power down.
P3_4 DIO I-PD NOTE: This port is only available on the QFN48 package.
P3_5 DIO I-PD
P3_6 DIO I-PD
P3_7 DIO I-PD
Debug Interface
SWDIO/P1_5 DIO 4.8 I-PU INPUT/OUTPUT. JTAG Data input/output. Bidirectional data and
control communication. Can also be used as a GPIO
SW_CLK/ DIO 4.8 I-PD INPUT JTAG clock signal. Can also be used as a GPIO
P1_4
Clocks
XTAL16Mp AI INPUT. Crystal input for the 16 MHz XTAL
XTAL16Mm AO OUTPUT. Crystal output for the 16 MHz XTAL
XTAL32kp AI INPUT. Crystal input for the 32.768 kHz XTAL
XTAL32km AO OUTPUT. Crystal output for the 32.768 kHz XTAL
Quadrature Decoder
QD_CHA_X DI INPUT. Channel A for the X axis. Mapped on Px ports
QD_CHB_X DI INPUT. Channel B for the X axis. Mapped on Px ports
QD_CHA_Y DI INPUT. Channel A for the Y axis. Mapped on Px ports
QD_CHB_Y DI INPUT. Channel B for the Y axis. Mapped on Px ports
QD_CHA_Z DI INPUT. Channel A for the Z axis. Mapped on Px ports
QD_CHB_Z DI INPUT. Channel B for the Z axis. Mapped on Px ports
SPI Bus Interface
SPI_CLK DO INPUT/OUTPUT. SPI Clock. Mapped on Px ports
SPI_DI DI INPUT. SPI Data input. Mapped on Px ports
SPI_DO DO OUTPUT. SPI Data output. Mapped on Px ports
SPI_EN DI INPUT. SPI Clock enable (active LOW). Mapped on Px ports
I2C Bus Interface
SDA DIO/DIOD INPUT/OUTPUT. I2C bus Data with open drain port. Mapped on
Px ports
SCL DIO/DIOD INPUT/OUTPUT. I2C bus Clock with open drain port. In open
drain mode, SCL is monitored to support bit stretching by a
slave. Mapped on Px ports.
UART Interface
UTX DO OUTPUT. UART transmit data. Mapped on Px ports
URX DI INPUT. UART receive data. Mapped on Px ports
URTS DO OUTPUT. UART Request to Send. Mapped on Px ports
UCTS DI INPUT. UART Clear to Send. Mapped on Px ports
UTX2 DO OUTPUT. UART 2 transmit data. Mapped on Px ports
URX2 DI INPUT. UART 2 receive data. Mapped on Px ports
URTS2 DO OUTPUT. UART 2 Request to Send. Mapped on Px ports
UCTS2 DI INPUT. UART 2 Clear to Send. Mapped on Px ports
Drive Reset
Pin Name Type Description
(mA) State
Analog Interface
ADC[0] AI INPUT. Analog to Digital Converter input 0. Mapped on P0[0]
ADC[1] AI INPUT. Analog to Digital Converter input 1. Mapped on P0[1]
ADC[2] AI INPUT. Analog to Digital Converter input 2. Mapped on P0[2]
ADC[3] AI INPUT. Analog to Digital Converter input 3. Mapped on P0[3]
Radio Transceiver
RFIOp AIO RF input/output. Impedance 50
RFIOm AIO RF ground
Miscellaneous
RST DI INPUT. Reset signal (active high). Must be connected to GND if
not used.
VBAT_RF AIO Connect to VBAT3V on the PCB
VDCDC_RF AIO Connect to VDCDC on the PCB
VPP AI INPUT. This pin is used while OTP programming and testing.
OTP programming: VPP = 6.7 V ± 0.1 V
OTP Normal operation: leave VPP floating
Power Supply
VBAT3V AIO INPUT/OUTPUT. Battery connection. Used for a single coin bat-
tery (3 V). If an alkaline or a NiMH battery (1.5 V) is attached to
pin VBAT1V, this is the second output of the DC-DC converter.
VBAT1V AI INPUT. Battery connection. Used for an alkaline or a NiMh bat-
tery (1.5 V). If a single coin battery (3 V) is attached to pin
VBAT3V,this pin must be connected to GND.
SWITCH AIO INPUT/OUTPUT. Connection for the external DC-DC converter
inductor.
VDCDC AO Output of the DC-DC converter
GND AIO - - Ground
3 Ordering Information
Table 2: Ordering Information (Samples)
4 System Overview (RC16M and RC32K) with low precision (> 500 ppm)
and an 10.5 kHz oscillator (RCX) with high precision
4.1 INTERNAL BLOCKS (< 500 ppm). The RCX oscillator can be used as a
The DA14580 contains the following blocks: sleep clock replacing the XTAL32K oscillator to further
improve the power dissipation of the system while
ARM Cortex M0 CPU with Wake-up Interrupt Control- reducing the bill of materials of the system. The
ler (WIC). This processor provides 0.9 dMIPS/MHz and RC16M oscillator is used to provide a clock used for
is used for assisting the Bluetooth low energy protocol the mirroring of the OTP code into the SysRAM while
implementation, providing processing power for calcu- the XTAL16M oscillator is settling directly after power/
lations or data fetches required by the application and wake up.
finally housekeeping, including controlling of the power
scheme of the system. Software Timer. This block contains a 16-bit general
purpose timer (Timer0) with PWM capability as well as
BLE Core. This is the baseband hardware accelerator a 14-bits timer (Timer2) which controls 3 PWM signals
for the Bluetooth low energy protocol. with respect to frequency and duty cycle.
ROM. This is a 84 kB ROM containing the Bluetooth Wake-Up Timer. This is a timer for capturing external
low energy protocol stack as well as the boot code events and it can be used as a wake-up trigger based
sequence. on a programmable number of external events on any
OTP. This is a 32 kB One-Time Programmable memory of the GPIO ports.
array, used to store the application code as well as Quadrature Decoder. This block decodes the pulse
Bluetooth low energy profiles. It also contains the sys- trains from a rotary encoder to provide the step and the
tem configuration and calibration data. direction of the movement of an external device. Three
System SRAM. This is a 42 kB system SRAM (Sys- axes (X, Y, Z) are supported.
RAM) which is primarily used for mirroring the program Keyboard Controller. This circuit enables the reading
code from the OTP when the system wakes/powers and debouncing of a programmable number of GPIOs
up. It also serves as Data RAM for intermediate vari- and generates an interrupt upon a configurable action.
ables and various data that the protocol requires.
Optionally, it can be used as extra memory space for AHB/APB Bus. Implements the AMBA Lite version of
the BLE TX and RX data structures. the AHB and APB specifications.
Retention RAMs. These are 4 special low leakage Power Management. A sophisticated power manage-
SRAM cells (2 kB + 2 kB + 3 kB + 1 kB) used to store ment circuit with a Buck/Boost DC-DC converter and
various data of the Bluetooth low energy protocol as several LDOs that can be turned on/off via software.
well as the system’s global variables and processor A more detailed description of each of the components
stack when the system goes into Deep Sleep mode. of the DA14580 is presented in the following sections.
Storage of this data ensures secure and quick configu-
ration of the BLE Core after the system wakes up. 4.2 FUNCTIONAL MODES
Every cell can be powered on or off according to the The DA14580 is optimized for deeply embedded appli-
application needs for retention area when in Deep cations such as health monitoring, sports measuring,
Sleep mode. human interaction devices etc. Customers are able to
UART and UART2. These asynchronous serial inter- develop and test their own applications. Upon comple-
faces implement hardware flow control with FIFO tion of the development, the application code can be
depths of 16 bytes each. programmed into the OTP. In general, the system has
three functional modes of operation:
SPI. This is the serial peripheral interface with master/
slave capability and a FIFO of 2 16-bit words. A. Development Mode: During this phase application
code is developed using the ARM Cortex-M0 SW envi-
I2C. This is Master/Slave I2C interface used for sen- ronment. The compiled code is then downloaded into
sors and/or host MCUs communication. It comprises a the System RAM or any Retention RAMs by means of
32 places 9-bits wide FIFO. SWD (JTAG) or any serial interface (e.g. UART).
General Purpose (GP) ADC. This is a 10-bits analog- Address 0x00 is remapped to the physical memory that
to-digital converter with 4 external input channels. contains the code and the CPU is configured to reset
and execute code from the remapped device. This
Radio Transceiver. This block implements the RF part mode is enabling application development, debugging
of the Bluetooth low energy protocol. and on-the-fly testing.
Clock Generator. This block is responsible for the B. Normal Mode: After the application is ready and
clocking of the system. It contains 2 XTAL oscillators: verified, the code can be burned into the OTP. When
one running at 16 MHz (XTAL16M) which is used for the system boots/wakes up, the DMA of the OTP con-
the active mode of the system and one running at troller will automatically copy the program code from
32.768 kHz (XTAL32K) which is used for the sleep the OTP into the system RAM. Next, a SW reset or a
modes of the system. There are also three RC oscilla- jump to the System RAM occurs and code execution is
tors available: a 16 MHz and a 32 kHz oscillator started. Hence, in this mode, the system is autono-
Datasheet Revision 3.4 09-Nov-2016
CFR0011-120-01 10 of 234 © 2014 Dialog Semiconductor
DA14580
Bluetooth Low Energy 4.2 SoC FINAL
mous, contains the required SW in OTP and is ready The OTP memory comprises 8K of 32-bit words. The
for integration into the final product. contents are described below:
C. Calibration Mode: Between Development and Nor- • Interrupt Vectors: These are the vectors of the
mal mode, there is an intermediate stage where the interrupt service routines always residing at address
chip needs to be calibrated with respect to two impor- 0x0. This is part of the application (customer) code.
tant features: The size of this vector list is 64 words.
• Programming of the Bluetooth device address • Customer Code: contains the application and the
profiles that a customer has developed. The size is
• Programming of the trimming value for the external
known and fixed before mass production and pro-
16 MHz crystal.
gramming of the OTP.
This mode of operation applies to the final product and
• Patch Area: contains changes that have to be
is performed by the customer. During this phase, cer-
applied on the Customer Code. Each patch area
tain fields in the OTP should be programmed as
comprises a Header and a Payload. Multiple patch
described in section 4.3.1.
areas are possible, however a single word must be
4.3 OTP MEMORY LAYOUT left unprogrammed between the Customer Code
area and the Patch Area. The patching mechanism
The One Time Programmable memory has to be pro- is described in detail in Application Note AN-B-002.
grammed according to a specific layout, which struc-
tures information to be easily accessible from the • OTP Header: contains various information about the
BootROM code as well as the actual application. An configuration of the system as well as Bluetooth low
overview of the layout scheme is presented in the fol- energy specific data.
lowing figure:
4.3.1 OTP Header
The OTP header breakdown is presented in the follow-
ing table:
0x0000
Table 5: OTP Header
Interrupt Vectors
(64 words)
Description
Address
(single byte values apply to all 4 bytes)
CUSTOMER
0x7FFC SWD enable flag:
CODE 0x00 = JTAG is enabled
(variable but known size) 0xAA = JTAG is disabled
0x7FF8 OTP DMA length (number of 32-bit
words)
0x7FF4 Reserved. Keep to 0x0
0x7FDC Customer Specific Field (6 32-bit words)
to 0x7FF0
0x7FD4 to Bluetooth Device Address (2 32-bit
OTP
. 0x7FDB words). It is handled as a string of bytes.
.
. Leftmost number will be programmed at
0x7FD4 etc.
Patch Payload 2 0x7FD0 Signature Algorithm Selector:
0x00 = None
Patch Header 2 0xAA = MD5
0x55 = SHA-1
0xFF = CRC32
Patch Payload 1 0x7F94 to Signature of Customer Code
0x7FCC (15 32-bit words)
Patch Header 1
0x7F00 0x7F90 Trim value for the VCO
OTP Header 0x7F8C Trim value for the XTAL16M oscillator
(64 words) 0x7F88 Trim value for the RC16M oscillator
0x7FFC
0x7F84 Trim value for the BandGap
Figure 5: OTP Layout Scheme 0x7F80 Trim value for the RFIO capacitance
0x7F7C Trim value for the LNA
SW Reset
Application SW
takes over
Extended/Deep‐Sleep OFF
NO
POR
Wakeup ?
YES
Disable: BANDGAP,
DCDC-CONVERTER,
LDOs, XTAL16M
PMU_CTRL_REG
[FORCE_BOOST,
FORCE_BUCK]
FORCE_BOOST = ‘1’ FORCE_BOOST = ‘0’
FORCE_BUCK = don’t care FORCE_BUCK = ‘1’
FORCE_BOOST = ‘0’
FORCE_BUCK = ‘0’
‘1’
SYS_CTRL_REG
Voltages OK
[TIMEOUT_DISABLE] NO
within >64ms?
YES
‘0’
System Power UP
END
Active
Go into Extended/
Deep‐sleep
OTP Controller starts
copying OTPC_NWORDS
words via DMA into
SysRAM
OTP Controller notifies HW
FSM that mirroring is done
HW FSM enables ARM CPU
clock
Wake Up End
Default clock is
XTAL16M
Boot start
Avoid voltage
drops due to Wait for 100 ms
battery contact
Switch to RC16M
No (timeout 64 ms)
Enable OTP LDO
OTP LDO
voltage OK?
Yes OR timeout
Read OTP “Application Flags”
OTP not
programmed but
Magic Number
App operational
identified App
Yes programmed No Flag=0x0000 Yes
Calibration has
? ? been performed
Calibration has
been performed once
once Calibration Calibration
Flag=0xA5A5 Flag=0xA5A5
? ?
Yes
Yes
MODE
CALIBRATION
Read from OTP
and program Read and program Read and program
registers on the trim values
PD_AON domain No respective trim values No
No
Read and program
32 kHz source config.
Length register
will be
Switch to XTAL16M
automatically
Read and program
read by the OTP
controller after DMA length
Initialise peripheral
wake-up
devices
Enable/disable JTAG
No No
ARM is polling
OTPC_STAT_REG
Copy Boot from
Yes UART?
done? UART
No
Yes
NORMAL MODE
I2C
to 0x00
SP Download code No
Enable watchdog
0x2000... to SRAM
5 times
No Yes
looped?
Remap SysRAM to address
0x00 and SW reset Enable JTAG
Yes
Boot end
When in Development Mode, the BootROM code ini- When in Normal Mode, the ARM CPU programs OTP
tializes all peripheral devices from which the DA14580 header configuration information into actual registers,
might download code: UART, SPI (both Master and some of them retaining this value even if the system
Slave) and I2C. The code searches for a valid enters one of the Sleep modes. Next, the actual Appli-
response on various combinations of I/Os one after the cation Code is mirrored into the System RAM and the
other. The step sequence and GPIO mapping is pre- patching function is executed to ensure that SW
sented in the following tables: updates are applied. The patching mechanism is
described in detail in Application Note AN-B-002.
Table 6: Development Mode Peripheral Pin Finally, the Remap register
Mapping (SYS_CTRL_REG[REMAP_ADR0]) is programmed to
ensure that address zero is now pointing to the System
Signal Step A Step B Step C Step D RAM.
SPI SCK P0_0 P0_0 A SW reset as a last step, instructs the ARM CPU to
Master CS P0_3 P0_1 reboot running code from the SRAM.
MISO P0_6 P0_2 4.5 POWER SUPPLY CONFIGURATION
MOSI P0_5 P0_3
4.5.1 Power Domains
UART TX P0_0 P0_2 P0_4 P0_6
The DA14580 comprises several different power
RX P0_1 P0_3 P0_5 P0_7
domains, that are controlled by power switching ele-
SPI SCK P0_0 ments, thus eliminating leakage currents by totally
Slave CS P0_3 powering them down. The partitioning of the
DA14580’s resources with respect to the various power
MOSI P0_6 domains is presented in the following table:
MISO P0_5
I2C SCL P0_0 P0_2 P0_4 P0_6
SDA P0_1 P0_3 P0_5 P0_7 Table 8: Power Domains
Power
Description
Domain
Table 7: Development Mode Peripheral Search PD_AON Always ON: This power line connects
Sequence to all the resources that must be pow-
ered constantly: the ARM/WIC, the
Sequence Action LLP/Timer, the Retention SRAM, the
PMU/CRG, the Capture Timer, the
0 SPI Master Step A Quadrature Decoder, the padring and
1 SPI Master Step B various registers required for the Wake
Up sequence.
2 UART Step A
PD_SYS System: This power line connects to all
3 UART Step B
the resources that should be powered
4 UART Step C only when the ARM M0 is running:
5 UART Step D the AHB bus, the OTP cell and control-
lers, the ROM, the System RAM the
6 SPI Slave Step A Watchdog, the SW Timer and the GPIO
7 I2C Step A port multiplexing.
8 I2C Step B PD_PER Peripherals: This power line connects
9 I2C Step C to the peripherals that can be switched
off after completing their operation: the
10 I2C Step D UARTs, the SPI, the I2C the Keyboard
controller and the ADC.
At each step, the BootROM code sends a certain char- PD_DBG Debug: Powers the debug part of the
acter to the peripheral controller waiting for an answer. ARM Cortex-M0 processor.
If no answer is received within a certain amount of
time, a timeout instructs the code to continue to the PD_RAD Radio: This is the power domain that
next step. If a response is detected, a specific protocol includes the digital part of the Radio
is executed and communication between the DA14580 (DPHY) and the BLE Core.
and the external device is established. The protocol The power management of the Radio
and the timeout values are described in detail in Appli- (RF) subsystem is controlled via sev-
cation Note AN-B-001. eral dedicated LDOs.
Table 8: Power Domains off except for the PD_AON, the programmed
PD_RRx and the PD_SR. Since the SysRAM
Power retains its data, not OTP mirroring is required
Description
Domain upon waking up the system.
PD_RR Retention_RAM: This is a separate 4. Deep Sleep Mode: All power domains are off
power line that only controls the 2 kB except for the PD_AON and the programmed
Retention SRAM. If this memory cell is PD_RRx. This mode dissipates the minimum
not needed, it should always be OFF. leakage power. However, since the SysRAM has
PD_RR2 Retention_RAM2: This is a separate not retained its data, an OTP mirror action is
power line that only controls the 3 kB required upon waking up the system.
Retention SRAM. If this memory cell is The first two power modes do not include any special
not needed, it should always be OFF power gating or manipulation of power domains. The
PD_RR3 Retention_RAM3: This is a separate Extended Sleep and Deep Sleep modes are activated
power line that only controls the second in almost the same way with a small difference. The
2 kB Retention SRAM. If this memory entering into the Extended Sleep and Deep Sleep
cell is not needed, it should always be modes is summarized in the following table:
OFF
PD_RR4 Retention_RAM4: This is a separate
power line that only controls the 1 kB Table 9: Activating Power Modes
Retention SRAM. If this memory cell is
not needed, it should always be OFF Power
Activation Steps
Mode
PD_SR System_RAM: This is a separate
power line that only powers the 42 kB Extended SYS_CTRL_REG[RET_SYSRAM] = 1;
SysRAM. This power line keeps the Sleep SCB->SCR |= 1<<2;
SysRAM’s contents retained but not enables the SLEEPDEEP bit on the Sys-
accessible. tem Control Register of the ARM CPU
Deep SCB->SCR |= 1<<2;
4.5.2 Power Modes Sleep enables the SLEEPDEEP bit on the Sys-
There are four different power modes in the DA14580: tem Control Register of the ARM CPU
Table 10: Power Domain Manipulation when Activating Extended Sleep or Deep Sleep Mode
Power
PD_SYS PD_PER PD_DBG PD_RAD PD_RRx PD_SR Analog
Mode
Extended Automati- Must be pro- Automati- Must be pro- Must be pro- Automati- Automati-
Sleep cally OFF grammed cally OFF grammed grammed cally ON cally OFF
Deep Automati- Must be pro- Automati- Must be pro- Must be pro- Automati- Automati-
Sleep cally OFF grammed\ cally OFF grammed grammed cally OFF cally OFF
The “Analog” column in Table 10 refers to the Band- amount of data transmitted or received per connection.
gap, the DC-DC converter, the XTAL16M oscillator, the Based on these parameters a time threshold for the
RC oscillators, the ADC and the respective LDOs. connection interval can be calculated, above which
These blocks are not part of a single power domain but Deep Sleep mode performs better than Extended
the HW will turn them off upon activation of either the Sleep mode. This is elaborated upon in Application
Extended Sleep or the Deep Sleep mode. Note AN-B-008.
The use of the Extended Sleep vs. the Deep Sleep
4.5.3 Retention Registers
mode depends heavily on the Bluetooth low energy
application and its specific parameters such as the A number of the registers in the DA14580 needs to
required connection interval, the duty cycle and the retain their values when the system enters one of the
Address Range
Power Domain Retention Register Notes
Start End
PD_RAD 0x4000.0000 0x4000.7FFF BLE_CNTL2_REG Retained bit fields are:
BLE_RSSI_SEL
SW_RPL_SPI
BB_ONLY
RADIO_ONLY
BLE_CLK_SEL
RADIO_PWRDN_ALLOW
MON_LP_CLK
DIAGPORT_REVERSE
DIAGPORT_SEL
EMACCERRMSK
EMACCERRSTAT
DEBUG_REG Retained bit fields are:
DEBUGS_FREEZE_EN
PD_SYS 0x4000.8000 0x4000.83FF OTPC_NWORDS_REG Contains the number of
words to be copied from the
OTP memory into the Sys-
RAM.
0x5000.3000 0x5000.3FFF GP_CONTROL_REG Retained bit fields are:
EM_MAP
PD_AON 0x5000.0000 0x5000.0FFF All registers are retainable
PD_PER 0x5000.1000 0x5000.1FFF No registers are retainable
Power Management
Interface
Interrupt Request
and NMI
Connection to
W akeUp Interrupt Controller Serial-W ire Debugger
(W IC) Debug Interface
Nested Vector
Interrupt Processor Debug
Controller Core Subsystem
(NVIC)
service) to support various operations in an embed- • Supports Serial Wire Debug (SWD) connections.
ded OS. The serial wire debug protocol can handle the same
debug features as the JTAG, but it only requires two
• Architecturally defined sleep modes and instructions
wires and is already supported by a number of
to enter sleep. The sleep features allow power con-
debug solutions from various tools vendors.
sumption to be reduced dramatically. Defining sleep
modes as an architectural feature makes porting of • Four (4) hardware breakpoints and two (2) watch
software easier because sleep is entered by a spe- points.
cific instruction rather than implementation defined
• Breakpoint instruction support for an unlimited num-
control registers.
ber of software breakpoints.
• Fault handling exception to catch various sources of
• Programmer’s model similar to the ARM7TDMI pro-
errors in the system.
cessor. Most existing Thumb code for the
• Support for 24 interrupts. ARM7TDMI processor can be reused. This also
makes it easy for ARM7TDMI users, as there is no
• Little endian memory support.
need to learn a new instruction set.
• Wake up Interrupt Controller (WIC) to allow the pro-
cessor to be powered down during sleep, while still 6.1 INTERRUPTS
allowing interrupt sources to wake up the system. This section lists all 24 interrupt lines, except the NMI
• Halt mode debug. Allows the processor activity to interrupt, and describes their source and functionality.
stop completely so that register values can be The overview of the interrupts is illustrated in the fol-
accessed and modified. No overhead in code size lowing table:
and stack memory size.
• CoreSight technology. Allows memories and periph-
erals to be accessed from the debugger without halt-
ing the processor.
IRQ
Number
IRQ Name Description
(Inherent
Priority)
0 BLE_WAKEUP_LP_IRQn Wake-up from Low Power (Deep Sleep) interrupt from BLE.
1 BLE_FINETGTIM_IRQn Fine Target Timer interrupt generated when Fine Target timer expired.
Timer resolution is 625 s base time reference.
2 BLE_GROSSTGTIM_IRQn Gross Target Timer interrupt generated when Gross Target timer expired.
Timer resolution is 16 times 625 s base time reference.
3 BLE_CSCNT_IRQn 625 s base time reference interrupt, available in active modes.
4 BLE_SLP_IRQn End of Sleep mode interrupt.
5 BLE_ERROR_IRQn Error interrupt, generated when undesired behavior or bad programming
occurs in the BLE Core.
6 BLE_RX_IRQn Receipt interrupt at the end of each received packets.
7 BLE_EVENT_IRQn End of Advertising / Scanning / Connection events interrupt.
8 SWTIM_IRQn Software Timer interrupt.
9 WKUP_QUADEC_IRQn Combines the Wake up Capture Timer interrupt, the GPIO interrupt and
the QuadDecoder interrupt
10 BLE_RF_DIAG_IRQn Baseband or Radio Diagnostics Interrupt. Triggered by internal events of
the Radio or Baseband selected by the BLE_RF_DIAGIRQ_REG. For
Debug purposes only.
11 BLE_CRYPT_IRQn Encryption / Decryption interrupt, generated either when AES and/or
CCM processing is finished.
12 UART_IRQn UART interrupt.
13 UART2_IRQn UART2 interrupt.
14 I2C_IRQn I2C interrupt.
15 SPI_IRQn SPI interrupt.
IRQ
Number
IRQ Name Description
(Inherent
Priority)
16 ADC_IRQn Analog-Digital Converter interrupt.
17 KEYBRD_IRQn Keyboard interrupt.
18 RFCAL_IRQn RF Calibration Interrupt.
19 GPIO0_IRQn GPIO interrupt through debounce.
20 GPIO1_IRQn GPIO interrupt through debounce.
21 GPIO2_IRQn GPIO interrupt through debounce.
22 GPIO3_IRQn GPIO interrupt through debounce.
23 GPIO4_IRQn GPIO interrupt through debounce.
Interrupt priorities are programmable by the ARM Cor- The default SysTick Timer configuration will be using
tex-M0. The lower the priority number, the higher the the (fixed) external reference clock STCLKEN
priority level. The priority level is stored in a byte-wide (STCSR[CLKSOURCE]=0). When necessary, higher
register, which is set to 0x0 at reset. Interrupts with the clock frequencies can be used with STCSR[CLK-
same priority level follow a fixed priority order using the SOURCE]=1 but the software should take the
interrupt number listed in Table 13 (lower interrupt HCLK_DIV dependent core clock SCLK into account
number has higher priority level). w.r.t. the timing.
To access the Cortex-M0 NVIC registers, CMSIS func- 6.3 WAKE-UP INTERRUPT CONTROLLER
tions can be used. The input parameter IRQn of the
CMSIS NVIC access functions is the IRQ number. This The Wake-up Interrupt Controller (WIC) is a peripheral
can be the IRQ number or (more convenient) the corre- that can detect an interrupt and wake the processor
sponding IRQ name listed in Table 13. The corre- from deep sleep mode. The WIC is enabled only when
sponding interrupt handler name in the vector table for the DEEPSLEEP bit in the SCR is set to 1 (see System
IRQ#15 is e.g. SPI_Handler. For more information on Control Register on page 4-16 of the Cortex-M0 User
the ARM Cortex-M0 interrupts and the corresponding Guide Reference Material).
CMSIS functions, see a.o. section 4.2 Nested Vectored The WIC is not programmable, and does not have any
Interrupt Controller on pag. 4-3 in the Cortex™-M0 registers or user interface. It operates entirely from
User Guide Reference Material. hardware signals. When the WIC is enabled and the
The Watchdog interrupt is connected to the NMI input processor enters deep sleep mode, the power man-
of the processor. agement unit in the system can power down most of
the Cortex-M0 processor. This has the side effect of
6.2 SYSTEM TIMER (SYSTICK) stopping the SysTick timer. When the WIC receives an
interrupt, it takes a number of clock cycles to wake-up
The Cortex-M0 System Timer (SysTick) can be config- the processor and restore its state, before it can pro-
ured for using 2 different clocks. The SysTick Control & cess the interrupt. This means interrupt latency is
Status (STCSR) register specifies which clock should increased in Deep Sleep mode.
be used by the counter.
STCSR[CLKSOURCE]=0; use the (fixed) external ref- 6.4 REFERENCE
erence clock STCLKEN of 1 MHz. For more information on the ARM Cortex-M0, see the
ARM documents listed in Table 14.
STCSR[CLKSOURCE]=1; use the (HCLK_DIV depen-
dent) processor clock SCLK (e.g. 2, 4, 8 or 16 MHz).
7 AMBA Bus Overview The AMBA bus organization is presented in the follow-
ing figure:
The DA14580 is based on an AMBA 2.0 AHB and APB
components. The AHB is an AMBA Lite version which
requires a single master on the system, i.e. in the
DA14580 the ARM CPU. The APB interface imple-
ments 3 different decoding slaves which are grouped
according to the power domain structure of the chip.
GPIO
SYSTEM
PD_AON
AON
Quad Decoder GPRG
PMU/CRG WatchDog
APB UART
PD_RRx
UART2
PD_PER
RET ROM Bridge
PERIPH
RAMs I2C
Memory
AMBA APB
AMBA AHB SPI
Controller
Sys
PD_SR
ADC
RAM
OTP
Access from Controller
PD_RAD
BLE Controller AHB master RFCU
& Memory
BLE Controller
Remap
Patch
AHB master
ARM M0 Access to Memory
Controller
PD_SYS
Since the DA14580 consists of several different power The rest of the system is mapped on the system power
domains that are digitally controlled and can be shut domain and contains APB blocks (the GPIO multiplex-
down completely, various slave resources especially ing, the Software Timer, the General Purpose Regis-
on the APB bus are grouped together to reduce signal ters and the WatchDog timer) as well as AHB blocks
isolation requirements. (OTP, Memory and ROM controller).
On the AHB Lite bus, the CPU is the master while OTP,
BLE Core, Memory and ROM controllers are the
slaves. Furthermore, on the APB subsystem, the
Always On power domain consists of the following
blocks:
• Wake-up Timer
• Quadrature Decoder
• Power Management Unit / Clock Reset Generator
• Retention RAMs (not mapped on APB but accessi-
ble through the Memory Controller)
The APB peripherals power domain comprises:
• UART and UART2
• SPI
• I2C
• GP ADC
The radio power domain contains both AHB and APB
peripherals i.e. the Radio Frequency Control Unit
(RFCU) and the Bluetooth Low Energy controller.
ROM 0
AHB32
PATCH_DATAx_REG 1 AHB32
(data)
Address Comparator
Match[x]
PATCH_ADDRx_REG
PATCH_VALID_REG
PATCH_VALID_SET_REG
PATCH_VALID_RESET_REG
The patch block’s registers are accessible via the AHB Disabling/Enabling Patch Entries
bus. The patch unit resides in the System Power
Patch entries can be disabled by writing a ‘1’ to the
domain. It is clocked by the system bus clock (HCLK)
write-only register PATCH_VALID_RESET_REG[x].
and must be initialized after each power-up.
Disabled entries can be re-enabled by writing a ‘1’ to
There are 8 patching entries of two 32-bit words each. write-only register PATCH_VALID_SET_REG[x]
A patch entry consists of a 32-bit address register
To introduce new patches, the SW must check the
PATCH_ADDRx_REG and one 32-bit data register
available patch entries, evaluate the priorities (e.g. if it
PATCH_DATAx_REG, implemented as sequential reg-
will use two patch entries for the same 32-bit address)
ister pairs. The programmer must program the address
and program the corresponding register pair.
register first followed by the data register. As soon as
both registers are written, the corresponding bit
PATCH_VALID_REG[x] is automatically set.
Patch Address Comparators
The patch unit has an octal address comparator to
compare AHB address bus with PATCH_ADDRx_REG
With enabled patch entries, upon an address match,
the data bus value is replaced with the corresponding
PATCH_DATAx_REG. Matching uses priorities starting
with highest priority at the last entry
(PATCH_ADDR7_REG) and lowest priority at the first
entry (PATCH_ADDR0_REG). This priority scheme
helps SW to add more patches without having to check
the previous entries with a lower entry number.
9 Memory Map
Address Description
0x00000000 Boot/BLE ROM
0x00014FFF Contains 6 kB of Boot ROM code and 78 kB of Bluetooth low energy protocol related code
0x00015000 RESERVED
0x0001FFFF
0x00020000 Boot/BLE ROM
0x00034FFF Contains 6 kB of Boot ROM code and 78 kB of Bluetooth low energy protocol related code
0x00035000 RESERVED
0x0003FFFF
0x00040000 OTP
0x00047FFF Contains the OTP cell actual memory space
0x00048000 RESERVED
0x0007FFFF
0x00080000 Retention RAM (Note 2)
0x000807FF 2 kB of retained memory space.
0x00080800 Retention RAM2 (Note 2)
0x000813FF 3 kB of retained memory space.
0x00081400 Retention RAM3 (Note 2)
0x00081BFF 2 kB of retained memory space.
0x00081C00 Retention RAM4 (Note 2)
0x00081FFF 1 kB of retained memory space.
0x00082000 RESERVED
0x1FFFFFFF
0x20000000 System RAM (Note 2)
0x2000A7FF 42 kB. Contains OTP code, data for the application
0x2000A800 RESERVED
0x3FFFFFFF
0x40000000 AHB/BLE-Regs
0x40007FFF Contains the control registers of the Bluetooth low energy Link Layer Processor
0x40008000 AHB/OTP-Regs
0x400083FF Contains the control registers of the OTP Subsystem
0x40008400 AHB/Patch-Regs
0x400087FF Contains the registers for the HW patching
0x40008800 RESERVED
0x4FFFFFFF
0x50000000 APB/PMU-CRG
0x500000FF Contains the control registers of the Power Management Unit and the Clock Generator
0x50000100 APB/wake-up
0x500001FF Contains an event capture timers that can wake up the system
0x50000200 APB/Quadrature Decoder
0x500002FF Contains Logic that implements a step counter for X and Y axis from a rotary encoder
0x50000300 RESERVED
0x50000FFF
0x50001000 APB/UART
0x500010FF Contains the control registers of the UART
0x50001100 APB/UART2
0x500011FF Contains the control registers of the UART2
0x50001200 APB/SPI
0x500012FF Contains the control registers of the SPI interface
Address Description
0x50001300 APB/I2C
0x500013FF Contains the control registers of the I2C interface
0x50001400 APB/Kbrd
0x500014FF Contains the registers of the Keyboard controller
0x50001500 APB/ADC
0x500015FF Contains the registers of the 4 channels ADC
0x50001600 APB/AnaMisc
0x500016FF Contains registers for various analog blocks
0x50001700 RESERVED
0x50001FFF
0x50002000 APB/Radio
0x50002FFF Contains the control registers of the Bluetooth low energy Radio
0x50003000 APB/Ports
0x500030FF Contains the mode and direction registers of the GPIOs
0x50003100 APB/Watchdog
0x500031FF Contains the control registers of the Watchdog timer
0x50003200 APB/Version
0x500032FF Contains the version/revision of the chip
0x50003300 APB/Gen Purpose
0x500033FF Contains general purpose control registers
0x50003400 APB/Timer
0x500034FF Contains the control registers of the SW Timer
0x50003500 RESERVED
0xDFFFFFFF
0xE0000000 Internal Private Bus
0xE00FFFFF Contains various registers of the ARM Cortex-M0
10 Memory Controller • The BLE Controller. This master can also access
both resources through its proprietary memory bus.
The Memory Controller implements smart multiplexing
and arbitration of three different masters accessing 2 The block diagram is presented in Figure 14.
memory resources, namely the System RAM and the Features
Retention RAM cells. The masters that require access
to these memories are: • Meets all timing constraints for any access to the
physical cells.
• The CPU over the system AHB bus. This master has
full access to both resources. • Transparently interfaces AHB busses to memory sig-
nalling
• The OTP Controller. This master can access the
System RAM only through a dedicated AHB bus. • Fixed arbitration algorithm with time sharing.
Arbiter Arbiter
RetRAM2 3KB
RetRAM3 2KB
RetRAM4 1KB
RetRAM 2KB
System
RAM
42KB
Memory Controller
10.1 ARBITRATION
The arbitration is a mixture of highest priority and a fair
use policy. If more masters request access, time divi-
sion is employed. This to make sure none of the bus-
ses is able to stall another for a long period. The OTP
and BLE accesses are handled as very critical and
therefore they have highest priority. In general BLE and
OTP accesses are mutual exclusive i.e. no BLE
accesses occur while OTP requests. OTP has highest
priority and will only occur during the OTP mirroring i.e.
the system has not yet started executing application
code. When OTP mirroring is done, BLE gets highest
priority and only one every 3 cycles the CPU is allowed
to get access. If none of the interfaces requests
access, the IDLE or power down state is selected.
11 Clock Generation
CLK_FREQ_TRIM_REG
11.1 CRYSTAL OSCILLATORS
The Digital Controlled Xtal Oscillator (DXCO) is a 10 9 8 7 6 ... 1 0
Pierce configured type of oscillator designed for low
power consumption and high stability. There are two
such crystal oscillators in the system, one at 16 Decoding
MHz(XTAL16M) and a second at 32.768 kHz 3 --> 7
(XTAL32K). The 32.768 kHz oscillator has no trimming
capabilities and is used as the clock of the Extended/ ...
Deep Sleep modes. The 16 MHz oscillator can be
trimmed.
The principle schematic of the two oscillators is shown ...
in Figure 15 below. No external components to the 3.2 pF 3.2 pF 1.6 pF ... 27 fF 13 fF
DA14580 are required other than the crystal itself. If
the crystal has a case connection, it is advised to con-
nect the case to ground.
Figure 16: Frequency Trimming
XTAL32Km
XTAL16Mp
XTAL32Kp
Input[2:0] Output[6:0]
2 1 0 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 1
0-22.4 pF
0 1 0 0 0 0 0 0 1 1
0 1 1 0 0 0 0 1 1 1
clock16MHz 1 0 0 0 0 0 1 1 1 1
clock32kHz
1 0 1 0 0 1 1 1 1 1
1 1 0 0 1 1 1 1 1 1
Figure 15: Crystal Oscillator Circuits 1 1 1 1 1 1 1 1 1 1
11.1.1 Frequency Control (16 MHz Crystal) Trimming might cause phase jumps in the oscillator
signal. To reduce these phase jumps the user should
Register CLK_FREQ_TRIM_REG controls the trim-
only change one switch at a time (this especially
ming of the 16 MHz crystal oscillator. The frequency is
applies to the seven larger capacitors). Use bits 10 to 8
trimmed by two on-chip variable capacitor banks. Both
for coarse adjustment and always increment or decre-
capacitor banks are controlled by the same register.
ment this value by 1. Wait approximately 200 s to
The capacitance of both variable capacitor banks var- allow the adjustment to settle.
ies from minimum to maximum value in 2048 equal
Bits 7...0 are used for fine adjustment.
steps. With CLK_FREQ_TRIM_REG = 0x000 the max-
imum capacitance and thus the minimum frequency is As an example, the recommended way to change the
selected. With CLK_FREQ_TRIM_REG = 0x7FF the frequency trim register from 0x7FF to 0x100 is first to
minimum capacitance and thus the maximum fre- decrement the value of the three most significant bits
quency is selected. by 1 at a time, and then change the least significant
bits until the desired frequency is reached:
The eight least significant bits of
0x7FF --> 0x6FF -->0x5FF --> 0x4FF --> 0x3FF -->
CLK_FREQ_TRIM_REG directly control eight binary
0x2FF --> 0x1FF --> 0x100.
weighted capacitors, as shown in Figure 16. The three
most significant bits are decoded according to Table
11.1.2 Automated Trimming Mechanism
16. Each of the seven outputs of the decoder controls a
capacitor (value is 256 times the value of the smallest There is provision in the DA14580 for automating the
capacitor). actual trimming of the 16 MHz crystal oscillator. This is
a special hardware block that realizes the XTAL trim-
ming in a single step.
11.2 RC OSCILLATORS
There are 3 RC oscillators in the DA14580: one provid-
ing 16 MHz (RC16M), one providing 32 kHz (RC32K)
and one providing a frequency in the range of 10.5 kHz
(RCX).
The 16 MHz RC oscillator is powered by the Digital
LDO i.e. the VDD = 1.2 V which is available for the core
logic during Active or Sleep mode. The output clock is
slightly slower than 16 MHz and is used to clock the
system during the OTP mirroring procedure after wake-
up, while the XTAL16M oscillator is settling. It is impor-
tant to keep the 16 MHz RC oscillator at a frequency
equal or below 16 MHz to guarantee correct behavior
of the digital circuits. This is why the reset value of
CLK_16M_REG[RC16M_TRIM] is equal to the mini-
mum value.
The simple RC oscillator (RC32K) operates on
VDD = 1.2 V and provides 32 kHz. The enhanced RC
oscillator (RCX) provides a stable 18 kHz and operates
only if the external voltage is > 1.8 V (i.e. either on pin
VBAT1V in BOOST mode or on pin VBAT3V in BUCK
mode). The main usage of the RC32K oscillator is for
internal clocking during startup.
The RCX oscillator can be used to replace a
32.768 kHz crystal, since it has a precision of
< 500 ppm, while its output frequency is quite stable
over temperature. Although a different frequency is
used, the accuracy is good enough to ensure that the
correct number of slots (625 s) is counted for the
Sleep time.
11.3 SYSTEM CLOCK GENERATION XTAL32Kp/XTAL32Km for the 16 MHz and 32.768 kHz
The DA14580 clock generation overview is presented oscillators respectively.
in the following figure. External clock sources of the
device are pins XTAL16Mp/XTAL16Mm and pins
CLK_AMBA_REG[OTP_ENABLE]
otp_clk
CLK_PER_REG[WAKEUPCT_ENABLE]
CLK_CTRL_REG[SYS_CLK_SEL] wakeupct_clk
Divide by
XTAL16M apb_clk
PCLK_DIV
OSC System
0 hclk clocks
RC16M sys_clk Divide by
1 ble_hclk
OSC HCLK_DIV
2
CLK_RCX20K_REG[RCX20K_SELECT]
arb_clk
CLK_PER_REG[SPI_ENABLE]
Divide by
RC32K spi_clk
SPI_DIV
OSC 0 CLK_PER_REG[I2C_ENABLE]
i2c_clk
RCX 1 0 CLK_PER_REG[UART1_ENABLE]
OSC
uart_clk
1 CLK_PER_REG[UART2_ENABLE]
XTAL32K
uart2_clk
OSC
CLK_PER_REG[QUAD_ENABLE]
SYS_CTRL_REG[CLK32_SOURCE] quad_clk
CLK_PER_REG[TMR_ENABLE]
TIMER0_CTRL_REG[TIM0_CTRL] Peripheral
CLK_PER_REG[TMR_ENABLE] 0 clocks
Divide by tmr0_clk
TMR_DIV 1
1
TIMER0_CTRL_REG[TIM0_CLK_SEL] tmr0_on_clk
Divide by 0
10
TIMER0_CTRL_REG[TIM0_CLK_DIV]
TRIPLE_PWM_CTRL_REG[TRIPLE_PWM_ENABLE]
tmr2_clk
GP_ADC_CTRL_REG[GP_ADC_EN]
1
gp_adc_clk
Internal ADC 0
osc GP_ADC_CTRL_REG[GP_ADC_CLK_SEL]
CLK_RADIO_REG[RFCU_ENABLE]
Divide by
RFCU_DIV
rfcu_clk
CLK_RADIO_REG[BLE_ENABLE]
Divide by
BLE_DIV
ble_master1_clk
BLE & radio
ble_master2_clk clocks
ble_crypt_clk
ble_lp_clk
Each of the clocks is generated by either a divider or a Table 17: Generated Clocks Description
clock gate. Both dividers and clock gates are able to
start/stop the clock of the module they drive. The con- Clock Name Description
trol of the peripheral clocks is provided by apb_clk AMBA APB interface clock
CLK_PER_REG.
otp_clk OTP controller clock. This is also
The clock names depicted in Figure 17 are explained in used for the OTP macro cell and
the following Table: should not be higher than 16 MHz
hclk AMBA AHB interface clock
ble_hclk AMBA AHB clock for the BLE core
Table 17: Generated Clocks Description
spi_clk Clock for the SPI controller. This
Clock Name Description clock is further divided by 2, 4, 8
or 14 as defined by
wakeupct_clk This is the clock for the wake-up
SPI_CTRL_REG[SPI_CLK]
capture timer.
rfcu_clk Clock for the RF control unit of the 28.8 35 28.57 0.79
Radio 19.2 52 19.23 0.16
tmr0_clk, Timer0/2 clocks 9.6 104 9.61 0.16
tmr2_clk
tmr0_on_clk Timer0 ON counter clock If there is a hard requirement for having an average
baud rate deviation of no more than 5 % on both ends
gp_adc_clk General Purpose ADC conver-
sion clock of the UART connection, a baud rate with an error of
maximum 2.5 % should be selected from the table
ble_crypt_clk Clock for the Crypto block of the above.
BLE core
ble_master1_clk Internal clock for the BLE core
ble_master2_clk Internal clock for the BLE core
arb_clk Clock for the memory controller
arbiter
ble_lp_clk BLE core low power clock
12 OTP Controller • Embedded DMA engine for fast mirroring of the OTP
contents into the System RAM.
The OTP Controller realizes all functions of the OTP
macro cell in an automated and transparent way. The • Embedded DMA supports reading in bursts of 4 32-
controller facilitates all data transfers (reading and pro- bit words
gramming), while implementing the required OTP test • Standby state consumes minimum power
modes in hardware. The block diagram is presented in
Figure 18. • Hardwired handshaking with the PMU to realize the
mirroring procedure
Features
• Emulation of the mirroring procedure for the Devel-
• Implements all timing constraints for any access to opment mode.
the physical memory cells.
• Transparent random address access to the OTP
memory cells via the AHB slave memory interface.
AHB Bus
A H B S la v e A H B S la v e M a s te r
R e g is te r s M e m o ry M e m o ry
Copy C o n tr o lle r
R e q /A c k DMA
O T P C o n t r o lle r
O T P M a c r o c e ll O T P M a c r o c e ll
Upper Bank Low Bank
12.1 OPERATING MODES The APROG mode gives the ability for programming
There are two different functional modes of operation large data blocks into the macro cell. The programming
for reading and programming respectively: manual is an automated procedure, during which it is only nec-
(MREAD, MPROG) and automatic (AREAD, APROG). essary to feed the controller with the required data.
The OTP operating mode is programmable at Data blocks can be fetched in two ways:
OTPC_MODE_REG[OTPC_MODE_MODE]. • Via the AHB master interface, i.e. the DMA
The MREAD mode enables the use of the memory • Via the AHB memory interface
slave interface. By activating this mode the contents of
the macro cell are transparently mapped onto the spe- In the latter case, data are pumped into the OTP con-
cific AHB slave address space. This mode can be used troller through a register, which acts as a port providing
for execution of software in place (XIP). access to a FIFO.
The AREAD mode provides the ability for reading data 12.2 AHB MASTER INTERFACE
from the macro cell in bursts, without the use of the The AHB master interface is controlled by a DMA
slave interface. This mode is used for copying large engine with an internal FIFO of 8 32-bit words. The
data blocks from the macro cell, as in the case of the DMA engine supports AHB reads and writes. The AHB
OTP mirroring into the System RAM. address where memory access should begin, is pro-
The MPROG mode implements the single step of the grammed into the DMA engine at
program/verify sequence. In this mode, when the pro- OTPC_AHBADR_REG[OTPC_AHBADR]. The num-
gramming of a bit fails, the controller does not automat- ber of 32-bit words (minus 1) of a transfer must be
ically try to reprogram the bit. Hence, reprogramming specified in OTPC_NWORDS_REG[OTP_NWORDS].
should be triggered by software. The value and the The DMA engine internally supports the following burst
address of the bit are defined through a configuration types:
register (OTPC_PCTRL_REG), for both macro cell
banks. The programming sequence can be enabled or • Four words incremental burst
disabled for each of the memory banks. The result of • Unspecified incremental burst of 2 or 3 words
the program/verify is stored in register
OTPC_STAT_REG. There is a status bit for each one • Single word access
of the two memory banks.
• Two-wire I2C serial interface consists of a serial data • Interrupt or polled-mode operation
line (SDA) and a serial clock (SCL) • Handles Bit and Byte waiting at both bus speeds
• Two speeds are supported: • Programmable SDA hold time
• Standard mode (0 to 100 kbit/s)
• Fast mode (<= 400 kbit/s)
I2 C
A M B A B u s S la v e S ta te M a s te r S ta te
R e g is te r F ile M a c h in e
In te r fa c e U n it M a c h in e
C lo c k
G e n e r a to r R x S h ift T x S h ift R x F ilte r
In te r r u p t
T o g g le S y n c h r o n ize r
C o n tr o lle r
R X F IF O T X F IF O
The I2C Controller block diagram is shown in Figure • Rx Filter. Detects the events in the bus; for example,
19. It contains the following sub-blocks: start, stop and arbitration lost.
• AMBA Bus Interface Unit. Interfacing via the APB • Toggle. Generates pulses on both sides and toggles
interface to access the register file. to transfer signals across clock domains.
• Register File. Contains configuration registers and is • Synchronizer. Transfers signals from one clock
the interface with software. domain to another.
• Master State Machine. Generates the I2C protocol • Interrupt Controller. Generates the raw interrupt and
for the master transfers. interrupt flags, allowing them to be set and cleared.
• Clock Generator. Calculates the required timing to • RX FIFO/TX. Holds the RX FIFO and TX FIFO regis-
do the following: ter banks and controllers, along with their status lev-
els.
• Generate the SCL clock when configured as a
master 13.1 I2C BUS TERMS
• Check for bus idle The following terms relate to how the role of the I2C
• Generate a START and a STOP device and how it interacts with other I2C devices on
the bus.
• Setup the data and hold the data
• Transmitter. the device that sends data to the bus. A
• Rx Shift. Takes data into the design and extracts it in transmitter can either be a device that initiates the
byte format. data transmission to the bus (a master-transmitter)
• Tx Shift. Presents data supplied by CPU for transfer or responds to a request from the master to send
on the I2C bus. data to the bus (a slave-transmitter).
• Receiver. The device that receives data from the START or RESTART condition. The level of the SDA
bus. A receiver can either be a device that receives data line changes from high to low, while the SCL
data on its own request (a master-receiver) or in clock line remains high. When this occurs, the bus
response to a request from the master (a slave- becomes busy.
receiver).
• STOP. data transfer is terminated by a STOP condi-
• Master. The component that initializes a transfer tion. This occurs when the level on the SDA data line
(START command), generates the clock (SCL) sig- passes from the low state to the high state, while the
nal and terminates the transfer (STOP command). A SCL clock line remains high. When the data transfer
master can be either a transmitter or a receiver. has been terminated, the bus is free or idle once
again. The bus stays busy if a RESTART is gener-
• Slave. The device addressed by the master. A slave
ated instead of a STOP condition.
can be either receiver or transmitter.
Note 3: START and RESTART conditions are functionally identical.
These concepts are illustrated in Figure 20.
13.2 I2C BEHAVIOR
The I2C can be only be controlled via software to be an
I2C master only, communicating with other I2C slaves;
The master is responsible for generating the clock and
controlling the transfer of data. The slave is responsible
for either transmitting or receiving data to/from the
master. The acknowledgement of data is sent by the
device that is receiving data, which can be either a
master or a slave. As mentioned previously, the I2C
protocol also allows multiple masters to reside on the
I2C bus and uses an arbitration procedure to deter-
Figure 20: Master/Slave and Transmitter/Receiver mine bus ownership.
Relationships Each slave has a unique address that is determined by
the system designer. When a master wants to commu-
• Multi-master. The ability for more than one master to nicate with a slave, the master transmits a START/
co-exist on the bus at the same time without collision RESTART condition that is then followed by the slave’s
or data loss. address and a control bit (R/W) to determine if the
master wants to transmit data or receive data from the
• Arbitration. The predefined procedure that autho- slave. The slave then sends an acknowledge (ACK)
rizes only one master at a time to take control of the pulse after the address.
bus. For more information about this behavior, refer
to Multiple Master Arbitration chapter If the master (master-transmitter) is writing to the slave
(slave-receiver), the receiver gets one byte of data.
• Synchronization. The predefined procedure that syn- This transaction continues until the master terminates
chronizes the clock signals provided by two or more the transmission with a STOP condition. If the master
masters. For more information about this feature, is reading from a slave (master-receiver), the slave
refer to Clock Synchronization chapter transmits (slave-transmitter) a byte of data to the mas-
• SDA. Data signal line (Serial DAta) ter, and the master then acknowledges the transaction
with the ACK pulse. This transaction continues until the
• SCL. Clock signal line (Serial CLock) master terminates the transmission by not acknowl-
edging (NACK) the transaction after the last byte is
13.1.1 Bus Transfer Terms received, and then the master issues a STOP condition
The following terms are specific to data transfers that or addresses another slave after issuing a RESTART
occur to/from the I2C bus. condition. This behavior is illustrated in Figure 21.
• START (RESTART). data transfer begins with a
The I2C is a synchronous serial interface. The SDA To initiate combined format transfers,
line is a bidirectional signal and changes only while the I2C_CON.I2C_RESTART_EN should be set to 1. With
SCL line is low, except for STOP, START, and this value set and operating as a master, when the I2C
RESTART conditions. The output drivers are open- Controller completes an I2C transfer, it checks the
drain or open-collector to perform wire-AND functions transmit FIFO and executes the next transfer. If the
on the bus. The maximum number of devices on the direction of this transfer differs from the previous trans-
bus is limited by only the maximum capacitance speci- fer, the combined format is used to issue the transfer. If
fication of 400 pF. Data is transmitted in byte packages. the transmit FIFO is empty when the current I2C trans-
fer completes, a STOP is issued and the next transfer
13.2.1 START and STOP Generation is issued following a START condition.
When operating as an I2C master, putting data into the 13.3 I2C PROTOCOLS
transmit FIFO causes the I2C Controller to generate a
START condition on the I2C bus. Allowing the transmit The I2C Controller has the following protocols:
FIFO to empty causes the I2C Controller to generate a • START and STOP Conditions
STOP condition on the I2C bus.
• Addressing Slave Protocol
When operating as a slave, the I2C Controller does not
• Transmitting and Receiving Protocol
generate START and STOP conditions, as per the pro-
tocol. However, if a read request is made to the I2C • START BYTE Transfer Protocol
Controller, it holds the SCL line low until read data has
been supplied to it. This stalls the I2C bus until read 13.3.1 START and STOP Conditions
data is provided to the slave I2C Controller, or the I2C
When the bus is idle, both the SCL and SDA signals
Controller slave is disabled by writing a 0 to
are pulled high through external pull-up resistors on the
I2C_ENABLE.
bus. When the master wants to start a transmission on
the bus, the master issues a START condition. This is
13.2.2 Combined Formats
defined to be a high-to-low transition of the SDA signal
The I2C Controller supports mixed read and write com- while SCL is 1. When the master wants to terminate
bined format transactions in both 7-bit and 10-bit the transmission, the master issues a STOP condition.
addressing modes. This is defined to be a low-to-high transition of the SDA
line while SCL is 1. Figure 22 shows the timing of the
The I2C Controller does not support mixed address
START and STOP conditions. When data is being
and mixed address format.that is, a 7-bit address
transmitted on the bus, the SDA line must be stable
transaction followed by a 10-bit address transaction or
when SCL is 1.
vice versa.combined format transactions.
Note 4: The signal transitions for the START/STOP conditions, as depicted in Figure 21, reflect those observed at the output signals of the Master
driving the I2C bus. Care should be taken when observing the SDA/SCL signals at the input signals of the Slave(s), because unequal line
delays may result in an incorrect SDA/SCL timing relationship.
10-bit Address Format slaves address bits 9:8, and the LSB bit (bit 0) is the R/
W bit. The second byte transferred sets bits 7:0 of the
During 10-bit addressing, two bytes are transferred to
slave address. Figure 24 shows the 10-bit address for-
set the 10-bit address. The transfer of the first byte
mat, and Table 19 defines the special purpose and
contains the following bit definition. The first five bits
reserved first byte addresses.
(bits 7:3) notify the slaves that this is a 10-bit transfer
followed by the next two bits (bits 2:1), which set the
I2C Controller does not restrict you from using these from the master to either transmit data or receive data
reserved addresses. However, if you use these to/from the bus, acting as either a slave-transmitter or
reserved addresses, you may run into incompatibilities slave-receiver, respectively.
with other I2C components.
Master-Transmitter and Slave-Receiver
13.3.3 Transmitting and Receiving Protocols All data is transmitted in byte format, with no limit on
the number of bytes transferred per data transfer. After
The master can initiate data transmission and recep-
the master sends the address and R/W bit or the mas-
tion to/from the bus, acting as either a master-transmit-
ter transmits a byte of data to the slave, the slave-
ter or master-receiver. A slave responds to requests
receiver must respond with the acknowledge signal
Datasheet Revision 3.4 09-Nov-2016
CFR0011-120-01 37 of 234 © 2014 Dialog Semiconductor
DA14580
Bluetooth Low Energy 4.2 SoC FINAL
(ACK). When a slave-receiver does not respond with If the master-transmitter is transmitting data as shown
an ACK pulse, the master aborts the transfer by issuing in Figure 25, then the slave-receiver responds to the
a STOP condition. The slave must leave the SDA line master-transmitter with an acknowledge pulse after
high so that the master can abort the transfer. every byte of data is received.
Master-Receiver and Slave-Transmitter When a master does not want to relinquish the bus
with a STOP condition, the master can issue a
If the master is receiving data as shown in Figure 26
RESTART condition. This is identical to a START con-
then the master responds to the slave-transmitter with
dition except it occurs after the ACK pulse. The master
an acknowledge pulse after a byte of data has been
can then communicate with the same slave or a differ-
received, except for the last byte. This is the way the
ent slave.
master-receiver notifies the slave-transmitter that this
is the last byte. The slave-transmitter relinquishes the
SDA line after detecting the No Acknowledge (NACK)
so that the master can issue a STOP condition.
START BYTE Transfer Protocol device requires it. This protocol consists of seven zeros
being transmitted followed by a 1, as illustrated in
The START BYTE transfer protocol is set up for sys-
Figure 27. This allows the processor that is polling the
tems that do not have an on-board dedicated I2C hard-
bus to under-sample the address phase until 0 is
ware module. When the I2C Controller is addressed as
detected. Once the microcontroller detects a 0, it
a slave, it always samples the I2C bus at the highest
switches from the under sampling rate to the correct
speed supported so that it never requires a START
rate of the master.
BYTE transfer. However, when I2C Controller is a mas-
ter, it supports the generation of START BYTE trans-
fers at the beginning of every transfer in case a slave
The START BYTE procedure is as follows: defined by the system designer and is set by writing to
the High Speed Master Mode Code Address Register,
1. Master generates a START condition.
I2C_HS_MADDR. Because the codes are unique, only
2. Master transmits the START byte (0000 0001). one master can win arbitration, which occurs by the
end of the transmission of the high-speed master code.
3. Master transmits the ACK clock pulse. (Present
only to conform with the byte handling format Control of the bus is determined by address or master
used on the bus) code and data sent by competing masters, so there is
no central master nor any order of priority on the bus.
4. No slave sets the ACK signal to 0.
Arbitration is not allowed between the following condi-
5. Master generates a RESTART (R) condition.
tions:
A hardware receiver does not respond to the START
• A RESTART condition and a data bit
BYTE because it is a reserved address and resets after
the RESTART condition is generated. • A STOP condition and a data bit
13.5 CLOCK SYNCHRONIZATION goes into a HIGH wait state until the SCL clock line
When two or more masters try to transfer information transitions to 1.
on the bus at the same time, they must arbitrate and All masters then count off their high time, and the mas-
synchronize the SCL clock. All masters generate their ter with the shortest high time transitions the SCL line
own clock to transfer messages. Data is valid only dur- to 0. The masters then counts out their low time and
ing the high period of SCL clock. Clock synchronization the one with the longest low time forces the other mas-
is performed using the wired-AND connection to the ter into a HIGH wait state. Therefore, a synchronized
SCL signal. When the master transitions the SCL clock SCL clock is generated, which is illustrated in Figure
to 0, the master starts counting the low time of the SCL 29. Optionally, slaves may hold the SCL line low to
clock and transitions the SCL clock signal to 1 at the slow down the timing on the I2C bus.
beginning of the next clock period. However, if another
master is holding the SCL line to 0, then the master
13.6 OPERATION MODES 1. The other I2C master device initiates an I2C transfer
This section provides information on the following top- with an address that matches the slave address in the
ics: I2C_SAR register of the I2C Controller.
• Slave mode operation 2. The I2C Controller acknowledges the sent address
and recognizes the direction of the transfer to indicate
• Master mode operation that it is acting as a slave-transmitter.
• Disabling I2C Controller 3. The I2C Controller asserts the RD_REQ interrupt (bit
Note 5: It is important to note that the I2C Controller should only be 5 of the I2C_RAW_INTR_STAT register) and holds the
set to operate as an I2C Master, or I2C Slave, but not both SCL line low. It is in a wait state until software
simultaneously. This is achieved by ensuring that bit 6 responds. If the RD_REQ interrupt has been masked,
(I2C_SLAVE_DISABLE) and 0 (I2C_MASTER_MODE) of due to I2C_INTR_MASK[5] register (M_RD_REQ bit
the I2C_CON register are never set to 0 and 1, respectively. field) being set to 0, then it is recommended that a
hardware and/or software timing routine be used to
13.6.1 Slave Mode Operation instruct the CPU to perform periodic reads of the
I2C_RAW_INTR_STAT register.
This section includes the following procedures:
a. Reads that indicate I2C_RAW_INTR_STAT[5]
• Initial Configuration (R_RD_REQ bit field) being set to 1 must be treated as
• Slave-Transmitter Operation for a Single Byte the equivalent of the RD_REQ interrupt being
asserted.
• Slave-Receiver Operation for a Single Byte
b. Software must then act to satisfy the I2C transfer.
• Slave-Transfer Operation For Bulk Transfers
c. The timing interval used should be in the order of 10
times the fastest SCL clock period the I2C Controller
Initial Configuration
can handle. For example, for 400 kb/s, the timing inter-
To use the I2C Controller as a slave, perform the fol- val is 25us.
lowing steps: Note 8: The value of 10 is recommended here because this is
1. Disable the I2C Controller by writing a ‘0’ to bit 0 of approximately the amount of time required for a single byte
the I2C_ENABLE register. of data transferred on the I2C bus.
4. If there is any data remaining in the TX FIFO before
2. Write to the I2C_SAR register (bits 9:0) to set the receiving the read request, then the I2C Controller
slave address. This is the address to which the I2C asserts a TX_ABRT interrupt (bit 6 of the
Controller responds. I2C_RAW_INTR_STAT register) to flush the old data
3. Write to the I2C_CON register to specify which type from the TX FIFO.
of addressing is supported (7- or 10-bit by setting bit 3). Note 9: Because the I2C Controller’s TX FIFO is forced into a
Enable the I2C Controller in slave-only mode by writing flushed/reset state whenever a TX_ABRT event occurs, it is
a ‘0’ into bit 6 (I2C_SLAVE_DISABLE) and a ‘0’ to bit 0 necessary for software to release the I2C Controller from this
(MASTER_MODE).
state by reading the I2C_CLR_TX_ABRT register before
Note 6: Slaves and masters do not have to be programmed with the attempting to write into the TX FIFO. See register
same type of addressing 7- or 10-bit address. For instance, a I2C_RAW_INTR_STAT for more details.
slave can be programmed with 7-bit addressing and a mas- If the TX_ABRT interrupt has been masked, due to of
ter with 10-bit addressing, and vice versa. I2C_INTR_MASK[6] register (M_TX_ABRT bit field)
being set to 0, then it is recommended that re-using the
4. Enable the I2C Controller by writing a ‘1’ in bit 0 of timing routine (described in the previous step), or a
the I2C_ENABLE register. similar one, be used to read the
Note 7: Depending on the reset values chosen, steps 2 and 3 may I2C_RAW_INTR_STAT register.
not be necessary because the reset values can be config- a. Reads that indicate bit 6 (R_TX_ABRT) being set to
ured. For instance, if the device is only going to be a master, 1 must be treated as the equivalent of the TX_ABRT
there would be no need to set the slave address because interrupt being asserted.
you can configure the I2C Controller to have the slave dis-
abled after reset and to enable the master after reset. The b. There is no further action required from software.
values stored are static and do not need to be repro- c. The timing interval used should be similar to that
grammed if the I2C Controller is disabled. described in the previous step for the
I2C_RAW_INTR_STAT[5] register.
Slave-Transmitter Operation for a Single Byte
5. Software writes to the I2C_DATA_CMD register with
When another I2C master device on the bus addresses the data to be written (by writing a ‘0’ in bit 8).
the I2C Controller and requests data, the I2C Controller
acts as a slave-transmitter and the following steps 6. Software must clear the RD_REQ and TX_ABRT
occur: interrupts (bits 5 and 6, respectively) of the
I2C_RAW_INTR_STAT register before proceeding.
If the RD_REQ and/or TX_ABRT interrupts have been remote master read request by writing one byte into the
masked, then clearing of the I2C_RAW_INTR_STAT slave’s TX FIFO. When a slave (slave-transmitter) is
register will have already been performed when either issued with a read request (RD_REQ) from the remote
the R_RD_REQ or R_TX_ABRT bit has been read as master (master-receiver), at a minimum there should
1. be at least one entry placed into the slave-transmitter’s
TX FIFO.
7. The I2C Controller releases the SCL and transmits
the byte. I2C Controller is designed to handle more data in the
TX FIFO so that subsequent read requests can take
8. The master may hold the I2C bus by issuing a
that data without raising an interrupt to get more data.
RESTART condition or release the bus by issuing a
Ultimately, this eliminates the possibility of significant
STOP condition.
latencies being incurred between raising the interrupt
Slave-Receiver Operation for a Single Byte for data each time had there been a restriction of hav-
ing only one entry placed in the TX FIFO.
When another I2C master device on the bus addresses
the I2C Controller and is sending data, the I2C Control- This mode only occurs when I2C Controller is acting as
ler acts as a slave-receiver and the following steps a slave-transmitter. If the remote master acknowledges
occur: the data sent by the slave-transmitter and there is no
data in the slave’s TX FIFO, the I2C Controller holds
1. The other I2C master device initiates an I2C transfer
the I2C SCL line low while it raises the read request
with an address that matches the I2C Controller’s slave
interrupt (RD_REQ) and waits for data to be written
address in the I2C_SAR register.
into the TX FIFO before it can be sent to the remote
2. The I2C Controller acknowledges the sent address master.
and recognizes the direction of the transfer to indicate
If the RD_REQ interrupt is masked, due to bit 5
that the I2C Controller is acting as a slave-receiver.
(M_RD_REQ) of the I2C_INTR_STAT register being
3. I2C Controller receives the transmitted byte and set to 0, then it is recommended that a timing routine
places it in the receive buffer. be used to activate periodic reads of the
Note 10: If the RX FIFO is completely filled with data when a byte is
I2C_RAW_INTR_STAT register. Reads of
pushed, then an overflow occurs and the I2C Controller con-
I2C_RAW_INTR_STAT that return bit 5 (R_RD_REQ)
tinues with subsequent I2C transfers. Because a NACK is
set to 1 must be treated as the equivalent of the
not generated, software must recognize the overflow when
RD_REQ interrupt referred to in this section. This tim-
indicated by the I2C Controller (by the R_RX_OVER bit in
ing routine is similar to that described in “Slave-Trans-
the I2C_INTR_STAT register) and take appropriate actions
mitter Operation for a Single Byte”
to recover from lost data. Hence, there is a real time con- The RD_REQ interrupt is raised upon a read request,
straint on software to service the RX FIFO before the latter and like interrupts, must be cleared when exiting the
overflow as there is no way to re-apply pressure to the interrupt service handling routine (ISR). The ISR allows
remote transmitting master. You must select a deep enough you to either write 1 byte or more than 1 byte into the
RX FIFO depth to satisfy the interrupt service interval of their TX FIFO. During the transmission of these bytes to the
system. master, if the master acknowledges the last byte. then
the slave must raise the RD_REQ again because the
4. I2C Controller asserts the RX_FULL interrupt master is requesting for more data.
(I2C_RAW_INTR_STAT[2] register).
If the programmer knows in advance that the remote
If the RX_FULL interrupt has been masked, due to set- master is requesting a packet of n bytes, then when
ting I2C_INTR_MASK[2] register to 0 or setting another master addresses I2C Controller and requests
I2C_TX_TL to a value larger than 0, then it is recom- data, the TX FIFO could be written with n number bytes
mended that a timing routine (described in “Slave- and the remote master receives it as a continuous
Transmitter Operation for a Single Byte”) be imple- stream of data. For example, the I2C Controller slave
mented for periodic reads of the “I2C_STATUS” on continues to send data to the remote master as long as
page 138 register. Reads of the I2C_STATUS register, the remote master is acknowledging the data sent and
with bit 3 (RFNE) set at 1, must then be treated by soft- there is data available in the TX FIFO. There is no
ware as the equivalent of the RX_FULL interrupt being need to hold the SCL line low or to issue RD_REQ
asserted. again.
5. Software may read the byte from the If the remote master is to receive n bytes from the I2C
I2C_DATA_CMD register (bits 7:0). Controller but the programmer wrote a number of bytes
larger than n to the TX FIFO, then when the slave fin-
6. The other master device may hold the I2C bus by
ishes sending the requested n bytes, it clears the TX
issuing a RESTART condition or release the bus by
FIFO and ignores any excess bytes.
issuing a STOP condition.
The the I2C Controller generates a transmit abort
Slave-Transfer Operation for Bulk Transfers
(TX_ABRT) event to indicate the clearing of the TX
In the standard I2C protocol, all transactions are single FIFO in this example. At the time an ACK/NACK is
byte transactions and the programmer responds to a expected, if a NACK is received, then the remote mas-
ter has all the data it wants. At this time, a flag is raised Master Transmit and Master Receive
within the slave’s state machine to clear the leftover
The I2C Controller supports switching back and forth
data in the TX FIFO. This flag is transferred to the pro-
between reading and writing dynamically. To transmit
cessor bus clock domain where the FIFO exists and
data, write the data to be written to the lower byte of the
the contents of the TX FIFO is cleared at that time.
IC_DATA_CMD register. The CMD bit [8] should be
written to 0 for I2C write operations.
13.6.2 Master Mode Operation
Subsequently, a read command may be issued by writ-
This section includes the following topics:
ing “don’t cares” to the lower byte of the
• Initial Configuration IC_DATA_CMD register, and a 1 should be written to
the CMD bit.
• Master Transmit and Master Receive
The I2C Controller master continues to initiate trans-
fers as long as there are commands present in the
Initial Configuration
transmit FIFO. If the transmit FIFO becomes empty, the
The procedures are very similar and are only different master inserts a STOP condition after completing the
with regard to where the I2C_10BITADDR_MASTER current transfer.
bit is set (either bit 4 of I2C_CON register or bit 12 of
I2C_TAR register). 13.6.3 Disabling the I2C Controller
To use the I2C Controller as a master perform the fol- The register I2C_ENABLE_STATUS is added to allow
lowing steps: software to unambiguously determine when the hard-
ware has completely shutdown in response to the
1. Disable the I2C Controller by writing 0 to the
I2C_ENABLE register being set from 1 to 0. Only one
I2C_ENABLE register.
register is required to be monitored
2. Write to the I2C_CON register to set the maximum
Procedure
speed mode supported (bits 2:1) and the desired
speed of the I2C Controller master-initiated transfers, 1. Define a timer interval (ti2c_poll) equal to the 10
either 7-bit or 10-bit addressing (bit 4). times the signalling period for the highest I2C transfer
speed used in the system and supported by I2C Con-
Ensure that bit 6 I2C_SLAVE_DISABLE = 1 and bit 0
troller. For example, if the highest I2C transfer mode is
MASTER_MODE =1
400 kb/s, then this ti2c_poll is 25us.
Note 11: Slaves and masters do not have to be programmed with the
same type of addressing 7- or 10-bit address. For instance, a 2. Define a maximum time-out parameter,
slave can be programmed with 7-bit addressing and a mas- MAX_T_POLL_COUNT, such that if any repeated poll-
ter with 10-bit addressing, and vice versa. ing operation exceeds this maximum value, an error is
reported.
3. Write to the I2C_TAR register the address of the I2C 3. Execute a blocking thread/process/function that pre-
device to be addressed (bits 9:0). This register also vents any further I2C master transactions to be started
indicates whether a General Call or a START BYTE by software, but allows any pending transfers to be
command is going to be performed by I2C. completed.
4. Only applicable for high-speed mode transfers. Write Note 13: This step can be ignored if I2C Controller is programmed to
to the I2C_HS_MADDR register the desired master operate as an I2C slave only.
code for the I2C Controller. The master code is pro- 4. The variable POLL_COUNT is initialized to zero.
grammer-defined.
5. Set I2C_ENABLE to 0.
5. Enable the I2C Controller by writing a 1 in bit 0 of the
6. Read the I2C_ENABLE_STATUS register and test
I2C_ENABLE register.
the I2C_EN bit (bit 0). Increment POLL_COUNT by
6. Now write transfer direction and data to be sent to one. If POLL_COUNT >= MAX_T_POLL_COUNT, exit
the I2C_DATA_CMD register. If the I2C_DATA_CMD with the relevant error code.
register is written before the I2C Controller is enabled,
7. If I2C_ENABLE_STATUS[0] is 1, then sleep for
the data and commands are lost as the buffers are kept
ti2c_poll and proceed to the previous step.
cleared when I2C Controller is disabled.
Otherwise, exit with a relevant success code.
This step generates the START condition and the
address byte on the I2C Controller. Once I2C Control-
ler is enabled and there is data in the TX FIFO, I2C
Controller starts reading the data.
Note 12: Depending on the reset values chosen, steps 2, 3, 4, and 5
may not be necessary because the reset values can be con-
figured. The values stored are static and do not need to be
reprogrammed if the I2C Controller is disabled, with the
exception of the transfer direction and data.
UART
UART2
pclk
FIFO
Block
APB
APB Bus
Interface
Register uart_int
Block
rts_n
Modem
cts_n Sync Sync
Block Block Timeout
Detector
Baud
Clock
uart_clk Generator
An additional parity bit may be added to the serial char- ted for exactly the same time duration. This is referred
acter. This bit appears after the last data bit and before to as a Bit Period or Bit Time. One BitTime equals 16
the stop bit(s) in the character structure to provide the baud clocks. To ensure stability on the line the receiver
UART with the ability to perform simple error checking samples the serial input data at approximately the mid
on the received data. point of the Bit Time once the start bit has been
detected. As the exact number of baud clocks that
The UART Line Control Register (UART_LCR_REG) is
each bit was transmitted for is known, calculating the
used to control the serial character characteristics. The
mid point for sampling is not difficult, that is every 16
individual bits of the data word are sent after the start
baud clocks after the mid point sample of the start bit.
bit, starting with the least-significant bit (LSB). These
Figure 32 shows the sampling points of the first couple
are followed by the optional parity bit, followed by the
of bits in a serial character.
stop bit(s), which can be 1, 1.5 or 2.
All the bits in the transmission (with exception to the
half stop bit when 1.5 stop bits are used) are transmit-
As part of the 16550 standard an optional baud clock Note 14: Attention. Information provided on IrDA SIR mode in this
reference output signal (baudout_n) is supplied to pro- section assumes that the reader is fully familiar with the IrDA
vide timing information to receiving devices that require Serial Infrared Physical Layer Specifications. This specifica-
it. The baud rate of the UART is controlled by the serial tion can be obtained from the following website:
clock (sclk or pclk in a single clock implementation) and http://www.irda.org
the Divisor Latch Register (DLH and DLL).
The data format is similar to the standard serial (sout
14.2 IRDA 1.0 SIR PROTOCOL and sin) data format. Each data character is sent seri-
The Infrared Data Association (IrDA) 1.0 Serial Infrared ally, beginning with a start bit, followed by 8 data bits,
(SIR) mode supports bi-directional data communica- and ending with at least one stop bit. Thus, the number
tions with remote devices using infrared radiation as of data bits that can be sent is fixed. No parity informa-
the transmission medium. IrDA 1.0 SIR mode specifies tion can be supplied and only one stop bit is used while
a maximum baud rate of 115.2 kBaud. in this mode.
Trying to adjust the number of data bits sent or enable
parity with the Line Control Register (LCR) has no pulse. The width of each pulse is 3/16th of a normal
effect. When the UART is configured to support IrDA serial bit time. Thus, each new character begins with
1.0 SIR it can be enabled with Mode Control Register an infrared pulse for the start bit. However, received
(MCR) bit 6. When the UART is not configured to sup- data is inverted from transmitted data due to the infra-
port IrDA SIR mode, none of the logic is implemented red pulses energizing the photo transistor base of the
and the mode cannot be activated, reducing total gate IrDA receiver, pulling its output low. This inverted tran-
counts. When SIR mode is enabled and active, serial sistor output is then fed to the UART sir_in port, which
data is transmitted and received on the sir_out_n and then has correct UART polarity. Figure 33 shows the
sir_in ports, respectively. timing diagram for the IrDA SIR data format in compar-
ison to the standard serial format.
Transmitting a single infrared pulse signals a logic
zero, while a logic one is represented by not sending a
As detailed in the IrDA 1.0 SIR, the UART can be con- 14.3 CLOCK SUPPORT
figured to support a low-power reception mode. When The UART has two system clocks (pclk and sclk). Hav-
the UART is configured in this mode, the reception of ing the second asynchronous serial clock (sclk) imple-
SIR pulses of 1.41 s (minimum pulse duration) is pos- mented accommodates accurate serial baud rate
sible, as well as nominal 3/16th of a normal serial bit settings, as well as APB bus interface requirements.
time. Using this low-power reception mode requires
programming the Low Power Divisor Latch (LPDLL/ With the two clock design a synchronization module is
LPDLH) registers. It should be noted that for all sclk implemented for synchronization of all control and data
frequencies greater than or equal to 7.37 MHz (and across the two system clock boundaries.
obey the requirements of the Low Power Divisor Latch A serial clock faster than four-times the PCLK does not
registers), pulses of 1.41 s are detectable. However leave enough time for a complete incoming character
there are several values of sclk that do not allow the to be received and pushed into the receiver FIFO.
detection of such a narrow pulse and these are as fol- However, in most cases, the PCLK signal is faster than
lows: the serial clock and this should never be an issue.
Table 20: Low Power Divisor Latch Register Values The serial clock modules must have time to see new
register values and reset their respective state
Min. Pulse machines. This total time is guaranteed to be no more
Low Power Divisor than eight clock cycles of the slower of the two system
SCLK Width for
Latch Register Value clocks. Therefore, no data should be transmitted or
Detection
received before this maximum time expires, after initial
1.84 MHz 1 3.77 s configuration.
3.69 MHz 2 2.086 s
For a clear view of the baud rate generation and the
5.33 MHz 3 1.584 s constraints, please refer to section 11.4.
Figure 34: Flowchart of Interrupt Generation for Programmable THRE Interrupt Mode
This threshold level is programmed into FCR[5:4]. The occurs and there is data to transmit”, instead of waiting
available empty thresholds are: empty, 2, ¼ and ½. until the FIFO is completely empty. Waiting until the
See UART_FCR_REG for threshold setting details. FIFO is empty causes a performance hit whenever the
Selection of the best threshold value depends on the system is too busy to respond immediately.
system's ability to begin a new transmission sequence
Even if everything else is selected and enabled, if the
in a timely manner. However, one of these thresholds
FIFOs are disabled via FCR[0], the Programmable
should prove optimum in increasing system perfor-
THRE Interrupt mode is also disabled. When not
mance by preventing the transmitter FIFO from running
selected or disabled, THRE interrupts and LSR[5] func-
empty.
tion normally (both reflecting an empty THR or FIFO).
In addition to the interrupt change, Line Status Register The flowchart of THRE interrupt generation when not in
(LSR[5]) also switches function from indicating trans- programmable THRE interrupt mode is shown in
mitter FIFO empty, to FIFO full. This allows software to Figure 35.
fill the FIFO each transmit sequence by polling LSR[5]
before writing another character. The flow then
becomes, “fill transmitter FIFO whenever an interrupt
Figure 35: Flowchart of Interrupt Generation When Not in Programmable THRE Interrupt Mode
SPI_INT
SPI_SMn SPI_FORCE_DO
SPI clock SPI_DO
IO buffer SPI_RST
SPI_CLK SPI_9BIT_VAL
SPI_ON
rx_req RX-FIFO
SPI_PHA SPI_POL
clear_rx_req SPI_RX_REG0 SPI_RX_REG1
SPI_EN_CTRL
APB bus
Px_MODE_REG[] Port x
Slave Mode (all 0’s after reset). This means that no dummy writes
are needed for reads only transfers.
The slave mode is selected with SPI_SMn set to 1 and
the Px_MODE_REG must also select SPI_CLK as In Slave Mode transfers only take place if the external
input. The functionality of the IO buffer in slave and master initiates them, but in master mode this means
master mode is identical. The SPI module clocks data that transfers will continue until the RX-FIFO is full. If
in on SPI_DI and out on SPI_DO on every active edge this happens SPI_CTRL_REG1[SPI_BUSY] will
of SPI_CLK. As shown in Figure 37 to Figure 40. The become ‘0’. If exactly N words need to be read from
SPI has an active low clock enable SPI_EN, which can SPI device, first read (N - fifosize+1) words. Then wait
be enabled with bit SPI_EN_CTRL=1. until the SPI_BUSY becomes ‘0’, set
SPI_FIFO_MODE to “00” and finally read the remain-
In slave mode the internal SPI clock must be more than
ing (fifosize +1) words. Here fifosize is 4/2/1 words for
four times the SPI_CLK
8/16/32 bits mode respectively.
In slave mode the SPI_EN serves as a clock enable
If this is not done, more data will be read from the SPI
and bit synchronization If enabled with bit
device until the FIFO is completely filled, or the SPI is
SPI_EN_CTRL. As soon as SPI_EN is deactivated
turned off.
between the MSB and LSB bits, the I/O buffer is reset.
Bidirectional Transfers with FIFO
SPI_POL and SPI_PHA
If SPI_FIFO_MODE is “00“, both registers are used as
The phase and polarity of the serial clock can be
a FIFO. SPI_TXH indicates that TX-FIFO is full,
changed with bits SPI_POL and SPI_PHA in the
SPI_INT indicates that there is data in the RX-FIFO.
SPI_CTRL_REG.
SPI_DO Idle Levels 15.2 9 BITS MODE
The idle level of signal SPI_DO depends on the master The 9 bits mode can be used to support 9 bits displays
or slave mode and polarity and phase mode of the and is selected with SPI_CTRL_REG[SPI_WORD] set
clock. to ‘11’. The value of the 9th bit, set in the
SPI_CTRL_REG1[SPI_9BIT_VAL] and is used to
In master mode pin SPI_DO gets the value of bit determine if the next 8 bits form a command word or
SPI_DO if the SPI is idle in all modes. Also if slave in data word. Because the 9th bit is not part of the data,
SPI modes 0 and 2, SPI_DO is the initial and final idle the FIFOs are still used in the 8 bits mode. The 9th bit
level. is received but not saved because it is shifted out of the
In SPI modes 1 and 3 however there is no clock edge 8 bits shift register upon reception.
after the sampled lsb and pin SPI_DO gets the lsb
value of the IO buffer. If required, the SPI_DO can be
forced to the SPI_DO bit level by resetting the SPI to
the idle state by shortly setting bit SPI_RST to 1.
(Optionally SPI_FORCE_DO can be set, but this does
not reset the IO buffer). The following diagrams show
the timing of the SPITM interface.
Writes Only Mode
In “writes only” mode (SPI_FIFO_MODE = “10“) only
the TX-FIFO is used. Received data will be copied to
the SPI_RX_TX_REGx, but if a new SPI transfer is fin-
ished before the old data is read from the memory, this
register will be overwritten.
SPI_INT acts as a tx_request signal, indicating that
there is still place in the FIFO. It will be ‘0’ when the
FIFO is full or else ‘1’ when it’s not full. This is also indi-
cated in the SPI_CTRL_REG[SPI_TXH], which is ‘1’ if
the TX-FIFO is full. Writing to the FIFO if this bit is still
1, will result in transmission of undefined data. If all
data has been transferred, SPI_CTRL_REG1
[SPI_BUSY] will become ‘0’.
Reads Only Mode
In “reads only” mode (SPI_FIFO_MODE = “01“) only
the RX-FIFO is used. Transfers will start immediately
when the SPI is turned on in this mode. In transmit
direction the SPI_DO pin will transmit the IO buffer
contents being the actual value of the SPI_TX_REGx
SPI_CLK
SPI_EN (Slave)
Note 15: If 9 bits SPI mode, the MSB bit in transmit direction is determined by bit SPI_CTRL_REG[SPI_9BIT_VAL]. In receive direction, the MSB is
received but not stored.
SPI_CLK
SPI_EN (Slave)
SPI_CLK
SPI_EN (Slave)
SPI_CLK
SPI_EN (Slave)
16 Quadrature Decoder
The DA14580 has a integrated quadrature decoder
that can automatically decode the signals for the X, Y
and Z axes of a HID input device, reporting step count
QD_CHA_X
and direction. This block can be used for waking up the
chip as soon as there is any kind of movement from the QD_CHB_X
external device connected to it. The block diagram of
the quadrature decoder is presented in Figure 41.
Figure 43: Moving Backwards on Axis X
Features
• Three 16-bit signed counters that provide the step Depending on whether channel A or channel B is lead-
count and direction on each of the axes (X, Y and Z) ing in phase, the quadrature decoding block calculates
• Programmable system clock sampling at maximum the direction on the related axis. Furthermore, the
16 MHz. signed counter value represents the number of steps
moved.
• APB interface for control and programming
Since six channels are required (two for each axis), all
• Programmable source from P0, P1 and P2 ports
P0 and P1 signals and some of the P2 port can be
• Digital filter on the channel inputs to avoid spikes mapped onto this block. The user can choose which
GPIOs to use for the channels by programming the
QDEC_CTRL2_REG register.
The digital filter eliminates any spike shorter than two
APB Interface
clock periods. The counter holds the movement events
Register File
of the channel. When a channel is disabled the counter
is reset. The counters are accessible via the APB bus.
16-bit Counter
Filter
16-bit Counter
Filter
QD_CHB_Y (Y Axis)
QD_CHA_Z
Digital
16-bit Counter
Filter
QD_CHB_Z (Z Axis)
Quad_Dec_IRQn
Interrupt Generator
QD_CHA_X
QD_CHB_X
P00
wkup_pol_p0_reg[0] +
wkup_select_p0_reg[0] &
. DEBOUNCE TIMER EVENT
. COUNTER WUPCT_IRQ
P37
wkup_pol_p3_reg[7] + .
> key_hit
wkup_select_p3_reg[7] &
WKUP_COMPARE_REG
wkup_ctrl_reg[6]
A LOW to HIGH level transition on the selected input A minimum pulse duration of 2 sleep clock cycles must
port, while WKUP_POL_Px_REG[y] = 0, sets internal be applied to the GPIO to ensure a successful system
signal “key_hit” to ‘1’. This signal triggers the event wake-up.
counter state machine as shown in Figure 45.
If the event counter is equal to the value set in the
The debounce timer is loaded with value
WKUP_COMPARE_REG register, the counter will be
WKUP_CTRL_REG[WKUP_DEB_VALUE]. The timer
reset and an interrupt will be generated, if it was
counts down every 1 ms. If the timer reaches 0 and the
enabled by WKUP_CTRL_REG[ENABLE_IRQ].
“key_hit” signal is still ‘1’, the event counter will be
incremented. The interrupt can be cleared by writing any value to
register WKUP_RESET_IRQ_REG.
The event counter is edge sensitive. After detecting an
The event counter can be reset by writing any value to
active edge a reverse edge must be detected first
register WKUP_RESET_CNTR_REG.
before it goes back to the IDLE state and from there
The value of the event counter can be read at any time
starts waiting for a new active edge.
by reading register WKUP_COUNTER_REG.
RST
IDLE
key_hit = 1
timer = DEBOUNCE
key_hit = 0 key_hit = 0 and
timer = 0
KEY_PRESSED timer not 0
key_hit = 1
key_hit = 1 and
KEY_RELEASE timer = 0
event_count = event_count +1
Figure 45: Event Counter State Machine for the Wake-Up Interrupt Generator
1 0 1 0
loadnew loadnew
T0-toggle 0 1
T0-counter=0 1 0
ON-counter 1 0
loadnew -1
loadnew LSBreg MSBreg
T0-counter
LSBreg MSBreg
TIM0_INT
Interrupt generation: If T0-counter = 0 then Compare T0_ge_M0
PWM mode: T0_toggle = ~T0_toggle
loadnew if (T0_toggle=0 and
ON-counter=0) OR
TIM0_CTRL =0->1 If PWM_MODE = 1 then AND signal with clock PWM0
to GPIO
If PWM_MODE = 1 then AND signal with clock PWM1
December 13, 2012
Figure 46 shows the block diagram of Timer 0. The 16 selected by default with bit TIM0_CLK_SEL in the
bits timer consists of two counters: T0-counter and ON- TIMER0_CTRL_REG register. This ‘slow’ clock has no
counter, and three registers: enabling bit. The other four options can be selected by
TIMER0_RELOAD_M_REG, setting the TIM0_CLK_SEL bit and the TMR_ENABLE
TIMER0_RELOAD_N_REG and TIMER0_ON_REG. bit in the CLK_PER_REG (default disabled). This reg-
Upon reset, the counter and register values are ister also controls the frequency via the TMR_DIV bits.
0x0000. Timer 0 will generate a Pulse Width Modulated An extra clock divider is available that can be activated
signal PWM0. The frequency and duty cycle of PWM0 via bit TIM0_CLK_DIV of the timer control register
are determined by the contents of the TIMER0_CTRL_REG. This clock divider is only used
TIMER0_RELOAD_N_REG and the for the ON-counter and always divides by 10.
TIMER0_RELOAD_M_REG registers.
Timer 0 operates in PWM mode. The signals PWM0
The timer can run at five different clocks: 16 MHz, and PWM1 can be mapped to any GPIOs.
8 MHz, 4 MHz, 2 MHz or 32 kHz. The 32 kHz clock is
Datasheet Revision 3.4 09-Nov-2016
CFR0011-120-01 56 of 234 © 2014 Dialog Semiconductor
DA14580
Bluetooth Low Energy 4.2 SoC FINAL
clk
TIM0_CTRL
M N M N M N
T0-counter 0 1 0 1 0 1 0 1 0 1 0 1
ON-counter 0 4 3 2 1 0 4 3 2
PWM0 pin
PWM1 pin
SWTIM_IRQ
M0=1 N0=1 ON=4
TIM0580-01
At start-up both counters and the PWM0 signal are counter registers ON-counter and T0-counter can be
LOW so also at start-up an interrupt is generated. If read. When reading from the address of the ON-regis-
Timer 0 is disabled all flip-flops, counters and outputs ter, the value of the ON-counter is returned. Reading
are in reset state except for the ON-register, the from the address of either the
TIMER0_RELOAD_N_REG register and the TIMER0_RELOAD_N_REG or the
TIMER0_RELOAD_M_REG register. TIMER0_RELOAD_M_REG register, returns the value
of the T0-counter.
The timer input registers ON-register,
TIMER0_RELOAD_N_REGand It is possible to freeze Timer 0 with bit FRZ_SWTIM of
TIMER0_RELOAD_M_REG can be written and the the register SET_FREEZE_REG. When the timer is fro-
zen the timer counters are not decremented. This will • Input clock frequency:
freeze all the timer registers at their last value. The
timer will continue its operation again when bit f IN = sys_clk
------------------- with N = 1, 2, 4 or 8
N
FRZ_SWTIM is cleared via register and sys_clk = 16 MHz or 32 kHz
RESET_FREEZE_REG.
• Programmable output frequency:
18.2 TIMER 2 f IN f IN
Timer 2 has three Pulse Width Modulated (PWM) out- f OUT = ------ to -----------------
-
2 2 14 – 1
puts. The block diagram in shown in Figure 48.
Features • Three outputs with programmable duty cycle from
0 % to 100 %
• 14-bit general purpose timer
• Used for white LED intensity (on/off) control
• Ability to generate 3 Pulse Width Modulated signals
(PWM2, PWM3 and PWM4)
Timer 2
System bus
13 0 13 0 13 0 13 0
Reset T2_PWM3
Set
equal3
3x14 bits equal1
Comparators
equal2
Reset
T2_PWM1
14 bits Set
sys_clk DIV
1/2/4/8 T2_DUTY_CNTR
Hold reset
+1
14 bits
/Reset block
=0
T2_FREQ_CNTR
+1 Reset T2_PWM2
TRIPLE_PWM_ENABLE Set
TRIPLE_PWM_CTRL_REG -1
SW_PAUSE_EN
RX_EN
TRIPLE_PWM_CTRL_REG
TX_EN HW_PAUSE_EN
The Timer 2 is clocked with the system clock divided by duty cycle of the T2_PWMn output signal. After the
TMR_DIV (1, 2, 4 or 8) and can be enabled with block is enabled, the counter starts from 0. If
TRIPLE_PWM_CTRL_REG[TRIPLE_PWM_ENABLE]. T2_DUTY_CNTR is equal to the value stored in the
respective PWMn_DUTY_CYCLE register, this resets
T2_FREQ_CNTR determines the output frequency of
the T2_PWMn output to 0. T2_DUTY_CNTR is reset
the T2_PMWn output. This counter counts down from
when TRIPLE_PWM_FREQUENCY is 0.
the value stored in register
TRIPLE_PWM_FREQUENCY. At counter value 0, Note that the value of PWMn_DUTY_CYCLE must be
T2_FREQ_CNTR sets the T2_PWMn output to ‘1’ and less or equal than TRIPLE_PWM_FREQUENCY.
the counter is reloaded again.
The Timer 2 is enabled/disabled by programming the
T2_DUTY_CNTR is an up-counter that determines the TRIPLE_PWM_CTRL_REG[TRIPLE_PWM_EN] bit.
The timing diagram of Timer 2 is shown in Figure 49. nals are zero), T2_DUTY_CNTR resumes counting
and finalizes the remaining part of the PWM duty cycle.
Freeze Function
TRIPLE_PWM_CTRL_REG[SW_PAUSE_EN] can be
During RF activity it may be desirable to temporarily
set to ‘0’ to disable the automatic, hardware driven
suppress the PWM switching noise. This can be done
freeze function of the duty counter and keep the duty
by setting
cycle constant.
TRIPLE_PWM_CTRL_REG[HW_PAUSE_EN] = 1.
The effect is that whenever there is a transmission or a Note that the RX_EN and TX_EN signals are not soft-
reception process from the Radio, T2_DUTY_CNTR is ware driven but controlled by the BLE core hardware.
frozen and T2_PWMx output is switched to ‘0’ to dis-
able the selected T2_PWM1, T2_PWM2, T2_PWM3.
As soon as the Radio is idle (i.e. RX_EN or TX_EN sig-
TMR2_CLK
TRIPLE_PWN_EN
T2_DUTY_CNTR 0 0 1 2 2 2 3 .. ... 0 1 2 3
T2_PWMn
The 8 bits watchdog timer is decremented by 1 every address zero. Refer to the “POR/Reset” chapter for an
10.24 ms. The timer value can be accessed through overview of the complete reset circuit and conditions.
the WATCHDOG_REG register which is set to 255
For debugging purposes, the Cortex-M0 Debug
(FF16) at reset. This results in a maximum watchdog
module can always freeze the watchdog by setting the
time-out of ~2.6 s. During write access the DHCSR[DBGKEY | C_HALT | C_DEBUGEN] control
WATCHDOG_REG[WDOG_WEN] bits must be 0. This bits (reflected by the status bit S_HALT). This is
provides extra filtering for a software run-away writing automatically done by the debug tool, e.g. during step-
all ones to the WATCHDOG_REG. If the watchdog by-step debugging. Note that this bit also freezes the
counter reaches 0, the counter value will get a negative Wake-up Timer, the Software Timer and the BLE
value by setting bit 8. The counter sequence becomes master clock. For additional information also see the
1, 0, 1FF16 (-1), 1FE16(-2),...1F016 (-16). DEBUG_REG[DEBUGS_FREEZE_EN] mask register.
If WATCHDOG_CTRL_REG[NMI_RST] = 0, the The C_DEBUGEN bit is not accessible by the user
watchdog timer will generate an NMI if the watchdog software to prevent freezing the watchdog.
timer reaches 0 and a WDOG reset if the counter In addition to the S_HALT bit, the watchdog timer can
becomes less or equal to -16 (1F016). The NMI handler also be frozen if NMI_RST=0 and SET_FREEZE_REG
must write any value > -16 to the WATCHDOG_REG to [FRZ_WDOG] is set to ‘1’. The watchdog timer
prevent the generation of a WDOG reset at counter resumes counting when
value -16 after 16*10.24 = 163.8 ms. RESET_FREEZE_REG[FRZ_WDOG] is set to ‘1’. The
WATCHDOG_CTRL_REG[NMI_RST] bit can only be
If WATCHDOG_CTRL_REG[NMI_RST] = 1, the
set by software and will only be reset on a SYS reset.
watchdog timer generates a WDOG reset if the timer
Note that if the system is not remapped, i.e. SysRAM is
becomes less or equal than 0.
at address 0x20000000, then a watchdog fire will trig-
The WDOG reset is one of the SYS (system) reset ger the BootROM code to be executed again.
sources and resets the whole device, including setting
the WATCHDOG_REG register to 255, except for the
RST pin, the Power On reset, the HW reset and the
DBG (debug module) reset. Since the HW reset is not
triggered, the SYS_CTRL_REG[REMAP_ADR0] bits
will retain their value and the Cortex-M0 will start exe-
cuting again from the current selected memory at
Datasheet Revision 3.4 09-Nov-2016
CFR0011-120-01 60 of 234 © 2014 Dialog Semiconductor
DA14580
Bluetooth Low Energy 4.2 SoC FINAL
INPUT_LEVELx
INPUT_LEVELx
DEBOUNCE TIMER
input1 GPIOx_IRQ
.
. + key_hit
.
edge/leveln
.
input32
KBRD_LEVEL KBRD_Pxx_ENABLE
&
input1
.
+ DEBOUNCE TIMER
. . KEYBR_IRQ
key_hit
.
.
.
input32 + . edge/leveln
Keyboard Scanner
with GPIO_DEBOUNCE_REG[DEB_ENABLEx]. For detecting both signal edges the edge polarity
INPUT_LEVELx must be inverted in the
The interrupt flag will remain set until it is reset by writ-
WAIT_FOR_RELEASE state. This will result in
ing to the corresponding bit in the
“key_hit” = 0 and will advance the state machine to the
GPIO_RESET_IRQ_REG register. When the GPIO
Idle state, allowing detection of the next inverted edge.
interrupt is edge sensitive, selected with bit
GPIO_INT_LEVEL_CTRL_REG[EDGE_LEVELNx],
the state machine will progress to state
WAIT_FOR_RELEASE when the interrupt is reset. It
will progress to the IDLE state only after detecting the
non-active edge.
RST KEYBR_IRQ = 0
key_hit = 1
IDLE debounce = 0
key_hit = 1
key_hit = 0 and timer = DEBOUNCE
KEYBR_IRQ = 1 timer = 0
KEY_RELEASED KEY_PRESSED timer not 0
key_hit = 1 and
timer = 0 key_hit = 0 and key_hit = 1 and
key_hit = 0 and KEY_REL = 0 timer = 0
timer = 0
key_hit = 0 KEYB_INT = 0
and KEY_REL = 1
KEY_RELEASING KEY_VALID KEYBR_IRQ
timer = DEBOUNCE
key_hit = 0 and
timer not 0 KEY_REL = 0 KEYBR_IRQ = 1
key_hit = 0 and key_hit = 1 and
KEY_REPEAT != 0 key_hit = 1 and
KEY_REL = 1 and timer = 0
debounce > 0
key_hit = 0 and KEY_REPEAT timer = KEY_REPEAT
KEY_REL = 1 and
debounce = 0 timer not 0
RST GPIOx_IRQ = 0
IDLE
key_hit = 1 and DEB_ENABLE_KBRD = 1
key_hit = 0 timer = DEBOUNCE
key_hit = 1
key_hit = 0 and
timer = 0
WAIT_FOR_RELEASE
KEY_PRESSED timer not 0
key_hit = 1 and
GPIOx_IRQ = 0
DEB_ENABLE_KBRD = 0 GPIOx_IRQ = 0
reset_interrupt = 1 and
edge_leveln = 0 key_hit = 1 and
timer = 0
reset_interrupt = 1 and
edge_leveln = 1
KEY_VALID reset_int = 0
GPIOx_IRQ = 1
Px[y]
Peripheral X input
Px_DATA_REG (input)
VBAT3V or VBAT1V
PUPD
Px_MODE_REG
PID
Peripheral X output
Px[y] Peripheral Y output Px_RESET_OUTPUT_DATA_REG
Px_DATA_REG (output)
Px_SET_OUTPUT_DATA_REG
VSS
Figure 54: Port P0, P1, P2 and P3 with Programmable Pin Assignment
21.2.1 Port Data Register 21.2.2 Port Set Data Output Register
The registers input Px_DATA_REG and output Writing a 1 in the set data output register
Px_DATA_REG are mapped on the same address. (Px_SET_OUTPUT_DATA_REG) sets the correspond-
ing output pin. Writing a 0 is ignored.
The data input register (Px_DATA_REG) is a read-only
register that returns the current state on each port pin
21.2.3 Port Reset Data Output Register
even if the output direction is selected, regardless of
the programmed PID, unless the analog function is Writing a 1 in the reset data output register
selected (in this case it reads 0). The ARM CPU can (Px_RESET_OUTPUT_DATA_REG) resets the corre-
read this register at any time even when the pin is con- sponding output pin. Writing a 0 is ignored.
figured as an output.
21.3 FIXED ASSIGNMENT FUNCTIONALITY
The data output register (Px_DATA_REG) holds the
data to be driven on the output port pins. In this config- There are certain signals that have a fixed mapping on
uration, writing to the register changes the output specific general purpose IOs. This assignment is illus-
value. trated in the following table:
Note 16: The ADC case can be selected by the PID bit field on the respective P port. However, the mapping of the Quad Decoder signals on the
respective pins, is overruled by the QDEC_CTRL_REG[CHx_PORT_SEL] register. Furthermore, the SWD signals mapping is defined by
SYS_CTRL_REG[DEBUGGER_ENABLE]. However, these signals are mapped on the ports by default.
GP_ADC_SEL
General Purpose ADC
P0_0
P0_1
GP_ADC_SE
P0_2 VDCDC
1
P0_3 GP_ADC_ATTN3X
1.2V
P0_0 0 LDO
GP_ADC_ATTN3X Vref=1.2V
P0_2
200kOhm
ADC
P0_1 100kOhm
100kOhm
P0_3
VDCDC
VBAT3V
VBAT1V
VDD_RTT
AVS
VDD_REF
GP_ADC_SE
200kOhm
GP_ADC_ATTN3X
GP_ADC_ATTN3X
22.1 INPUT CHANNELS AND INPUT SCALE Single-ended or differential operation is selected via bit
The DA14580 has a multiplexer between the ADC and GP_ADC_CTRL_REG[GP_ADC_SEL]. In differential
four specific GPIO ports (P0_0 to P0_3). Furthermore, mode the voltage difference between two GPIO input
the ADC can also be used to monitor the battery volt- ports will be converted. Via bit
age and several internal voltages of the system (see GP_ADC_CTRL2_REG[GP_ADC_ATTN3X] the input
GP_ADC_CTRL_REG). scale can be enlarged by a factor of three, as summa-
rized in Table 23.
22.2 STARTING THE ADC AND SAMPLING RATE power, except for the LDO which consumes less than
The GPADC is a dynamic ADC and consumes no static 5 A.
Enabling/disabling of the ADC is triggered by configur- to zero. Bit GP_ADC_IDYN enables a 10 A load cur-
ing bit GP_ADC_CTRL_REG[GP_ADC_LDO_EN]. rent during sampling phase so that the load current
After enabling the LDO, a settling time of 20 s is during sampling and conversion phase becomes
required before an AD-conversion can be started. approximately the same.
Each conversion has two phases: the sampling phase 22.4 CHOPPING
and the conversion phase. When bit
GP_ADC_CTRL_REG[GP_ADC_EN] is set to ‘1’, the Chopping is a technique to cancel offset by taking two
ADC continuously tracks (samples) the selected input samples with opposite signal polarity. This method also
voltage. Writing a '1' at bit smooths out other non-ideal effects and is recom-
GP_ADC_CTRL_REG[GP_ADC_START] ends the mended for DC and slowly changing signals.
sampling phase and triggers the conversion phase. Chopping is enabled by setting bit
When the conversion is ready, the ADC resets bit GP_ADC_CTRL_REG[GP_ADC_CHOP] to ‘1’.
GP_ADC_START to ‘0’ and returns to the sampling
phase. The mid-scale value of the ADC is the 'natural' zero
point of the ADC (ADC result = 511.5 = 1FF or 200 Hex
The conversion itself is fast and takes approximately = 01.1111.1111 or 10.0000.0000 Bin). Ideally this corre-
one clock cycle of 16 MHz, though the data handling sponds to Vi = 1.2 V/2 = 0.6 V in single-ended mode
will require several additional clock cycles, depending and Vi = 0.0 V in differential mode.
on the software code style. The fastest code can han-
dle the data in four clock cycles of 16 MHz, resulting to If bit GP_ADC_CTRL2_REG[GP_ADC_ATTN3X] is set
a highest sampling rate of 16 MHz/5 = 3.3 Msample/s. to ‘1’, the zero point is 3 times higher (1.8 V single-
ended and 0.0 V differential).
At full speed the ADC consumes approximately 50 A.
If the data rate is less than 100 ksample/s, the current With bit GP_ADC_CTRL_REG[GP_ADC_MUTE], the
consumption will be in the range of 5 A. ADC input is switched to the centre scale input level,
so the ADC result ideally is 511.5. If instead a value of
22.3 NON-IDEAL EFFECTS 515 is observed, the output offset is +3.5 (adc_off_p =
Besides Differential Non-Linearity (DNL) and Integral 3.5).
Non-Linearity (INL), each ADC has a gain error (linear) With bit GP_ADC_CTRL_REG[GP_ADC_SIGN] the
and an offset error (linear). The gain error of the sign of the ADC input and output is changed. Two sign
GPADC slightly reduces the effective input scale (up to changes have no effect on the signal path, though the
50 mV). The offset error causes the effective input sign of the ADC offset will change.
scale to become non-centred. The offset error of the
GPADC is less than 20 mV and can be reduced by If adc_off_p = 3.5 the ADC_result with opposite
chopping or by offset calibration. GP_ADC_SIGN will be 508. The sum of these equals
515 + 508 = 1023. This is the mid-scale value of an 11-
The ADC result will also include some noise. If the bit ADC, so one extra bit due to the over-sampling by a
input signal itself is noise free (inductive effects factor of two.
included), the average noise level will be ±1 LSB. Tak-
ing more samples and calculating the average value The LSB of this 11-bit word should be ignored if a 10-
will reduce the noise and increase the resolution. bit word is preferred. In that case the result is 511.5, so
the actual output value will be 511 or 512.
With a 'perfect' input signal (e.g. if a filter capacitor is
placed close to the input pin) most of the noise comes 22.5 OFFSET CALIBRATION
from the low-power voltage regulator (LDO) of the A relative high offset caused by a very small dynamic
ADC. Since the DA14580 is targeted for ultra-compact comparator (up to 20 mV, so approximately 20 LSB).
applications, there is no pin available to add a capaci-
tor at this voltage regulator output. This offset can be cancelled with the chopping function,
but it still causes unwanted saturation effects at zero
The dynamic current of the ADC causes extra noise at scale or full scale. With the GP_ADC_OFFP and
the regulator output. This noise can be reduced by set- GP_ADC_OFFN registers the offset can be compen-
ting bits GP_ADC_CTRL2_REG[GP_ADC_I20U] and sated in the ADC network itself.
GP_ADC_CTRL2_REG[GP_ADC_IDYN] to ‘1’. Bit
GP_ADC_I20U enables a constant 20 A load current To calibrate the ADC follow the steps in Table 24.
at the regulator output so that the current will not drop
Table 24: GPADC Calibration Procedure for Single-Ended and Differential Modes
Table 24: GPADC Calibration Procedure for Single-Ended and Differential Modes
It is recommended to implement the above calibration scale level so the input impedance is infinite.
routine during the initialization phase of the DA14580.
At 100 ksample/s, zero or full-scale single-ended input
To verify the calibration results, check whether the
signal, this sampling capacitor will load the input with:
GP_ADC_RESULT value is close to 0x200 while bit
ILOAD = V * C * fS = ±0.6 V * 0.2 pF * 100 kHz = ±12 nA
GP_ADC_MUTE = 1.
(differential: ±1.2 V * 0.2 pF * 100 kHz = ±24 nA at both
22.6 ZERO-SCALE ADJUSTMENT pins).
The GP_ADC_OFFP and GP_ADC_OFFN registers During sampling phase a certain settling time is
can also be used to set the zero-scale or full-scale required. A 10-bit accuracy requires at least 7 time
input level at a certain target value. For instance, they constants of the output impedance of the input signal
can be used to calibrate GP_ADC_RESULT to 0x000 source and the 0.2 pF sampling capacitor. The conver-
at an input voltage of exactly 0.0 V, or to calibrate the sion time is approximately one clock cycle of 16 MHz
zero scale of a sensor. (62.5 ns).
< 3.3 V
VBATxV-levels
VBAT1V SWITCH
Alkaline cell
(0.9 V to 1.8 V) LDO LDO LDO
RET SYS various
Lithium coin-cell
VDD
(2.35 V to 3.3 V)
enable_buck on Dig.
buck conv. core ADC
Retention VDD
PMU 16 MHz
32 kHz memories
Figure 56: Block Diagram of the Analog Power Block and Internal Interconnections
The Power Block contains a DC-DC converter which 4. LDO (various): This a group of LDOs used for the
can be configured to operate as a Step-Up or a Step- elaborate control of the powering up/down of the
Down converter. The converter provides power to four Radio, the GP ADC and the XTAL16M oscillator.
LDO groups in the system:
There are two ways of connecting external batteries to
1. LDO RET: This is the LDO providing power to the the Power Block of the DA14580. They depend on the
Retention domain (PD_AON). It powers the Retention specific battery cell used and its voltage range. Battery
RAMs and the digital part which is always on. cells are distinguished into Lithium coin cells (2.35 V to
3.3 V) and Alkaline cells (1.0 V to 1.8 V). The connec-
2. LDO OTP: This is the LDO powering the OTP macro
tion diagrams are presented in Figure 58 and Figure 57
cell. This is the reason for using the step-up DC-DC
respectively:
converter when running from an Alkaline battery.
3. LDO SYS: This is the LDO providing the system with
the actual VDD power required for the digital part to
operate. Note that the Power Block implements seam-
less switching from the LDO SYS to the LDO RET
when the system enters Deep Sleep mode. In the latter
case, a low voltage is applied to the PD_AON power
domain to further reduce leakage.
VDCDC_RF
VBAT_RF
2.35 V to 3.3 V
SWITCH
VBAT3V
VDCDC
Lithium
coin-cell
LDO LDO
LDO
analog/RF
digital analog/RF
retention
VBAT1V
Buck Converter
DA14580
0.9 V to 2.0 V
VBAT1V SWITCH
Boost Converter
VDCDC_RF
LDO LDO LDO
VBAT_RF
digital analog/RF
retention
DA14580
DC‐DC Efficiency vs Voltage
95%
90%
85%
80%
75%
70%
65%
60%
55%
50% 0.9 1.8 2.35
0 0.5 1 1.5 2 2.5 3 3.5
Buck Boost Boost (Vout > 1.4 V)
AHB AHB
Slave Master
Control
Radio Frequency Interrupt AES
Memory Controller
Controller Selection Generator CCM
Data
Packet Event White List Event
Whitening CRC
Controller Controller Search Scheduler
Case 0 Case 1 Case 2 Case 3 Case 4 Case 5 Case 6 Case 7 Case 9 Case 10 Case 11
i.e. no remap (BLE EM: 2 kB) (BLE EM: 3 kB) (BLE EM: 4 kB) (BLE EM: 5 kB) (BLE EM:6 kB) (BLE EM: 7 kB) (BLE EM: 8 kB) (BLE EM: 4 kB) (BLE EM: 5 kB) (BLE EM: 6 kB)
(BLE EM: 0 kB) (SysRAM: 48 kB) (SysRAM: 47 kB) (SysRAM: 46 kB) (SysRAM: 45 kB) (SysRAM: 44 kB) (SysRAM: 43 kB) (SysRAM: 42 kB) (SysRAM: 40 kB) (SysRAM: 40 kB) (SysRAM: 40 kB)
(SysRAM: 42 kB)
0x2000.C000
RetRAM4
1 kB
RetRAM3 RetRAM3
2 kB 2 kB RetRAM4
1 kB
RetRAM4
1 kB
RetRAM2 RetRAM2 RetRAM2
3 kB 3 kB 3 kB RetRAM3 RetRAM3
2 kB 2 kB RetRAM4
1 kB
0x2000.A800
SysRAM SysRAM SysRAM SysRAM SysRAM SysRAM SysRAM SysRAM
Page 0 Page 0 Page 0 Page 0 Page 0 Page 0 Page 0 Page 0
2 kB 2 kB 2 kB 2 kB 2 kB 2 kB 2 kB 2 kB
0x2000.A000
SysRAM SysRAM SysRAM SysRAM SysRAM SysRAM SysRAM SysRAM SysRAM SysRAM SysRAM
Page 1 Page 1 Page 1 Page 1 Page 1 Page 1 Page 1 Page 1 Page 1 Page 1 Page 1
2 kB 2 kB 2 kB 2 kB 2 kB 2 kB 2 kB 2 kB 2 kB 2 kB 2 kB
0x2000.9800
~ SysRAM ~~ SysRAM ~~ SysRAM ~~ SysRAM ~~ SysRAM ~~ SysRAM ~~ SysRAM ~~ SysRAM ~~ SysRAM ~~ SysRAM ~~ SysRAM
Page 2 Page 2 Page 2 Page 2 Page 2 Page 2 Page 2 Page 2 Page 2 Page 2 Page 2
38 kB 38 kB 38 kB 38 kB 38 kB 38 kB 38 kB 38 kB 38 kB 38 kB 38 kB
0x2000.0000
0x0008.3000
~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~
0x0008.2000
RetRAM4 RetRAM4
1 kB 1 kB
0x0008.0000
Case 12 Case 13 Case 14 Case 15 Case 17 Case 18 Case 19 Case 20 Case 21 Case 22 Case 23
(BLE EM: 7 kB) (BLE EM: 8 kB) (BLE EM: 9 kB) (BLE EM:10 kB) (BLE EM: 6 kB) (BLE EM: 7 kB) (BLE EM: 8 kB) (BLE EM: 9 kB) (BLE EM: 10 kB) (BLE EM: 11 kB) (BLE EM: 12 kB)
(SysRAM: 40 kB) (SysRAM: 40 kB) (SysRAM: 40 kB) (SysRAM: 40 kB) (SysRAM: 38 kB) (SysRAM: 38 kB) (SysRAM: 38 kB) (SysRAM: 38 kB) (SysRAM: 38 kB) (SysRAM: 38 kB) (SysRAM: 38 kB)
0x2000.C000
0x2000.A800
0x2000.A000
SysRAM SysRAM SysRAM SysRAM
Page 1 Page 1 Page 1 Page 1
2 kB 2 kB 2 kB 2 kB
0x2000.9800
~ SysRAM ~~ SysRAM ~~ SysRAM ~~ SysRAM ~~ SysRAM ~~ SysRAM ~~ SysRAM ~~ SysRAM ~~ SysRAM ~~ SysRAM ~~ SysRAM ~
Page 2 Page 2 Page 2 Page 2 Page 2 Page 2 Page 2 Page 2 Page 2 Page 2 Page 2
38 kB 38 kB 38 kB 38 kB 38 kB 38 kB 38 kB 38 kB 38 kB 38 kB 38 kB
0x2000.0000
0x0008.3000
~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~
SysRAM
Page 1
SysRAM 2 kB
Page 1
SysRAM SysRAM 2 kB SysRAM
Page 0 Page 1 Page 0
SysRAM 2 kB SysRAM 2 kB SysRAM 2 kB
0x0008.2000 Page 0 Page 1 Page 0
2 kB RetRAM4 2 kB 2 kB RetRAM4
SysRAM 1 kB SysRAM SysRAM 1 kB
Page 0 Page 1 Page 0
SysRAM 2 kB SysRAM 2 kB SysRAM 2 kB
RetRAM3 RetRAM3 RetRAM3 RetRAM3
Page 0 Page 1 Page 0
RetRAM4 2 kB 2 kB RetRAM4 2 kB 2 kB
2 kB SysRAM 2 kB SysRAM 2 kB
1 kB 1 kB
Page 1 Page 0
2 kB SysRAM 2 kB
Page 0
RetRAM2 RetRAM2 RetRAM2 RetRAM2 2 kB RetRAM2 RetRAM2 RetRAM2 RetRAM2
3 kB 3 kB 3 kB 3 kB SysRAM 3 kB 3 kB 3 kB 3 kB
RetRAM3
Page 0
RetRAM4 2 kB
2 kB
1 kB
0x0008.0800
RetRAM RetRAM RetRAM RetRAM RetRAM RetRAM RetRAM RetRAM RetRAM RetRAM RetRAM
2 kB 2 kB 2 kB 2 kB 2 kB 2 kB 2 kB 2 kB 2 kB 2 kB 2 kB
0x0008.0000
There are 24 different cases of mapping the Exchange TWEXT: Determines the high period of
Memory onto the 5 physical memories (4 Retention BLE_WAKEUP_LP_IRQ, in the case of an external
RAMs and 1 SysRAM) in pages of 2 kB each. They wake up event (refer to
should be selected according to the application needs GP_CONTROL_REG[BLE_WAKEUP_REQ]). Mini-
regarding the amount of the Exchange Memory. So, for mum value is "TWIRQ_RESET + X", where X is the
example, Case 15 provides 40 kB of SysRAM and number of “ble_lp_clk” clock cycles that
10 kB of Exchange Memory (8 kB using the Retention BLE_WAKEUP_LP_IRQ will be held high. Recom-
and another 2 kB page of the SysRAM cell). Hence, mended value is "TWIRQ_RESET + 1". Note that as
exchange memory requirements can be met by pro- soon as GP_CONTROL_REG[BLE_WAKEUP_REQ]
gramming the respective case in the EM_MAP field of is set to “1” the BLE_WAKEUP_LP_IRQ will be
the GP_CONTROL_REG. asserted.
If the BLE core access an Exchange Memory area that Minimum BLE Sleep Duration: The minimum value of
is out of the boundaries specified by the BLE_DEEPSLWKUP_REG[DEEPSLTIME] time, mea-
GP_CONTROL_REG[EM_MAP], then EMAC- sured in “ble_lp_clk” cycles, is the maximum of (a)
CERRSTAT bit field is asserted, causing “TWIRQ_SET + 1” and (b) the SW execution time from
BLE_ERROR_IRQ to be raised. The Interrupt Service setting BLE_DEEPSLCNTL_REG[DEEP_SLEEP_ON]
Routine can detect the error condition by accessing the up to preparing CPU to accept the
EMACCERRSTAT and can acknowledge by writing a BLE_WAKEUP_LP_IRQ (e.g. to call the ARM instruc-
“1” to EMACCERRACK. BLE_ERROR_IRQ is raised tion WFI). If programmed DEEPSLTIME is less than
when either EMACCERRSTAT or ERRORINTSTAT are the aforementioned minimum value, then
asserted. BLE_WAKEUP_LP_IRQ Handler may execute sooner
than the call of ARM WFI instruction for example, caus-
24.2 PROGRAMMING BLE WAKE UP IRQ ing SW instability.
Once BLE core switches to “BLE Deep Sleep mode”
the only way to correctly exit from this state is by ini- 24.3 SWITCH FROM ACTIVE MODE TO DEEP
tially generating the BLE_WAKEUP_LP_IRQ and con- SLEEP MODE
secutively the BLE_SLP_IRQ. This sequence must be Software can set the BLE core into the “BLE Deep
followed regardless of the cause of the termination of Sleep mode”, by first programming the timing of
the “BLE Deep Sleep mode”, i.e. regardless if the BLE BLE_WAKEUP_LP_IRQ generation, then program the
Timer expired or BLE Timer has been stopped due to desired sleep duration at BLE_DEEPSLWKUP_REG
the assertion of BLE_WAKEUP_REQ. and finally set the register bit
BLE_DEEPSLCNTL_REG[DEEP_SLEEP_ON]. The
The assertion and de-assertion of BLE Core will switch to the “ble_lp_clk” (32.0 kHz or
BLE_WAKEUP_LP_IRQ is fully controlled via the 32.768 kHz) in order to maintain its internal 625 s tim-
BLE_ENBPRESET_REG bit fields. Detailed descrip- ing reference. Software must poll the state of
tion is following: BLE_CNTL2_REG[RADIO_PWRDN_ALLOW] to
TWIRQ_SET: Number of “ble_lp_clk” cycles before the detect the completion of this mode transition. Once the
expiration of the BLE Timer, when the “ble_lp_clk” is used for base time reference, SW must
BLE_WAKEUP_LP_IRQ must be asserted. It is recom- disable the BLE clocks (“ble_master1_clk”,
mended to select a TWIRQ_SET value larger than the “ble_master2_clk” and “ble_crypt_clk”) by setting to “0”
time required for the XTAL16_TRIM_READY_DELAY the CLK_RADIO_REG[BLE_ENABLE] register bit.
event, plus the IRQ Handler execution time. If the pro- Finally, SW can optionally power down the Radio Sub-
grammed value of TWIRQ_SET is less than the mini- system by using the
mum recommended value, then the system will wake PMU_CTRL_REG[RADIO_SLEEP] and the Peripheral
up but the actual BLE sleep duration (refer to and System power domains as well.
BLE_DEEPSLSTAT_REG) will be larger than the pro- Figure 62 presents the waveforms while entering in
grammed sleep duration (refer to BLE Deep Sleep mode. In this case, SW, as soon as it
BLE_DEEPSLWKUP_REG). detects that RADIO_PWRDOWN_ALLOW is “1”, it sets
TWIRQ_RESET: Number of “ble_lp_clk” cycles before the PMU_CTRL_REG[RADIO_SLEEP] to power down
the expiration of the sleep period, when the the Radio Subsystem. At the following figures, the cor-
BLE_WAKEUP_LP_IRQ will be de-asserted. It is rec- responding BLE Core signals are marked with red
ommended to always set to “1”. while Radio Subsystem is in power down state.
ble_lp_clk
ble_master1_gclken
ble_master1_clk
tick_625us_p
deepsltime[31:0] (hld) 0 N
deep_sleep_on
radio_pwrdown_allow
deepsldur[31:0] 0 1 2 3
24.4 SWITCH FROM DEEP SLEEP MODE TO Once the SW decides that BLE Core can wake up, it
ACTIVE MODE must enable the BLE clocks (via
There are two possibilities for BLE Core to terminate CLK_RADIO_REG[BLE_ENABLE]) and power up the
the BLE Deep Sleep mode: Radio Power Domain (refer to
PMU_CTRL_REG[RADIO_SLEEP] and
1. Termination at the end of a predetermined time. SYS_STAT_REG[RAD_IS_UP]).
2. Termination on software wake-up request, due to an After the expiration of the sleep period (as specified in
external event. BLE_DEEPSLWKUP_REG[DEEPSLTIME]) the BLE
Timer will not exit the BLE Deep Sleep mode until it will
24.4.1 Switching at Anchor Points detect that BLE Core is powered up. That means that if
Figure 65 shows a typical deep sleep phase that is ter- the SW requires more time to power up the BLE Core,
minated at predetermined time. After a configurable then the final sleep duration (provided by
time before the scheduled wake up time (configured BLE_DEEPSLSTAT_REG) will be larger than the pre-
via BLE_ENBPRESET_REG register bit fields), the programmed value.
BLE Timer asserts the BLE_WAKEUP_LP_IRQ in When BLE Timer is expired, BLE clocks are enabled
order to wake-up the CPU (powering up the System and BLE Core (Radio Subsystem) is powered up, the
Power Domain). The BLE_WAKEUP_LP_IRQ Interrupt BLE Core exists the “BLE Core Deep Sleep mode” and
Handler will prepare the code environment and the asserts the BLE_SLP_IRQ.
XTAL16M oscillator stabilization (refer to
SYS_STAT_REG[XTAL16_SETTLED]) and will decide
when the BLE Core will be ready to exit from the BLE
Deep Sleep mode.
twirq_reset=1
ble_wakeup_lp_irq
ble_slp_irq
xtal16_settled
ble_enable
rad_is_up
ble_lp_clk
ble_master1_gclken
ble_master1_clk
deepsltime[31:0] (hld) N 0
deepsldur[31:0] N
finecnt[9:0]
clk_status
Figure 63 Exit BLE Deep Sleep Mode at Predetermined Time (Zoom In)
twirq_reset=1
ble_wakeup_lp_irq
ble_slp_irq
xtal16_settled
ble_enable
rad_is_up
ble_lp_clk
ble_master1_gclken
ble_master1_clk
deepsltime[31:0] (hld) N 0
deepsldur[31:0] N N+5
finecnt[9:0]
clk_status
Figure 64 Exit BLE Deep Sleep Mode Later Than the Predetermined Time (Zoom In)
(N ‐ twirq_set)
ble_wakeup_lp_irq
ble_slp_irq
sys_state down mirror powerup
xtal16_settled
ble_enable
rad_is_up
ble_master1_gclken
ble_master1_clk
deepsltime[31:0] (hld) N 0
deepsldur[31:0] N
finecnt[9:0]
tick_625us_p
Figure 65 Exit BLE Deep Sleep Mode at Predetermined Time (Zoom Out)
twext=1
sys_state down mirror powerup
wakeup_irq
ble_wakeup_req
xtal16_settled
rad_is_up
ble_wakeup_lp_irq
ble_slp_irq
deepsltime[31:0] (hld) N 0
deepsldur[31:0] K<N
finecnt[9:0]
tick_625us_p
25 Radio
The Radio Transceiver implements the RF part of the Features
Bluetooth low energy protocol. Together with the Blue- • Single ended RFIO interface, 50 matched
tooth 4.2 PHY layer, this provides a 93 dB RF link bud-
get for reliable wireless communication. • Alignment free operation
All RF blocks are supplied by on-chip low-drop out-reg- • -93 dBm receiver sensitivity
ulators (LDOs). The bias scheme is programmable per • 0 dBm transmit output power
block and optimized for minimum power consumption.
• Ultra low power consumption
The Bluetooth LE radio block diagram is given in
Figure 67. It comprises the Receiver, Transmitter, Syn- • Fast frequency tuning minimizes overhead
thesizer, Rx/Tx combiner block, and Biasing LDOs.
IFout
LNA
LNA MIX
MIX IF
IF ADC
ADC DEM
Rx
RFIO /
Tx SYNTH
Bias
LDO TESTMUX TEST[1:0]
PA /N
RFPA
SYNTH_CTRL RFCU
26 Registers
This section contains a detailed view of the DA14580 registers. It is organized as follows: An overview table is pre-
sented initially, which depicts all register names, addresses and descriptions. A detailed bit level description of each
register follows.
The register file of the ARM Cortex-M0 can be found in the following documents, available on the ARM website:
Devices Generic User Guide:
DUI0497A_cortex_m0_r0p0_generic_ug.pdf
Technical Reference Manual:
DDI0432C_cortex_m0_r0p0_trm.pdf
These documents contain the register descriptions for the Nested Vectored Interrupt Controller (NVIC), the System
Control Block (SCB) and the System Timer (SysTick).
If '0' then the positive edge is selected, when "1" the nega-
tive edge is selected.
5:3 R/W DIAGIRQ_BSEL_0 Diagnostic IRQ Bit Select 0 0
Selects the 8-bit diagnostic bus that will be used for the IRQ
generation.
Note 17: The period duration of 250 us is derived by dividing the RC16M clock signal by 4000. Consequently, the period duration may vary over tem-
perature.
Note 18: 0xF is the lowest voltage, but is too low for reliable startup at high temperature in combination with extended sleep. 0xA is 100 mV higher
and considered to be the lowest value which is safe to use. 0x0 or 0x1 is again 100 mV higher and 0x0 is the reset value. 0x4 is the maxi-
mum voltage.
Note 19: In Buck mode the output must be powered by the 3 V rail. In Boost mode the outputs can be powered by the 1 V rail or by the 3 V rail. In
Boost mode the 3 V rail can only supply a limited current, e.g. for switching a high-impedance input of an external device. See table 'Digital
input/output characteristics'.
Note 20: In Buck mode the output must be powered by the 3 V rail. In Boost mode the outputs can be powered by the 1 V rail or by the 3 V rail. In
Boost mode the 3 V rail can only supply a limited current, e.g. for switching a high-impedance input of an external device. See table 'Digital
input/output characteristics'.
Note 21: In Buck mode the output must be powered by the 3 V rail. In Boost mode the outputs can be powered by the 1 V rail or by the 3 V rail. In
Boost mode the 3 V rail can only supply a limited current, e.g. for switching a high-impedance input of an external device. See table 'Digital
input/output characteristics'.
Note 22: In Buck mode the output must be powered by the 3 V rail. In Boost mode the outputs can be powered by the 1 V rail or by the 3 V rail. In
Boost mode the 3 V rail can only supply a limited current, e.g. for switching a high-impedance input of an external device. See table 'Digital
input/output characteristics'.
27 Specifications
All MIN/MAX specification limits are guaranteed by design, production testing and/or statistical characterization. Typ-
ical values are based on characterization results at default measurement conditions and are informative only.
Default measurement conditions (unless otherwise specified): VBAT(VBAT3V) = 3.0 V (buck mode), VBAT(VBAT1V)
= 1.2 V (boost mode), TA = 25 C. All radio measurements are performed with standard RF measurement equipment
providing a source/load impedance of 50 .
The specifications in the following tables are valid for the reference circuits shown in Figure 68 (Boost mode) and
Figure 69 (Buck mode).
9%$79
9%$7 73 9%$7 %7
*1' 73 / 9$$$
9%$7 X+
933 73 9GFGF
6:&/. 73
&
6:',2 73 & &
X) X) X) 9GFGF
'
&
$
$
(
(
)
6:',2
6:B&/.
933
9'&'&B5)
9%$79
9%$7B5)
6:,7&+
& 9%$7
% ) X)
3B 9'&'& $17
% )
3B 9%$79
&
3B
&
& X)
3B
' $
3B 5),2S
' $
3B 5),2P
(
(
3B
3B
8
'$ <
0+]
( %
3B ;7$/0S
' $
3B ;7$/0P
&
3B
%
3B )
;7$/.S <
( ) N+]
567 ;7$/.P
*1'
*1'
*1'
*1'
*1'
*1'
)
'
$
'
&
%
Figure 68: Alkaline Battery Cell Powered System Diagram (Boost Mode)
6:&/. 73
& & X+
6:',2 73
X) X)
'
&
$
$
(
(
)
& $17
6:',2
6:B&/.
933
9'&'&B5)
9%$79
9%$7B5)
6:,7&+
X)
9%$7
% )
3B 9'&'&
% )
3B 9%$79
& %7
3B
& 9&RLQ
& X)
3B
' $
3B 5),2S
' $
3B 5),2P
(
(
3B
3B
8
'$ <
0+]
( %
3B ;7$/0S
' $
3B ;7$/0P
&
3B
%
3B )
;7$/.S <
( ) N +]
567 ;7$/.P
237,21$/
*1'
*1'
*1'
*1'
*1'
*1'
)
'
$
'
&
%
Figure 69: Lithium Coin Cell Powered System Diagram (Buck Mode)
Note 23: The device should not be exposed for prolonged periods of time to voltages between the Recommended Operating Conditions and the
Absolute Maximum Ratings range.
Note 24: Cold boot should not be performed if voltage is less than 2.5 V because of possible corruption during OTP data mirroring. Trim values pro-
grammed in the OTP as well as the application image, should be copied into RAM while VBAT3V >= 2.5 V.
Note 26: Using the internal varicaps a wide range of crystals can be trimmed to the required tolerance.
Note 27: Maximum allowed frequency tolerance for compensation by the internal varicap trimming mechanism.
Note 28: Select a crystal which can handle a drive-level equal or more than this specification
Note 29: Select a crystal that can handle a drive-level of at least this specification.
Note 31: A low value will result in lowest power consumption, keep this value at 1 uF or 2 uF.
Note 32: When VBAT1V > VDCDC_nominal, VDCDC will follow VBAT1V.
Note 33: In Boost mode the output source current is limited to Iout = -250 uA.
Note 34: In Boost mode the output sink current is limited to Iout = 250 uA.
Note 35: The DCDC-converter efficiency is assumed to be 100 % to enable benchmarking of the radio currents at battery supply domain (VBAT3V =
3 V).
Note 36: Measured according to Bluetooth® Low Energy Test Specification RF-PHY.TS/4.0.1, section 6.4.1.
Note 37: Measured according to Bluetooth® Low Energy Test Specification RF-PHY.TS/4.0.1, section 6.4.2.
Note 38: Measured according to Bluetooth® Core Technical Specification document, version 4.2, volume 6, section 4.4. Published value is for n =
IXIT = 4 . IXIT = 5 gives the same results, IXIT = 3 gives results that are 5 dB lower.
Note 39: Measured according to Bluetooth® Core Technical Specification document, version 4.2, volume 6, section 4.2.
Note 40: Measured according to Bluetooth® Core Technical Specification document, version 4.2, volume 6, section 4.3. Due to limitations of the
measurement equipment, levels of -5 dBm should be interpreted as > -5 dBm.
Note 41: PRF = PRSSI(min) + LRES(RSSI) x RXRSSI[7:0] ± LACC(RSSI). Thanks to constant gain biasing of RF part in the receiver, the RSSI can
be used to estimate absolute power levels, rather than mere level changes. Even across the full temperature range the variation is limited.
Note 42: Measured according to Bluetooth® Low Energy Test Specification RF-PHY.TS/4.0.1, section 6.2.3.
Note 43: To activate the "Near Field Mode", program address 0x50002418 with the value 0x0030.
Note 44: Maximum recommended connection interval (including slave latency) for the RCX usage is 2 s.
28 Package Information
28.1 MOISTURE SENSITIVITY LEVEL (MSL)
The MSL is an indicator for the maximum allowable
time period (floor life time) in which a moisture sensi-
tive plastic device, once removed from the dry bag, can
be exposed to an environment with a maximum tem-
perature of 30 °C and a maximum relative humidity of
60 % RH. before the solder reflow process.
WLCSP packages are qualified for MSL 1.
QFN packages are qualified for MSL 3.
Status Definitions
Version Datasheet Status Product Status Definition
1.<n> Target Development This datasheet contains the design specifications for product
development. Specifications may change in any manner without
notice.
2.<n> Preliminary Qualification This datasheet contains the specifications and preliminary char-
acterization data for products in pre-production. Specifications
may be changed at any time without notice in order to improve
the design.
3.<n> Final Production This datasheet contains the final specifications for products in
volume production. The specifications may be changed at any
time in order to improve the design, manufacturing and supply.
Major specification changes are communicated via Customer
Product Notifications. Datasheet changes are communicated
via www.dialog-semiconductor.com.
4.<n> Obsolete Archived This datasheet contains the specifications for discontinued
products. The information is provided for reference only.
Disclaimer
Information in this document is believed to be accurate and reliable. However, Dialog Semiconductor does not give any
representations or warranties, expressed or implied, as to the accuracy or completeness of such information. Dialog Semi-
conductor furthermore takes no responsibility whatsoever for the content in this document if provided by any information
source outside of Dialog Semiconductor.
Dialog Semiconductor reserves the right to change without notice the information published in this document, including
without limitation the specification and design of the related semiconductor products, software and applications.
Applications, software, and semiconductor products described in this document are for illustrative purposes only. Dialog
Semiconductor makes no representation or warranty that such applications, software and semiconductor products will be
suitable for the specified use without further testing or modification. Unless otherwise agreed in writing, such testing or
modification is the sole responsibility of the customer and Dialog Semiconductor excludes all liability in this respect.
Customer notes that nothing in this document may be construed as a license for customer to use the Dialog Semi-conduc-
tor products, software and applications referred to in this document. Such license must be separately sought by customer
with Dialog Semiconductor.
All use of Dialog Semiconductor products, software and applications referred to in this document are subject to Dialog
Semiconductor's Standard Terms and Conditions of Sale, available on the company website (www.dialog-semiconduc-
tor.com) unless otherwise stated.
Dialog and the Dialog logo are trademarks of Dialog Semiconductor plc or its subsidiaries. All other product or service
names are the property of their respective owners.
© 2014 Dialog Semiconductor. All rights reserved.
RoHS Compliance
Dialog Semiconductor's suppliers certify that its products are in compliance with the requirements of Directive 2011/65/EU
of the European Parliament on the restriction of the use of certain hazardous substances in electrical and electronic equip-
ment. RoHS certificates from our suppliers are available on request.