Cc2530 User Guide
Cc2530 User Guide
Cc2530 User Guide
4-GHz
IEEE 802.15.4 and ZigBee® Applications
A
CC2540/41 System-on-Chip Solution for 2.4-
GHz Bluetooth® low energy Applications
User's Guide
Preface....................................................................................................................................... 14
1 Introduction ....................................................................................................................... 17
1.1 Overview..................................................................................................................... 18
1.1.1 CPU and Memory ................................................................................................. 21
1.1.2 Clocks and Power Management ................................................................................ 21
1.1.3 Peripherals ......................................................................................................... 21
1.1.4 Radio ................................................................................................................ 23
1.2 Applications ................................................................................................................. 23
2 8051 CPU........................................................................................................................... 24
2.1 8051 CPU Introduction .................................................................................................... 25
2.2 Memory ...................................................................................................................... 25
2.2.1 Memory Map ....................................................................................................... 25
2.2.2 CPU Memory Space .............................................................................................. 27
2.2.3 Physical Memory .................................................................................................. 28
2.2.4 XDATA Memory Access .......................................................................................... 33
2.2.5 Memory Arbiter .................................................................................................... 33
2.3 CPU Registers .............................................................................................................. 34
2.3.1 Data Pointers ...................................................................................................... 34
2.3.2 Registers R0–R7 .................................................................................................. 35
2.3.3 Program Status Word ............................................................................................. 35
2.3.4 Accumulator ........................................................................................................ 36
2.3.5 B Register .......................................................................................................... 36
2.3.6 Stack Pointer ....................................................................................................... 36
2.4 Instruction Set Summary .................................................................................................. 36
2.5 Interrupts .................................................................................................................... 40
2.5.1 Interrupt Masking .................................................................................................. 41
2.5.2 Interrupt Processing............................................................................................... 45
2.5.3 Interrupt Priority.................................................................................................... 47
3 Debug Interface .................................................................................................................. 50
3.1 Debug Mode ................................................................................................................ 51
3.2 Debug Communication .................................................................................................... 51
3.3 Debug Commands ......................................................................................................... 53
3.3.1 Debug Configuration .............................................................................................. 55
3.3.2 Debug Status ...................................................................................................... 55
3.3.3 Hardware Breakpoints ............................................................................................ 56
3.4 Flash Programming ........................................................................................................ 57
3.4.1 Lock Bits ............................................................................................................ 57
3.5 Debug Interface and Power Modes ...................................................................................... 57
3.6 Registers .................................................................................................................... 59
4 Power Management and Clocks ........................................................................................... 60
4.1 Power Management Introduction ......................................................................................... 61
4.1.1 Active and Idle Modes ............................................................................................ 62
4.1.2 PM1 ................................................................................................................. 62
4.1.3 PM2 ................................................................................................................. 62
List of Figures
1-1. CC253x Block Diagram .................................................................................................... 18
1-2. CC2540 Block Diagram ................................................................................................... 19
1-3. CC2541 Block Diagram ................................................................................................... 20
2-1. XDATA Memory Space (Showing SFR and DATA Mapping) ........................................................ 26
2-2. CODE Memory Space ..................................................................................................... 26
2-3. CODE Memory Space for Running Code From SRAM ............................................................... 26
2-4. Interrupt Overview .......................................................................................................... 43
3-1. External Debug Interface Timing ......................................................................................... 51
3-2. Transmission of One Byte................................................................................................. 51
3-3. Typical Command Sequence—No Extra Wait for Response ......................................................... 52
3-4. Typical Command Sequence. Wait for Response ..................................................................... 53
3-5. Burst Write Command (First 2 Bytes) ................................................................................... 55
4-1. Clock System Overview ................................................................................................... 65
6-1. Flash Write Using DMA.................................................................................................... 75
8-1. DMA Operation ............................................................................................................. 94
8-2. Variable Length (VLEN) Transfer Options .............................................................................. 96
9-1. Free-Running Mode ...................................................................................................... 104
9-2. Modulo Mode .............................................................................................................. 105
9-3. Up-and-Down Mode ...................................................................................................... 105
9-4. Output Compare Modes, Timer Free-Running Mode ................................................................ 108
9-5. Output Compare Modes, Timer Modulo Mode ........................................................................ 109
9-6. Output Compare Modes, Timer Up-and-Down Mode ................................................................ 110
9-7. Block Diagram of Timers in IR-Generation Mode .................................................................... 112
9-8. Modulated Waveform Example ......................................................................................... 112
9-9. IR Learning Board Diagram ............................................................................................. 113
11-1. Sleep Timer Capture (Example Using Rising Edge on P0_0) ...................................................... 130
12-1. ADC Block Diagram ...................................................................................................... 133
14-1. Basic Structure of the Random-Number Generator .................................................................. 144
15-1. Message Authentication Phase Block B0 ............................................................................. 148
15-2. Authentication Flag Byte ................................................................................................. 148
15-3. Message Encryption Phase Block ...................................................................................... 149
15-4. Encryption Flag Byte ..................................................................................................... 149
19-1. Analog Comparator ....................................................................................................... 167
20-1. Block Diagram of the I2C Module ....................................................................................... 169
20-2. I2C Bus Connection Diagram ............................................................................................ 170
20-3. I2C Module Data Transfer ................................................................................................ 170
20-4. Bit Transfer on I2C Bus ................................................................................................... 171
20-5. I2C Module 7-Bit Addressing Format ................................................................................... 171
20-6. I2C Module Addressing Format With Repeated START Condition ................................................. 171
20-7. Arbitration Procedure Between Two Master Transmitters ........................................................... 177
20-8. Synchronization of Two I2C Clock Generators During Arbitration .................................................. 177
21-1. USB Controller Block Diagram .......................................................................................... 182
21-2. IN and OUT FIFOs ....................................................................................................... 186
23-1. Modulation ................................................................................................................. 216
23-2. I/Q Phases When Transmitting a Zero-Symbol Chip Sequence, tC = 0.5 μs ..................................... 216
23-3. Schematic View of the IEEE 802.15.4 Frame Format [1] ........................................................... 217
23-4. Format of the Frame Control Field (FCF) ............................................................................. 217
List of Tables
0-1. CC253x Family Overview ................................................................................................. 15
0-2. Register Bit Conventions .................................................................................................. 16
2-1. SFR Overview .............................................................................................................. 29
2-2. Overview of XREG Registers ............................................................................................. 32
2-3. Instruction Set Summary .................................................................................................. 37
2-4. Instructions That Affect Flag Settings ................................................................................... 40
2-5. Interrupts Overview ........................................................................................................ 41
2-6. Priority Level Setting ....................................................................................................... 48
2-7. Interrupt Priority Groups ................................................................................................... 48
2-8. Interrupt Polling Sequence ................................................................................................ 49
3-1. Debug Commands ......................................................................................................... 53
3-2. Debug Configuration ....................................................................................................... 55
3-3. Debug Status ............................................................................................................... 55
3-4. Relation Between PCON_IDLE and PM_ACTIVE .......................................................................... 56
3-5. Flash Lock-Protection Bit Structure Definition .......................................................................... 57
4-1. Power Modes ............................................................................................................... 61
6-1. Example Write Sequence ................................................................................................. 74
7-1. Peripheral I/O Pin Mapping ............................................................................................... 81
8-1. DMA Trigger Sources ...................................................................................................... 98
8-2. DMA Configuration-Data Structure....................................................................................... 99
9-1. Initial Compare Output Values (Compare Mode) ..................................................................... 107
9-2. Frequency Error Calculation for 38-kHz Carrier ...................................................................... 111
10-1. Initial Compare Output Values (Compare Mode) ..................................................................... 122
13-1. Values Showing How Different Temperatures Relate to BATTMON_VOLTAGE for a Typical Device ........ 140
13-2. Values for A and B (for a Typical Device) When Using the Battery monitor for Temperature Monitoring .... 141
17-1. Commonly Used Baud-Rate Settings for 32 MHz System Clock................................................... 158
20-1. Slave Transmitter Mode.................................................................................................. 172
20-2. Slave Receiver Mode..................................................................................................... 173
20-3. Master Transmitter Mode ................................................................................................ 175
20-4. Master Receiver Mode ................................................................................................... 176
20-5. Miscellaneous States ..................................................................................................... 178
20-6. Clock Rates Defined at 32 MHz ........................................................................................ 179
21-1. USB Interrupt Flags Interrupt-Enable Mask Registers ............................................................... 183
21-2. FIFO Sizes for EP 1–5 ................................................................................................... 186
22-1. Internal Registers ......................................................................................................... 203
23-1. Frame Filtering and Source Matching Memory Map ................................................................. 214
23-2. IEEE 802.15.4-2006 Symbol-to-Chip Mapping ....................................................................... 216
23-3. FSM State Mapping ...................................................................................................... 236
23-4. Instruction Set Summary ................................................................................................. 242
23-5. Register Overview ........................................................................................................ 255
23-6. Registers That Require Update From Their Default Value .......................................................... 256
23-7. Register-Bit Access Modes .............................................................................................. 256
25-1. Radio RAM Pages ........................................................................................................ 280
25-2. Commands to FIFO via RFST Register ............................................................................... 283
25-3. Access to FIFO Registers ............................................................................................... 283
25-4. RAM-Based Registers.................................................................................................... 285
25-5. Address Structure for Auto Mode ....................................................................................... 289
FCC Warning
This equipment generates, uses, and can radiate radio frequency energy and has not been tested for
compliance with the limits of computing devices pursuant to subpart J of part 15 of FCC rules, which are
designed to provide reasonable protection against radio frequency interference. Operation of this
equipment in other environments may cause interference with radio communications, in which case the
user at his own expense will be required to take whatever measures may be required to correct this
interference.
Glossary
Abbreviations used in this user guide can be found in Appendix A.
Devices
The CC253x System-on-Chip solution family consists of several devices. The following table provides a
device overview and points out the differences regarding memory sizes and peripherals. For a complete
feature list of any of the devices, see the corresponding data sheet (Appendix C).
Legend:
FLASH_SIZE – The size of the flash
SRAM_SIZE – The size of the SRAM
Register Conventions
Each SFR and XREG register is described in a separate table, where each table title contains the
following information in the format indicated:
For SFR registers: REGISTER NAME (SFR address) – register description
For XREG registers: REGISTER NAME (XDATA address) – register description
Each table has five columns to describe the different register fields as described in the following:
Column 1 – Bit: Denotes which bits of the register are described and addressed in the specific row
Column 2 – Name: Specific name of the register field
Column 3 – Reset: Reset or initial value of the register field
Column 4 – R/W: Key indicating the accessibility of the bits in the field (see Table 0-2 for more details)
Column 5 – Description: More details about the register field, and often a description of the functions of
the different values
In the register descriptions, each register field is shown with a symbol (R/W) indicating the access mode of
the register field. The register values are always given in binary notation unless prefixed by 0x, which
indicates hexadecimal notation.
Introduction
As mentioned in the preface, the CC253x, CC2540, and CC2541 device family provides solutions for a
wide range of applications. In order to help the user to develop these applications, this user's guide
focuses on the usage of the different building blocks of the CC253x, CC2540, and CC2541 device family.
For detailed device descriptions, complete feature lists, and performance numbers, see the device-specific
data sheet (Appendix C).
In order to provide easy access to relevant information, the following subsections guide the reader to the
different chapters in this guide.
1.1 Overview
The block diagrams in Figure 1-1, Figure 1-2, and Figure 1-3 show the different building blocks of the
CC253x and, CC2540, and CC2541 devices. Not all features and functions of all modules or peripherals
are present on all devices of the CC253x, CC2540, and CC2541; hence, see the device-specific data
sheet for a device-specific block diagram.
ON-CHIP VOLTAGE VDD (2 V–3.6 V)
REGULATOR DCOUPL
POWER-ON RESET
BATTERY MONITOR (CC2533 ONLY)
BROWNOUT
SFR Bus
P2_4 32.768-kHz CALIBRATION 1-KB CC2531
P2_3 CRYSTAL OSC FIFO SRAM
P2_2
HIGH-
DEBUG 32-kHz
P2_1 SPEED
RC-OSC USB DP
INTERFACE RC-OSC USB PHY DM
P2_0
P1_7
PDATA
P1_6
XRAM 8-KB SRAM
P1_5 8051 CPU
CORE
P1_4 IRAM
MEMORY
P1_3 ARBITER
SFR
P1_2 32/64/128/256-KB
FLASH
P1_1
DMA
P1_0
P0_7
IRQ CTRL FLASH CTRL
P0_6
P0_5
ANALOG COMPARATOR RADIO REGISTERS
P0_4
P0_3
P0_2 OP-AMP
I/O CONTROLLER
SYNTH
DEMODULATOR
MODULATOR
AND AGC
USART 0
SYNTHESIZER
FREQUENCY
RECEIVE TRANSMIT
USART 1
TIMER 1 (16-Bit)
TIMER 2
(IEEE 802.15.4 MAC TIMER)
RF_P RF_N
ANALOG
MIXED TIMER 4 (8-Bit)
B0301-03
SFR Bus
P2_4 32.768-kHz CALIBRATION
P2_3 CRYSTAL OSC SLEEP TIMER
P2_2
HIGH-
DEBUG SPEED
32-kHz
P2_1 INTERFACE RC-OSC
RC-OSC POWER MANAGEMENT CONTROLLER
P2_0
PDATA
P1_7
P1_6 XRAM
8051 CPU
P1_5 CORE
IRAM
MEMORY
P1_4 ARBITRATOR FLASH FLASH
SFR
P1_3
P1_2
P1_1 DMA UNIFIED
P1_0
ENCRYPTION
DS AND
Link Layer Engine
ADC DECRYPTION
AUDIO/DC
SFR Bus
SYNTH
DEMODULATOR MODULATOR
USART 0
USART 1
SYNTHESIZER
FREQUENCY
RECEIVE TRANSMIT
TIMER 1 (16-Bit)
TIMER 2
(BLE LL TIMER)
TIMER 3 (8-Bit)
RF_P RF_N
TIMER 4 (8-Bit)
DIGITAL
USB_N USB ANALOG
USB
USB_P PHY MIXED
B0301a-055
The modules can be roughly divided into one of three categories: CPU and memory related modules;
modules related to peripherals, clocks, and power management; and radio-related modules.
POWER-ON RESET
XOSC_Q2 32-MHZ BROWN OUT
XOSC_Q1 CRYSTAL OSC
SFR bus
CLOCK MUX and
CALIBRATION SLEEP TIMER
P2_4 32.768-kHz
CRYSTAL OSC
P2_3
P2_2 POWER MGT. CONTROLLER
DEBUG HIGH SPEED 32-kHz
P2_1 INTERFACE RC-OSC RC-OSC
P2_0
PDATA
P1_7 RAM SRAM
XRAM
P1_6 8051 CPU
P1_5
CORE IRAM MEMORY
P1_4 SFR
ARBITRATOR
FLASH FLASH
P1_3
P1_2 UNIFIED
DMA
P1_1
P1_0 IRQ FLASH CTRL
CTRL
P0_7
P0_6 ANALOG COMPARATOR FIFOCTRL 1-KB SRAM
I/O CONTROLLER
P0_5 OP-
Radio Arbiter
P0_4
AES RADIO
P0_3 REGISTERS
ENCRYPTION
P0_2 and
P0_1 DS ADC DECRYPTION Link Layer Engine
P0_0 AUDIO / DC
SYNTH
DEMODULATOR MODULATOR
SFR bus
SDA 2
I C
SCL
USART 0
SYNTHESIZER
FREQUENCY
USART 1
RECEIVE TRANSMIT
TIMER 1 (16-Bit)
TIMER 2
(BLE LL TIMER)
TIMER 3 (8-bit)
RF_P RF_N
TIMER 4 (8-bit) DIGITAL
ANALOG
MIXED
1.1.3 Peripherals
The CC253x, CC2540, and CC2541 include many different peripherals that allow the application designer
to develop advanced applications. Not all peripherals are present on all devices. See Table 0-1 for a listing
of which peripherals are present on each device.
The debug interface (Chapter 3) implements a proprietary two-wire serial interface that is used for in-
circuit debugging. Through this debug interface, it is possible to perform an erasure of the entire flash
memory, control which oscillators are enabled, stop and start execution of the user program, execute
supplied instructions on the 8051 core, set code breakpoints, and single-step through instructions in the
code. Using these techniques, it is possible to perform in-circuit debugging and external flash
programming elegantly.
The device contains flash memory for storage of program code. The flash memory is programmable from
the user software and through the debug interface (as mentioned previously). The flash controller
(Chapter 6) handles writing and erasing the embedded flash memory. The flash controller allows page-
wise erasure and 4-bytewise programming.
The I/O controller (Chapter 7) is responsible for all general-purpose I/O pins. The CPU can configure
whether peripheral modules control certain pins or whether they are under software control, and if so,
whether each pin is configured as an input or output and if a pullup or pulldown resistor in the pad is
connected. CPU interrupts can be enabled on each pin individually. Each peripheral that connects to the
I/O pins can choose between two different I/O pin locations to ensure flexibility in various applications.
A versatile five-channel DMA controller (Chapter 8) is available in the system, accesses memory using
the XDATA memory space, and thus has access to all physical memories. Each channel (trigger, priority,
transfer mode, addressing mode, source and destination pointers, and transfer count) is configured with
DMA descriptors anywhere in memory. Many of the hardware peripherals (AES core, flash controller,
USARTs, timers, ADC interface) achieve highly efficient operation by using the DMA controller for data
transfers between SFR or XREG addresses and flash or SRAM.
Timer 1 (Chapter 9) is a 16-bit timer with timer, counter, and PWM functionality. Timer 1 has a
programmable prescaler, a 16-bit period value, and five individually programmable counter or capture
channels, each with a 16-bit compare value. Each of the counter or capture channels can be used as a
PWM output or to capture the timing of edges on input signals. Timer 1 can also be configured in IR
generation mode, where it counts Timer 3 periods and the output is ANDed with the output of Timer 3 to
generate modulated consumer IR signals with minimal CPU interaction (see Section 9.9).
Timer 2 (MAC Timer) (Chapter 22) is specially designed for supporting an IEEE 802.15.4 MAC or other
time-slotted protocol in software. The timer has a configurable timer period and a 24-bit overflow counter
that can be used to keep track of the number of periods that have transpired. A 40-bit capture register is
also used to record the exact time at which a start-of-frame delimiter is received or transmitted, or the
exact time at which transmission ends, as well as two 16-bit output compare registers and two 24-bit
overflow compare registers that can send various command strobes (start RX, start TX, etc.) at specific
times to the radio modules.
Timer 3 and Timer 4 (Chapter 10) are 8-bit timers with timer, counter, and PWM functionality. They have
a programmable prescaler, an 8-bit period value, and one programmable counter channel with an 8-bit
compare value. Each of the counter channels can be used as a PWM output.
The Sleep Timer (Chapter 11) is an ultralow-power timer that counts 32-kHz crystal oscillator or 32-kHz
RC oscillator periods. The Sleep Timer runs continuously in all operating modes except power mode 3
(PM3). Typical applications of this timer are as a real-time counter or as a wake-up timer for coming out of
power mode 1 (PM1) or power mode 2 (PM2).
The ADC (Chapter 12) supports 7 bits (30-kHz bandwidth) to 12 bits (4-kHz bandwidth) of resolution. DC
and audio conversions with up to eight input channels (Port 0) are possible. The inputs can be selected as
single-ended or differential. The reference voltage can be internal, AVDD, or a single-ended or differential
external signal. The ADC also has a temperature-sensor input channel. The ADC can automate the
process of periodic sampling or conversion over a sequence of channels.
The battery monitor (Chapter 13) (CC2533 only) enables simple voltage monitoring in devices that do
not include an ADC. It is designed such that it is accurate in the voltage areas around 2 V, with lower
resolution at higher voltages.
The random-number generator (Chapter 14) uses a 16-bit LFSR to generate pseudorandom numbers,
which can be read by the CPU or used directly by the command strobe processor. The random-number
generator can be seeded with random data from noise in the radio ADC.
The AES coprocessor (Chapter 15) allows the user to encrypt and decrypt data using the AES algorithm
with 128-bit keys. The core is able to support the security operations required by IEEE 802.15.4 MAC
security, the ZigBee network layer, and the application layer.
A built-in Watchdog Timer (Chapter 16) allows the device to reset itself in case the firmware hangs.
When enabled by software, the Watchdog Timer must be cleared periodically; otherwise, it resets the
device when it times out. It can alternatively be configured for use as a general 32-kHz timer.
USART 0 and USART 1 (Chapter 18) are each configurable as either a SPI master or slave or as a
UART. They provide double buffering on both RX and TX and hardware flow control, and are thus well
suited to high-throughput full-duplex applications. Each has its own high-precision baud-rate generator,
thus leaving the ordinary timers free for other uses.
The I2C module (Chapter 20) (CC2533 and CC2541) provides a digital peripheral connection with two pins
and supports both master and slave operation.
The USB 2.0 controller (Chapter 21) (CC2531 and CC2540) operates at Full-Speed, 12 Mbps transfer
rate. The controller has five bidirectional endpoints in addition to control endpoint 0. The endpoints support
bulk, Interrupt, and Isochronous operation for implementation of a wide range of applications. The 1024
bytes of dedicated, flexible FIFO memory combined with DMA access ensures that a minimum of CPU
involvement is needed for USB communication.
22 Introduction SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Overview
The operational amplifier (Chapter 18) (CC2530, CC2531, and CC2540) is intended to provide front-end
buffering and gain for the ADC. Both the inputs as well as the output are available on pins, so the
feedback network is fully customizable. A chopper-stabilized mode is available for applications that need
good accuracy with high gain.
The ultralow-power analog comparator (Chapter 19) (CC2530, CC2531, CC2540, and CC2541) enables
applications to wake up from PM2 or PM3 based on an analog signal. Both inputs are brought out to pins;
the reference voltage must be provided externally. The comparator output is mapped into the digital I/O
port and can be treated by the MCU as a regular digital input.
1.1.4 Radio
The CC2540 and CC2541 provide a Bluetooth low energy-compliant radio transceiver. The RF core which
controls the analog and digital radio modules is only indirectly accessible through API commands to the
BLE stack. More details about the CC2540 or CC2541 BLE radio can be found in Chapter 24. The
CC2541 can also be run in proprietary modes; more details can be found in Chapter 25.
The CC253x device family provides an IEEE 802.15.4-compliant radio transceiver. The RF core
controls the analog radio modules. In addition, it provides an interface between the MCU and the radio
which makes it possible to issue commands, read status, and automate and sequence radio events. The
radio also includes a packet-filtering and address-recognition module. More details about the CC253x
radio can be found in Chapter 23.
1.2 Applications
As shown in the overview (Section 1.1), this user's guide focuses on the functionality of the different
modules that are available to build different types of applications based on the CC253x,CC2540, and
CC2541 device family. When looking at the complete application development process, additional
information is useful. However, as this information and help is not device-specific (that is, not unique for
the CC253x, CC2540, and 41 device family), see the additional information sources in the following
paragraphs.
The first step is to set up the development environment (hardware, tools, and so forth) by purchasing a
development kit (see the device-specific product Web site to find links to the relevant development kits).
The development kits come with an out-of-the-box demonstration and information on how to set up the
development environment; install required drivers (done easily by installing the SmartRF software,
Section 27.1), set up the compiler tool chain, and so forth. As soon as one has installed the development
environment, one is ready to start the application development.
The easiest way to write the application software is to base the application on one of the available
standard protocols (RemoTI network protocol, Section 27.2; TIMAC software, Section 27.4; Z-Stack
software for ZigBee-compliant solutions, Section 27.5); BLE stack software for Bluetooth low energy-
compliant solutions Section 27.6; or the proprietary SimpliciTI network protocol, Section 27.3. They all
come with several sample applications.
For the hardware layout design of the user-specific hardware, the designer can find reference designs on
the different product pages (Section B.1). By copying these designs, the designer achieves optimal
performance. The developed hardware can then be tested easily using the SmartRF Studio software
(Section 27.1).
In case the final system should not have the expected performance, it is recommended to try out the
developed software on the development kit hardware and see how it works there. To check the user-
specific hardware, it is a good first step to use SmartRF Studio software to compare the development kit
performance versus the user-specific hardware using the same settings.
The user can also find additional information and help by joining the Low-Power RF Online Community
(Section B.2) and by subscribing to the Low-Power RF eNewsletter (Section B.4).
To contact a third-party to help with development or to use modules, check out the Texas Instruments
Low-Power RF Developer Network (Section B.3).
8051 CPU
The System-on-Chip solution is based on an enhanced 8051 core. More details regarding the core,
memory map, instruction set, and interrupts are described in the following subsections.
2.2 Memory
The 8051 CPU architecture has four different memory spaces. The 8051 has separate memory spaces for
program memory and data memory. The 8051 memory spaces are the following (see Section 2.2.1 and
Section 2.2.2 for details):
CODE. A read-only memory space for program memory. This memory space addresses 64 KB.
DATA. A read-or-write data memory space that can be directly or indirectly accessed by a single-cycle
CPU instruction. This memory space addresses 256 bytes. The lower 128 bytes of the DATA memory
space can be addressed either directly or indirectly, the upper 128 bytes only indirectly.
XDATA. A read-and-write data memory space, access to which usually requires 4–5 CPU instruction
cycles. This memory space addresses 64 KB. Access to XDATA memory is also slower than DATA
access, as the CODE and XDATA memory spaces share a common bus on the CPU core, and instruction
prefetch from CODE thus cannot be performed in parallel with XDATA accesses.
SFR. A read-or-write register memory space which can be directly accessed by a single CPU instruction.
This memory space consists of 128 bytes. For SFR registers whose address is divisible by eight, each bit
is also individually addressable.
The four different memory spaces are distinct in the 8051 architecture, but are partly overlapping in the
device to ease DMA transfers and hardware debugger operation.
How the different memory spaces are mapped onto the three physical memories (flash program memory,
SRAM, and memory-mapped registers) is described in Section 2.2.1 and Section 2.2.2.
The second scheme is used for executing code from SRAM. In this mode, the SRAM is mapped into the
region of 0x8000 through (0x8000 + SRAM_SIZE – 1). The map is shown in Figure 2-3. Executing code
from SRAM improves performance and reduces power consumption.
The upper 32 KB of XDATA is a read-only area called XBANK (see Figure 2-1). Any of the available 32
KB flash banks can be mapped in here. This gives software access to the whole flash memory. This area
is typically used to store additional constant data.
Details about mapping of all 8051 memory spaces are given in Section 2.2.2.
The memory map showing how the different physical memories are mapped into the CPU memory spaces
is given in Figure 2-1 through Figure 2-3. The number of available flash banks depends on the flash size
option.
0 xFFFF
XBANK
(SELECTABLE 32KB FLASH BANK)
0x8000
0x7 FFF
INFORMATION PAGE
(2KB)
0x 7800
0x70FF
8051 SFR SPACE 0x 7080
SFR (128B)
0x63FF
0x 6000
XREG (1KB)
SRAM_SIZE – 1
8051 DATA SPACE SRAM SIZE – 256
SRAM
(SRAM_SIZE Bytes)
0x0000
M0097-02
Figure 2-1. XDATA Memory Space (Showing SFR and DATA Mapping)
Banks 0–7
Bank 0–7 (Upper 24KB FLASH)
(32KB FLASH)
0x8000 + SRAM_SIZE
0x8000 + SRAM_SIZE – 1
SRAM
0x 8000 0x 8000
0x7FFF 0x7FFF
0x 0000 0x 0000
M0098-02 M0099-04
Figure 2-2. CODE Memory Space Figure 2-3. CODE Memory Space for Running Code
From SRAM
SFR memory space. The 128-entry hardware register area is accessed through this memory space. The
SFR registers are also accessible through the XDATA address space at the address range
(0x7080–0x70FF). Some CPU-specific SFR registers reside inside the CPU core and can only be
accessed using the SFR memory space and not through the duplicate mapping into XDATA memory
space. These specific SFR registers are listed in SFR Registers.
NOTE: All internal SFRs (shown with gray background in Table 2-1), can only be accessed through
SFR space, as these registers are not mapped into XDATA space. One exception is the port
registers (P0, P1, and P2) which are readable from XDATA.
XREG Registers. The XREG registers are additional registers in the XDATA memory space. These
registers are mainly used for radio configuration and control. For more details regarding each register, see
the corresponding module or peripheral chapter. Table 2-2 gives a descriptive overview of the register
address space.
2.3.4 Accumulator
ACC is the accumulator. This is the source and destination of most arithmetic instructions, data transfers,
and other instructions. The mnemonic for the accumulator (in instructions involving the accumulator) is A
instead of ACC.
2.3.5 B Register
The B register is used as the second 8-bit argument during execution of multiply and divide instructions.
When not used for these purposes, it may be used as a scratchpad register to hold temporary data.
B (0xF0) – B Register
Bit Name Reset R/W Description
7:0 B[7:0] 0x00 R/W B register. Used in MUL and DIV instructions
The instructions that affect CPU flag settings located in PSW are listed in Table 2-4. Note that operations
on the PSW register or bits in PSW also affect the flag settings. Also note that the cycle count for many
instructions assumes single-cycle access to the memory element being accessed, that is, the best-case
situation. This is not always the case. Reads from flash may take 1–3 cycles, for example.
2.5 Interrupts
The CPU has 18 interrupt sources. Each source has its own request flag located in a set of interrupt-flag
SFR registers. Each interrupt requested by the corresponding flag can be individually enabled or disabled.
The definitions of the interrupt sources and the interrupt vectors are given in Table 2-5.
The interrupts are grouped into a set of priority-level groups with selectable priority levels.
The interrupt-enable registers are described in Section 2.5.1 and the interrupt priority settings are
described in Section 2.5.3.
(1) (2)
10 Timer 2 T2 0x53 IEN1.T2IE IRCON.T2IF
(1)
Hardware-cleared when interrupt service routine is called
(2)
Additional IRQ mask and IRQ flag bits exist.
(1) (2)
12 Timer 4 (8-bit) capture, compare, overflow T4 0x63 IEN1.T4IE IRCON.T4IF
13 Port 0 inputs P0INT 0x6B IEN1.P0IE IRCON.P0IF (2)
14 USART 1 TX complete UTX1 0x73 IEN2.UTX1IE IRCON2.UTX1IF
15 Port 1 inputs P1INT 0x7B IEN2.P1IE IRCON2.P1IF (2)
16 RF general interrupts RF 0x83 IEN2.RFIE S1CON.RFIF (2)
17 Watchdog overflow in timer mode WDT 0x8B IEN2.WDTIE IRCON2.WDTIF
7:0
RFIRQF0
EA
RFIRQM1 IT0 RFERRIE
7:0
RFERR
RFIRQF1 RFERRIF
RFIF_0 RFIE
RF IP1_0
T1CCTL{0-4}.IM
T1STAT[4:0] IP0_0
RFIF_1
DMAIE
TIMIF.T1OVFIM ADCIE
ADC ADCIF
T1STAT.OVFIF
IP0_3
T4CCTL1.IM UTX1IE
UTX1
8051 CPU
Interrupts
43
Interrupts www.ti.com
NOTE: If an interrupt is disabled and the interrupt flag is polled, the 8051 assembly instruction JBC
must not be used to poll the interrupt flag and clear it when set. If the JBC instruction is
used, the interrupt flag may be re-asserted immediately.
NOTE: If the assembly instruction XCH A, IEN0 is used to clear the global interrupt enable flag
EA, the CPU may enter the interrupt routine on the cycle following this instruction. If that
happens, the interrupt routine is executed with EA set to 0, which may delay the service of
higher-priority interrupts.
In the case when interrupt requests of the same priority level are received simultaneously, the polling
sequence shown in Table 2-8 is used to resolve the priority of each request. Note that the polling
sequence in Figure 2-4 is the algorithm found in Table 2-8, not that polling is among the IP bits as listed in
the figure.
Debug Interface
The two-wire debug interface allows programming of the on-chip flash, and it provides access to memory
and register contents and debug features such as breakpoints, single-stepping, and register modification.
The debug interface uses I/O pins P2.1 and P2.2 as debug data and debug clock, respectively, during
debug mode. These I/O pins can be used as general-purpose I/O only while the device is not in debug
mode. Thus, the debug interface does not interfere with any peripheral I/O pins.
NOTE: Note that the debugger cannot be used with a divided system clock. When running the
debugger, the value of CLKCONCMD.CLKSPD should be set to 000 when CLKCONCMD.OSC = 0 or
to 001 when CLKCONCMD.OSC = 1.
Debug Clock
Debug Data
T0302-01
The data is byte-oriented and is transmitted MSB-first. A sequence of one byte is shown in Figure 3-2.
Time
Debug Clock
Debug Data Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
T0303-01
A debug command sequence always starts with the host transmitting a command through the serial
interface. This command encodes the number of bytes containing further parameters to follow, and
whether a response is required. Based on this command, the debug module controls the direction of the
debug data pad. A typical command sequence is shown in Figure 3-3. Note that the debug-data signal is
simplified for the clarity of the figure, not showing each individual bit change. The direction is not explicitly
indicated to the outside world, but must be derived by the host from the command protocol.
Start of
Command End of
Sequence Pad is Command
Start to Output Sequence
Change
Direction
Time
Debug
Clock
tdir_change
The Level is
Sampled by the
External Device
(Asynchronously)
T0304-01
For commands that require a response, there must be a small idle period between the command and the
response to allow the pad to change direction. After the minimum waiting time (tdir_change) of 83 ns, the chip
indicates whether it is ready to deliver the response data by pulling the data pad low. The external
debugger, which is sampling the data pad, detects this and begins to clock out the response data. If the
data pad is high after the waiting time, it is an indication to the debugger that the chip is not ready yet.
Figure 3-4 shows how the wait works.
Start of
Command Pad Is Output, But
Sequence Chip Is Not Ready to End of
Start to Respond Command
Change Sequence
Direction
Time
8 Cycles
Debug
Clock
tdir_change tsample_wait
T0305-01
If the debug interface indicates by pulling the data line high that it is not ready to return data, the external
device must issue exactly eight clock pulses before it samples the ready level again. This must be
repeated until the level is low. The wait cycle is equivalent to reading a byte from the debug interface, but
ignoring the result. Note that the pad starts to change direction on the falling edge of the debug clock.
Thus, the pad driver drives against the driver in the programmer until the programmer changes pad
direction. This duration should be minimized in a programmer implementation.
1 0 0 0 0 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
T0306-01
The third data byte consists of bits 7–0 of the hardware breakpoint. Thus, the second and third data bytes
set the CPU CODE address at which to stop execution.
Table 3-5 defines the 16-byte structure containing the flash lock-protection bits. Bit 0 of the first byte
contains the lock bit for page 0, bit 1 of the first byte contains the lock bit for page 1, and so on. Bit 7 of
the last byte in the flash is the DBGLOCK bit (bit 127 in the structure).
NOTE: It is recommended to lock all pages that are not to be in-system programmed. This is to
prevent erroneous code from unintentionally altering code or constants. This can only be
changed while in debug mode.
The debug interface still responds to a reduced set of commands while in one of the power modes. The
chip can be woken up from sleep mode by issuing a HALT command to the debug interface. The HALT
command brings the chip up from sleep mode in the halted state. The RESUME command must be issued
to resume software execution.
The debug status may be read when in power modes. The status must be checked when leaving a power
mode by issuing a HALT command. The time needed to power up depends on which power mode the
chip is in, and must be checked in the debug status. The debug interface only accepts commands that are
available in sleep mode before the chip is operational.
NOTE: Debugging in Idle mode and PM1 is not supported. It is recommended to use active mode or
another power mode when debugging.
3.6 Registers
Low-power operation is enabled through different operating modes (power modes). The various operating
modes are referred to as active mode, idle mode, and power modes 1, 2, and 3 (PM1–PM3).
60 Power Management and Clocks SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Power Management Introduction
Active mode: The fully functional mode. The voltage regulator to the digital core is on, and either the 16-
MHz RC oscillator or the 32-MHz crystal oscillator or both are running. Either the 32-kHz RCOSC or the
32-kHz XOSC is running.
Idle mode: Identical to active mode, except that the CPU core stops operating (is idle).
PM1: The voltage regulator to the digital part is on. Neither the 32-MHz XOSC nor the 16-MHz RCOSC is
running. Either the 32-kHz RCOSC or the 32-kHz XOSC is running. The system goes to active mode on
reset, an external interrupt, or when the Sleep Timer expires.
PM2: The voltage regulator to the digital core is turned off. Neither the 32-MHz XOSC nor the 16-MHz
RCOSC is running. Either the 32-kHz RCOSC or the 32-kHz XOSC is running. The system goes to active
mode on reset, an external interrupt, or when the Sleep Timer expires.
PM3: The voltage regulator to the digital core is turned off. None of the oscillators is running. The system
goes to active mode on reset or an external interrupt.
The POR is active in PM2 and PM3, but the BOD is powered down, which gives limited voltage
supervision. If the supply voltage is lowered to below 1.4 V during PM2 or PM3, at temperatures of 70°C
or higher, and then brought back up to good operating voltage before active mode is re-entered, registers
and RAM contents that are saved in PM2 or PM3 may become altered. Hence, care should be taken in
the design of the system power supply to ensure that this does not occur. The voltage can be periodically
supervised accurately by entering active mode, as a BOD reset is triggered if the supply voltage is below
approximately 1.7 V.
The CC2533 and CC2541 have functionality to perform automatically a CRC check of the retained
configuration register values in PM2 and PM3 to check that the device state was not altered during sleep.
The bits in SRCRC.CRC_RESULT indicate whether there were any changes, and by enabling
SRCRC.CRC_RESET_EN, the device immediately resets itself with a watchdog reset if
SRCRC.CRC_RESULT is not 00 (= CRC of retained registers passed) after wakeup from PM2 or PM3. The
SRCRC register also contains the SRCRC.FORCE_RESET bit that can be used by software to trigger a
watchdog reset immediately to reboot the device.
For CC2533 and CC2541, additional analog reset architecture adds another brownout detector (the
3VBOD) that senses on the unregulated voltage. The purpose of this 3VBOD is to reduce the current
consumption of the device when supplied with voltages well below the operating voltage.
SWRU191F – April 2009 – Revised April 2014 Power Management and Clocks 61
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Power Management Introduction www.ti.com
4.1.2 PM1
In PM1, the high-frequency oscillators are powered down (32-MHz XOSC and 16-MHz RCOSC). The
voltage regulator and the enabled 32-kHz oscillator are on. When PM1 is entered, a power-down
sequence is run.
PM1 is used when the expected time until a wakeup event is relatively short (less than 3 ms), because
PM1 uses a fast power-down and power-up sequence.
4.1.3 PM2
PM2 has the second-lowest power consumption. In PM2, the power-on reset, external interrupts, selected
32-kHz oscillator, and Sleep Timer peripherals are active. I/O pins retain the I/O mode and output value
set before entering PM2. All other internal circuits are powered down. The voltage regulator is also turned
off. When PM2 is entered, a power-down sequence is run.
PM2 is typically entered when using the Sleep Timer as the wakeup event, and also combined with
external interrupts. PM2 should typically be choosen, compared to PM1, when expected sleep time
exceeds 3 ms. Using less sleep time does not reduce system power consumption compared to using
PM1.
4.1.4 PM3
PM3 is used to achieve the operating mode with the lowest power consumption. In PM3, all internal
circuits that are powered from the voltage regulator are turned off (basically all digital modules; the only
exceptions are interrupt detection and POR level sensing). The internal voltage regulator and all oscillators
are also turned off.
Reset (POR or external) and external I/O port interrupts are the only functions that operate in this mode.
I/O pins retain the I/O mode and output value set before entering PM3. A reset condition or an enabled
external I/O interrupt event wakes the device up and places it into active mode (an external interrupt starts
from where it entered PM3, whereas a reset returns to start-of-program execution). The content of RAM
and registers is partially preserved in this mode (see Section 4.6). PM3 uses the same power-down and
power-up sequence as PM2.
PM3 is used to achieve ultralow-power consumption when waiting for an external event. It should be used
when expected sleep time exceeds 3 ms.
62 Power Management and Clocks SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Power-Management Registers
The instruction that sets the PCON.IDLE bit must be aligned in a certain way for correct operation. The
first byte of the assembly instruction immediately following this instruction must not be placed on a 4-byte
boundary. Furthermore, cache must not be disabled (see CM in the FCTL register description in
Chapter 6). Failure to comply with this requirement may cause higher current consumption. Provided this
requirement is fulfilled, the first assembly instruction after the instruction that sets the PCON.IDLE bit is
performed before the ISR of the interrupt that caused the system to wake up, but after the system woke
up. If this instruction is a global interrupt disable, it is possible to have it followed by code for execution
after wakeup, but before the ISR is serviced.
An example of how this can be done in the IAR compiler is shown as follows. The command for setting
PCON to 1 is placed in a function written in assembly code. In a C file calling this function, a declaration
such as extern void
EnterSleepModeDisableInterruptsOnWakeup(void); is used. The
RSEG NEAR_CODE:CODE:NOROOT(2) statement ensures that the MOV PCON,#1 instruction is placed on
a 2-byte boundary. It is a 3-byte instruction, so the following instruction is not placed on a 4-byte
boundary, as required. In the following example, this instruction is CLR EA, which disables all interrupts.
That means that the ISR of the interrupt that woke up the system is not executed until after the IEN0.EA
bit has been set again later in the code. If this functionality is not wanted, the CLR EA instruction can be
replaced by a NOP.
PUBLIC EnterSleepModeDisableInterruptsOnWakeup FUNCTION
EnterSleepModeDisableInterruptsOnWakeup,0201H RSEG NEAR_CODE:CODE:NOROOT(2)
EnterSleepModeDisableInterruptsOnWakeup: MOV PCON,#1 CLR EA RET
SWRU191F – April 2009 – Revised April 2014 Power Management and Clocks 63
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Power-Management Registers www.ti.com
64 Power Management and Clocks SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Power-Management Registers
CLKCONCMD.OSC
0 System Clock
SLEEPCMD.MODE[1:0]
1
XTAL1
XOSC_ STB
SLEEPCMD.MODE[1:0]
16-MHz RC Oscillator
HFRC_STB
CLKCONCMD.OSC32K
0 32-kHz Clock
Sleep Timer
SLEEPCMD.MODE[1:0] Watchdog Timer
1
XTAL2
SLEEPCMD.MODE[1:0]
32-kHz RC Oscillator
SLEEPCMD.OSC32K_CALDIS
B0303-02
SWRU191F – April 2009 – Revised April 2014 Power Management and Clocks 65
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Oscillators and Clocks www.ti.com
4.4.1 Oscillators
Figure 4-1 gives an overview of the clock system with available clock sources.
Two high-frequency oscillators are present in the device:
• 32-MHz crystal oscillator
• 16-MHz RC oscillator
The 32-MHz crystal-oscillator start-up time may be too long for some applications; therefore, the device
can run on the 16-MHz RC oscillator until the crystal oscillator is stable. The 16-MHz RC oscillator
consumes less power than the crystal oscillator, but because it is not as accurate as the crystal oscillator it
cannot be used for RF transceiver operation.
Two low-frequency oscillators are present in the device:
• 32-kHz crystal oscillator
• 32-kHz RC oscillator.
The 32-kHz XOSC is designed to operate at 32.768 kHz and provide a stable clock signal for systems
requiring time accuracy. The 32-kHz RCOSC runs at 32.753 kHz when calibrated. The calibration can only
take place when the 32-MHz XOSC is enabled, and this calibration can be disabled by enabling the
SLEEPCMD.OSC32K_CALDIS bit. The 32-kHz RCOSC should be used to reduce cost and power
consumption compared to the 32-kHz XOSC solution. The two 32-kHz oscillators cannot be operated
simultaneously.
66 Power Management and Clocks SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Oscillators and Clocks
NOTE: The change from the 16-MHz clock source to the 32-MHz clock source (and vice versa)
aligns with the CLKCONCMD.TICKSPD setting. A slow CLKCONCMD.TICKSPD setting
when CLKCONCMD.OSC is changed results in a longer time before the actual source
change takes effect. The fastest switching is obtained when CLKCONCMD.TICKSPD equals
000.
NOTE: After coming up from PM1, PM2, or PM3, the CPU must wait for CLKCONSTA.OSC to be 0
before operations requiring the system to run on the 32-MHz XOSC (such as the radio) are
started.
SWRU191F – April 2009 – Revised April 2014 Power Management and Clocks 67
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Oscillators and Clocks www.ti.com
68 Power Management and Clocks SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Timer Tick Generation
CLKCONSTA (0x9E) – Clock Control Status
Bit Name Reset R/W Description
7 OSC32K 1 R Current 32-kHz clock source selected:
0: 32-kHz XOSC
1: 32-kHz RCOSC
6 OSC 1 R Current system clock selected:
0: 32-MHz XOSC
1: 16-MHz RCOSC
5:3 TICKSPD[2:0] 001 R Current timer ticks output setting
000: 32 MHz
001: 16 MHz
010: 8 MHz
011: 4 MHz
100: 2 MHz
101: 1 MHz
110: 500 kHz
111: 250 kHz
2:0 CLKSPD 001 R Current clock speed
000: 32 MHz
001: 16 MHz
010: 8 MHz
011: 4 MHz
100: 2 MHz
101: 1 MHz
110: 500 kHz
111: 250 kHz
SWRU191F – April 2009 – Revised April 2014 Power Management and Clocks 69
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Chapter 5
SWRU191F – April 2009 – Revised April 2014
Reset
The device has five reset sources. The following events generate a reset:
• Forcing the RESET_N input pin low
• A power-on reset condition
• A brownout reset condition
• Watchdog Timer reset condition
• Clock-loss reset condition
The initial conditions after a reset are as follows:
• I/O pins are configured as inputs with pullups (P1.0 and P1.1 are inputs, but do not have a pullup or
pulldown)
• CPU program counter is loaded with 0x0000 and program execution starts at this address
• All peripheral registers are initialized to their reset values (see register descriptions)
• Watchdog Timer is disabled
• Clock-loss detetector is disabled
During reset, the I/O pins are configured as inputs with pullups (P1.0 and P1.1 are inputs, but do not have
a pullup or pulldown). The RESET_N input is always configured as an input with pullup.
In the CC2533 and CC2541, a watchdog reset can be generated immediately in software by writing the
SRCRC.FORCE_RESET bit to 1 (see Section 4.3 for the register description). In the other devices in the
family, a watchdog reset can be triggered from software by enabling the watchdog timer with the shortest
time-out and waiting for it to trigger.
Flash Controller
The device contains flash memory for storage of program code. The flash memory is programmable from
the user software and through the debug interface.
The flash controller handles writing and erasing the embedded flash memory. The embedded flash
memory consists of up to 128 pages of 2048 bytes (CC2530, CC2531, CC2540, and CC2541) or 1024
bytes (CC2533) each.
The flash controller has the following features:
• 32-bit word programmable
• Page erase
• Lock bits for write protection and code security
• Flash-page erase timing 20 ms
• Flash-chip erase timing 20 ms
• Flash-write timing (4 bytes) 20 μs
This makes it possible to write up to 4 new bits to a 32-bit word 8 times. One example write sequence to a
word is shown in Table 6-1. Here bn represents the 4 new bits written to the word for each update. This
technique is useful to maximize the lifetime of the flash for data-logging applications.
NOTE: If a flash page-erase operation is performed from within flash memory and the Watchdog
Timer is enabled, a Watchdog Timer interval must be selected that is longer than 20 ms, the
duration of the flash page-erase operation, so that the CPU can clear the Watchdog Timer.
I/O Ports
There are 21 digital input/output pins that can be configured as general-purpose digital I/O or as peripheral
I/O signals connected to the ADC, timers, or USART peripherals. The use of the I/O ports is fully
configurable from user software through a set of configuration registers.
The I/O ports have the following key features:
• 21 digital input/output pins
• General-purpose I/O or peripheral I/O
• Pullup or pulldown capability on inputs
• External interrupt capability
The external interrupt capability is available on all 21 I/O pins. Thus, external devices may generate
interrupts if required. The external interrupt feature can also be used to wake the device up from sleep
mode (power modes PM1, PM2, and PM3).
When an interrupt condition occurs on one of the I/O pins, the interrupt status flag in the corresponding
P0–P2 interrupt flag register, P0IFG, P1IFG, or P2IFG, is set to 1. The interrupt status flag is set
regardless of whether the pin has its interrupt enable set. When an interrupt is serviced, the interrupt
status flag is cleared by writing a 0 to that flag. This flag must be cleared prior to clearing the CPU port
interrupt flag (PxIF). This is illustrated in Figure 2-4: There is an edge detect between the input line and
PxIFG, but no edge detect or one-shot between PxIFG and PxINT. The practical impact of this is what is
written in Section 2.5.1
The SFR registers used for interrupts are described later in this section. The registers are summarized as
follows:
• P0IEN: P0 interrupt enables
• P1IEN: P1 interrupt enables
• P2IEN: P2 interrupt enables
• PICTL: P0, P1, and P2 edge configuration
• P0IFG: P0 interrupt flags
• P1IFG: P1 interrupt flags
• P2IFG: P2 interrupt flags
7.6.1 Timer 1
PERCFG.T1CFG selects whether to use alternative 1 or alternative 2 locations.
In Table 7-1, the Timer 1 signals are shown as the following:
• 0: Channel 0 capture or compare pin
• 1: Channel 1 capture or compare pin
• 2: Channel 2 capture or compare pin
• 3: Channel 3 capture or compare pin
• 4: Channel 4 capture or compare pin
P2DIR.PRIP0 selects the order of precedence when assigning several peripherals to Port 0. When set to
10, Timer 1 channels 0–1 have precedence, and when set to 11, Timer 1 channels 2–3 have precedence.
To have all Timer 1 channels visible in the alternative 1 location, move both USART 0 and USART 1 to
the alternative 2 location.
P2SEL.PRI1P1 and P2SEL.PRI0P1 select the order of precedence when assigning several peripherals
to Port 1. The Timer 1 channels have precedence when the former is set low and the latter is set high.
7.6.2 Timer 3
PERCFG.T3CFG selects whether to use alternative 1 or alternative 2 locations.
In Table 7-1, the Timer 3 signals are shown as the following:
• 0: Channel 0 capture or compare pin
• 1: Channel 1 capture or compare pin
P2SEL.PRI2P1 and P2SEL.PRI3P1 select the order of precedence when assigning several peripherals
to Port 1. The Timer 3 channels have precedence when both bits are set high. If P2SEL.PRI2P1 is set
high and P2SEL.PRI3P1 is set low, the Timer 3 channels have precedence over USART 1, but USART 0
has precedence over the Timer 3 channels as well as over USART 1.
7.6.3 Timer 4
PERCFG.T4CFG selects whether to use alternative 1 or alternative 2 locations.
In Table 7-1, the Timer 4 signals are shown as the following:
• 0: Channel 0 capture or compare pin
• 1: Channel 1 capture or compare pin
P2SEL.PRI1P1 selects the order of precedence when assigning several peripherals to Port 1. The Timer
4 channels have precedence when the bit is set.
7.6.4 USART 0
The SFR register bit PERCFG.U0CFG selects whether to use alternative 1 or alternative 2 locations.
In Table 7-1, the USART 0 signals are shown as follows:
UART:
• RX: RXDATA
• TX: TXDATA
• RT: RTS
• CT: CTS
SPI:
• MI: MISO
• MO: MOSI
• C: SCK
• SS: SSN
P2DIR.PRIP0 selects the order of precedence when assigning several peripherals to Port 0. When set to
00, USART 0 has precedence. Note that if UART mode is selected and hardware flow control is disabled,
USART 1 or Timer 1 has precedence to use ports P0.4 and P0.5.
P2SEL.PRI3P1 and P2SEL.PRI0P1 select the order of precedence when assigning several peripherals
to Port 1. USART 0 has precedence when both are set to 0. Note that if UART mode is selected and
hardware flow control is disabled, Timer 1 or Timer 3 has precedence to use ports P1.2 and P1.3.
7.6.5 USART 1
The SFR register bit PERCFG.U1CFG selects whether to use alternative 1 or alternative 2 locations.
In Table 7-1, the USART 1 signals are shown as follows:
UART:
• RX: RXDATA
• TX: TXDATA
• RT: RTS
• CT: CTS
SPI:
• MI: MISO
• MO: MOSI
• C: SCK
• SS: SSN
P2DIR.PRIP0 selects the order of precedence when assigning several peripherals to Port 0. When set to
01, USART 1 has precedence. Note that if UART mode is selected and hardware flow control is disabled,
USART 0 or Timer 1 has precedence to use ports P0.2 and P0.3.
P2SEL.PRI3P1 and P2SEL.PRI2P1 select the order of precedence when assigning several peripherals
to Port 1. USART 1 has precedence when the former is set to 1 and the latter is set to 0. Note that if
UART mode is selected and hardware flow control is disabled, USART 0 or Timer 3 has precedence to
use ports P1.4 and P1.5.
7.6.6 ADC
In Table 7-1, the ADC signals are shown as follows:
• A0: ADC input 0
• A1: ADC input 1
• A2: ADC input 2
• A3: ADC input 3
• A4: ADC input 4
• A5: ADC input 5
• A6: ADC input 6
• A7: ADC input 7
• T: ADC external trigger pin
When using the ADC, Port 0 pins must be configured as ADC inputs. Up to eight ADC inputs can be used.
To configure a Port 0 pin to be used as an ADC input, the corresponding bit in the APCFG register must be
set to 1. The default values in this register select the Port 0 pins as non-ADC input, i.e., digital
input/outputs.
The settings in the APCFG register override the settings in P0SEL.
The ADC can be configured to use the general-purpose I/O pin P2.0 as an external trigger to start
conversions. P2.0 must be configured as a general-purpose I/O in input mode when being used for ADC
external trigger.
P0 (0x80) – Port 0
Bit Name Reset R/W Description
7:0 P0[7:0] 0xFF R/W Port 0. General-purpose I/O port. Bit-addressable from SFR. This CPU-internal register is readable,
but not writable, from XDATA (0x7080).
P1 (0x90) – Port 1
Bit Name Reset R/W Description
7:0 P1[7:0] 0xFF R/W Port 1. General-purpose I/O port. Bit-addressable from SFR. This CPU-internal register is readable,
but not writable, from XDATA (0x7090).
P2 (0xA0) – Port 2
Bit Name Reset R/W Description
7:5 – 000 R0 Reserved
4:0 P2[4:0] 1 1111 R/W Port 2. General-purpose I/O port. Bit-addressable from SFR. This CPU-internal register is readable,
but not writable, from XDATA (0x70A0).
P2SEL (0xF5) – Port 2 Function Select and Port 1 Peripheral Priority Control
Bit Name Reset R/W Description
7 – 0 R0 Reserved
6 PRI3P1 0 R/W Port 1 peripheral priority control. This bit determines which module has priority in the case when
modules are assigned to the same pins.
0: USART 0 has priority.
1: USART 1 has priority.
5 PRI2P1 0 R/W Port 1 peripheral priority control. This bit determines the order of priority in the case when PERCFG
assigns USART 1 and Timer 3 to the same pins.
0: USART 1 has priority.
1: Timer 3 has priority.
4 PRI1P1 0 R/W Port 1 peripheral priority control. This bit determines the order of priority in the case when PERCFG
assigns Timer 1 and Timer 4 to the same pins.
0: Timer 1 has priority.
1: Timer 4 has priority.
3 PRI0P1 0 R/W Port 1 peripheral priority control. This bit determines the order of priority in the case when PERCFG
assigns USART 0 and Timer 1 to the same pins.
0: USART 0 has priority.
1: Timer 1 has priority.
2 SELP2_4 0 R/W P2.4 function select
0: General-purpose I/O
1: Peripheral function
1 SELP2_3 0 R/W P2.3 function select
0: General-purpose I/O
1: Peripheral function
0 SELP2_0 0 R/W P2.0 function select
0: General-purpose I/O
1: Peripheral function
Note that registers OBSSEL0 through OBSSEL5 do not retain data in states PM2 and PM3.
DMA Controller
The Direct Memory Access (DMA) Controller can be used to relieve the 8051 CPU core of handling data
movement operations, thus achieving high overall performance with good power efficiency. The DMA
controller can move data from a peripheral unit such as ADC or RF transceiver to memory with minimum
CPU intervention.
The DMA controller coordinates all DMA transfers, ensuring that DMA requests are prioritized
appropriately relative to each other and to CPU memory access. The DMA controller contains a number of
programmable DMA channels for memory-memory data movement.
The DMA controller controls data transfers over the entire address range in XDATA memory space.
Because most of the SFR registers are mapped into the DMA memory space, these flexible DMA
channels can be used to unburden the CPU in innovative ways, for example, to feed a USART with data
from memory or periodically to transfer samples between ADC and memory, and so forth. Use of the DMA
can also reduce system power consumption by keeping the CPU in a low-power mode without having to
wake up to move data to or from a peripheral unit (see Section 4.1.1 for CPU low-power mode). Note that
Section 2.2.3 describes the SFR registers that are not mapped into XDATA memory space.
The main features of the DMA controller are as follows:
• Five independent DMA channels
• Three configurable levels of DMA channel priority
• 32 configurable transfer trigger events
• Independent control of source and destination address
• Single, block and repeated transfer modes
• Supports length field in transfer data, setting variable transfer length
• Can operate in either word-size or byte-size mode
Initialization
Yes
Write DMA Channel
Configuration
No
Reconfigure?
Yes
Trigger or No
DMAREQ.DMAREQn
= 1?
Yes
Modify Source/Destination
Address
Yes
No
Yes
Block Transfer
Mode?
No
F0033-01
Byte/Word n + 2
Byte/Word n + 1 Byte/Word n + 1
Byte/Word n Byte/Word n Byte/Word n
Byte/Word n – 1 Byte/Word n – 1 Byte/Word n – 1 Byte/Word n – 1
• • • •
Time
• • • •
• • • •
Byte/Word 3 Byte/Word 3 Byte/Word 3 Byte/Word 3
Byte/Word 2 Byte/Word 2 Byte/Word 2 Byte/Word 2
Byte/Word 1 Byte/Word 1 Byte/Word 1 Byte/Word 1
LENGTH = n LENGTH = n LENGTH = n LENGTH = n
Thus, the DMA controller expects the DMA configuration data structures for DMA channels 1–4 to lie in a
contiguous area in memory starting at the address held in DMA1CFGH:DMA1CFGL and consisting of 32
bytes.
Timer 1 is an independent 16-bit timer which supports typical timer and counter functions such as input
capture, output compare, and PWM functions. The timer has five independent capture-or-compare
channels. The timer uses one I/O pin per channel. The timer is used for a wide range of control and
measurement applications, and the availability of up-and-down count mode with five channels allows, for
example, implementation of motor-control applications.
The features of Timer 1 are as follows:
• Five capture-or-compare channels
• Rising-, falling-, or any-edge input capture
• Set, clear, or toggle output compare
• Free-running, modulo, or up-and down counter operation
• Clock prescaler for divide by 1, 8, 32, or 128
• Interrupt request generated on each capture or compare and terminal count
• DMA trigger function
SWRU191F – April 2009 – Revised April 2014 Timer 1 (16-Bit Timer) 103
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
16-Bit Counter www.ti.com
FFFFh
0000h
OVFL OVFL
T0308-01
104 Timer 1 (16-Bit Timer) SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Modulo Mode
T1CC0
0000h
T0309-02
T1CC0
0000h
OVFL OVFL
T0310-01
SWRU191F – April 2009 – Revised April 2014 Timer 1 (16-Bit Timer) 105
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Input Capture Mode www.ti.com
NOTE: Before an I/O pin can be used by the timer, the required I/O pin must be configured as a
Timer 1 peripheral pin.
The channel input pin is synchronized to the internal system clock. Thus, pulses on the input pin must
have a minimum duration greater than the system clock period.
The content of the 16-bit capture register is read out from registers T1CCnH:T1CCnL.
When the capture takes place, the interrupt flag for the channel, T1STAT.CHnIF (n is the channel
number), is set. An interrupt request is generated if enabled; see Section 9.10 for details.
106 Timer 1 (16-Bit Timer) SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Output Compare Mode
Assuming that channel 1 and channel 2 are used to drive the outputs using timer up-and-down mode and
the channels use output compare modes 4 and 5, respectively, then the timer period (in Timer 1 clock
periods) is:
tP = T1CC0 × 2
and the dead time, that is, the time when both outputs are low, (in Timer 1 clock periods) is given by:
tD = T1CC1 – T1CC2
A compare output pin is initialized to the value listed in Table 9-1 when:
• a value is written to T1CNTL (all Timer 1 channels)
• 0x7 is written to T1CCTLn.CMP (channel n)
SWRU191F – April 2009 – Revised April 2014 Timer 1 (16-Bit Timer) 107
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Output Compare Mode www.ti.com
FFFFh
T1CC0
T1CCn
0000h
108 Timer 1 (16-Bit Timer) SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Output Compare Mode
T1CC0
0000h
SWRU191F – April 2009 – Revised April 2014 Timer 1 (16-Bit Timer) 109
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Output Compare Mode www.ti.com
T1CC0
T1CCn
0000h
110 Timer 1 (16-Bit Timer) SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com IR Signal Generation and Learning
9.9.1 Introduction
Generation of IR signals for remote control is generally done in one of two ways:
• Modulated codes
• Non-modulated codes (C-codes, flash codes)
The device includes flexible timer functionality to implement generation and learning of both types of IR
signals with minimal CPU interaction. Most IR protocols can be implemented with only one CPU
intervention per command.
The IRCTL.IRGEN register bit enables IR generation mode in Timer 1. When the IRGEN bit is set,
Timer 1 takes the output of the Timer 3 channel 1 compare signal as tick instead of the system tick. The
Timer 1 period is set using T1CC0 with Timer 1 in modulo mode (T1CTL.MODE = 10) and channel 0 in
compare mode (T1CCTL0.MODE = 1). Channel 1 compare mode Clear output on compare, set on 0x0000
(T1CCTL1.CMP = 100) is used for output of the gating signal.
The number of mark carrier periods is set by T1CC1. T1CC1 must be updated every Timer 1 period by the
DMA or CPU. Note that an update to T1CC1 is buffered and does not take effect before Timer 1 reaches
0x0000.
The number of space carrier periods is set by T1CC0. Its value should be set to the total number of mark
and space carrier periods wanted. The compare values are buffered until the timer hits 0x0000.
The output of Timer 1 channel 1 is ANDed with that of Timer 3 channel 1 to form the IR output as shown
in Figure 9-7
SWRU191F – April 2009 – Revised April 2014 Timer 1 (16-Bit Timer) 111
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
IR Signal Generation and Learning www.ti.com
Timer 3 Ch 1 Output
Timer 3
B0358-01
The timing of the Timer 3 channel 1 output and Timer 1 channel 1 output signals is synchronized such that
no glitches are produced on the IR Out signal.
When the IRGEN bit is set, the IR out signal is routed to pins instead of the normal Timer 1 channel 1
output (see also Section 7.6.1).
Figure 9-8 shows the example of Timer 3 being initialized to a 33% duty cycle (T3CC0 = 3 × T3CC1).
Timer 1 has been initialized to 3.
Timer 3 Ch 1 Compare
Timer 3 Ch 0 Compare
Timer 1 Ch 1 Compare
Start Timers
Timer 3 Output
Timer 1 Output
IR Out
T0440-01
112 Timer 1 (16-Bit Timer) SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com IR Signal Generation and Learning
9.9.4 Learning
Learning is done by using the capture function of Timer 1 (16-bit) and Timer 3 (8-bit). Timer 3 can handle
the carrier frequency detection and Timer 1 can handle the code learning from the demodulated signal.
The circuit could be set up as described in Figure 9-9
IR
Timer 1 Ch 2
Demod
CC253x
CC2540
CC2541
PIN
Timer 3 Ch 1
Diode
B0359-01
SWRU191F – April 2009 – Revised April 2014 Timer 1 (16-Bit Timer) 113
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Timer 1 Registers www.ti.com
114 Timer 1 (16-Bit Timer) SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Timer 1 Registers
T1STAT (0xAF) – Timer 1 Status
Bit Name Reset R/W Description
7:6 – 00 R0 Reserved
5 OVFIF 0 R/W0 Timer 1 counter-overflow interrupt flag. Set when the counter reaches the terminal count value in free-
running or modulo mode, and when zero is reached counting down in up-and-down mode. Writing a 1
has no effect.
4 CH4IF 0 R/W0 Timer 1 channel 4 interrupt flag. Set when the channel 4 interrupt condition occurs. Writing a 1 has no
effect.
3 CH3IF 0 R/W0 Timer 1 channel 3 interrupt flag. Set when the channel 3 interrupt condition occurs. Writing a 1 has no
effect.
2 CH2IF 0 R/W0 Timer 1 channel 2 interrupt flag. Set when the channel 2 interrupt condition occurs. Writing a 1 has no
effect.
1 CH1IF 0 R/W0 Timer 1 channel 1 interrupt flag. Set when the channel 1 interrupt condition occurs. Writing a 1 has no
effect.
0 CH0IF 0 R/W0 Timer 1 channel 0 interrupt flag. Set when the channel 0 interrupt condition occurs. Writing a 1 has no
effect.
SWRU191F – April 2009 – Revised April 2014 Timer 1 (16-Bit Timer) 115
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Timer 1 Registers www.ti.com
116 Timer 1 (16-Bit Timer) SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Timer 1 Registers
T1CCTL2 (0xE7) – Timer 1 Channel 2 Capture or Compare Control
Bit Name Reset R/W Description
7 RFIRQ 0 R/W When set, use RF interrupt for capture instead of regular capture input.
6 IM 1 R/W Channel 2 interrupt mask. Enables interrupt request when set.
5:3 CMP[2:0] 000 R/W Channel 2 compare mode select. Selects action on output when timer value equals compare value in
T1CC2.
000: Set output on compare
001: Clear output on compare
010: Toggle output on compare
011: Set output on compare-up, clear on compare-down in up-and-down mode. Otherwise set output
on compare, clear on 0.
100: Clear output on compare-up, set on compare-down in up-and-down mode. Otherwise clear
output on compare, set on 0.
101: Clear when equal T1CC0, set when equal T1CC2
110: Set when equal T1CC0, clear when equal T1CC2
111: Initialize output pin. CMP[2:0] is not changed.
2 MODE 0 R/W Mode. Select Timer 1 channel 2 capture or compare mode
0: Capture mode
1: Compare mode
1:0 CAP[1:0] 00 R/W Channel 2 capture-mode select
00: No capture
01: Capture on rising edge
10: Capture on falling edge
11: Capture on all edges
SWRU191F – April 2009 – Revised April 2014 Timer 1 (16-Bit Timer) 117
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Timer 1 Registers www.ti.com
118 Timer 1 (16-Bit Timer) SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Accessing Timer 1 Registers as Array
T1CCTL4 (0x62A4) – Timer 1 Channel 4 Capture or Compare Control
Bit Name Reset R/W Description
7 RFIRQ 0 R/W When set, use RF interrupt for capture instead of regular capture input.
6 IM 1 R/W Channel 4 interrupt mask. Enables interrupt request when set.
5:3 CMP[2:0] 000 R/W Channel 4 compare mode select. Selects action on output when timer value equals compare value in
T1CC4.
000: Set output on compare
001: Clear output on compare
010: Toggle output on compare
011: Set output on compare-up, clear on compare down in up-and-down mode. Otherwise set output
on compare, clear on 0.
100: Clear output on compare-up, set on compare down in up-and-down mode. Otherwise clear
output on compare, set on 0.
101: Clear when equal T1CC0, set when equal T1CC4
110: Set when equal T1CC0, clear when equal T1CC4
111: Initialize output pin. CMP[2:0] is not changed.
2 MODE 0 R/W Mode. Select Timer 1 channel 4 capture or compare mode
0: Capture mode
1: Compare mode
1:0 CAP[1:0] 00 R/W Channel 4 capture-mode select
00: No capture
01: Capture on rising edge
10: Capture on falling edge
11: Capture on all edges
SWRU191F – April 2009 – Revised April 2014 Timer 1 (16-Bit Timer) 119
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Chapter 10
SWRU191F – April 2009 – Revised April 2014
Timer 3 and Timer 4 are two 8-bit timers. Each timer has two independent capture-or-compare channels,
each using one I/O pin per channel.
Features of Timer 3 and Timer 4 are as follows:
• Two capture-or-compare channels
• Set, clear, or toggle output compare
• Clock prescaler for divide by 1, 2, 4, 8, 16, 32, 64, 128
• Interrupt request generated on each capture or compare and terminal-count event
• DMA trigger function
120 Timer 3 and Timer 4 (8-Bit Timers) SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com 8-Bit Timer Counter
SWRU191F – April 2009 – Revised April 2014 Timer 3 and Timer 4 (8-Bit Timers) 121
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Input Capture Mode www.ti.com
NOTE: Before an I/O pin can be used by the timer, the required I/O pin must be configured as a
Timer 3 or Timer 4 peripheral pin.
The channel input pin is synchronized to the internal system clock. Thus, pulses on the input pin must
have a minimum duration greater than the system clock period.
The content of the 8-bit capture register for channel n is read out from register T3CCn or T4CCn.
When the capture takes place, the interrupt flag for the channel, TIMIF.TxCHnIF (x is 3 or 4, n is the
channel number), is set. An interrupt request is generated if enabled; see Section 10.6 for details.
A compare output pin is initialized to the value listed in Table 10-1 when:
• a 1 is written to TxCNTR.CLR (All Timer x channels)
• 0x7 is written to TxCCTLn.CMP (Timer x, channel n)
• Capture event
The SFR register TIMIF contains all interrupt flags for Timer 3 and Timer 4. The register bits
TIMIF.TxOVFIF and TIMIF.TxCHnIF contain the source interrupt flags for the two terminal-count value
events and the four channel-compare events, respectively. A source interrupt flag is set when the
corresponding event occurs, regardless of interrupt mask bits. The CPU interrupt flag IRCON.T3IF or
IRCON.T4IF is set when one of the events occurs if the corresponding interrupt mask bit is equal to 1.
The interrupt mask bits are TxCCTLn.IM for the four channels and TxCTL.OVFIM for the overflow events.
The CPU interrupt flag IRCON.T3IF or IRCON.T4IF is also set when a Timer 3 or Timer 4 source
interrupt flag is being cleared and one or more other source interrupt flags for the same timer are still set
while the corresponding interrupt mask bit is set. An interrupt request is generated when IRCON.TxIF
goes from 0 to 1 if IEN1.TxIEN and IEN0.EA are both equal to 1 (x is 3 or 4).
SWRU191F – April 2009 – Revised April 2014 Timer 3 and Timer 4 (8-Bit Timers) 123
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Timer 3 and Timer 4 Registers www.ti.com
124 Timer 3 and Timer 4 (8-Bit Timers) SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Timer 3 and Timer 4 Registers
T3CCTL1 (0xCE) – Timer 3 Channel 1 Capture or Compare Control
Bit Name Reset R/W Description
7 – 0 R0 Reserved
6 IM 1 R/W Channel 1 interrupt mask
0: Interrupt is disabled.
1: Interrupt is enabled.
5:3 CMP[2:0] 000 R/W Channel 1 compare output-mode select. Specified action on output when timer value equals
compare value in T3CC1
000: Set output on compare
001: Clear output on compare
010: Toggle output on compare
011: Set on compare-up, clear on compare-down in up-and-down mode. Otherwise, set output
on compare, clear on 0.
100: Clear output on compare-up, set on compare-down in up-and-down mode. Otherwise
clear output on compare, set on 0.
101: Set output on compare, clear on 0xFF
110: Clear output on compare, set on 0x00
111: Initialize output pin. CMP[2:0] is not changed
2 MODE 0 R/W Mode. Select Timer 3 channel 1 mode
0: Capture mode
1: Compare mode
1:0 CAP[1:0] 00 R/W Capture mode select
00: No capture
01: Capture on rising edge
10: Capture on falling edge
11: Capture on both edges
SWRU191F – April 2009 – Revised April 2014 Timer 3 and Timer 4 (8-Bit Timers) 125
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Timer 3 and Timer 4 Registers www.ti.com
126 Timer 3 and Timer 4 (8-Bit Timers) SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Timer 3 and Timer 4 Registers
T4CCTL1 (0xEE) – Timer 4 Channel 1 Capture or Compare Control
Bit Name Reset R/W Description
7 – 0 R0 Reserved
6 IM 1 R/W Channel 1 interrupt mask
5:3 CMP[2:0] 000 R/W Channel 1 compare output-mode select. Specified action on output when timer value equals
compare value in T4CC1
000: Set output on compare
001: Clear output on compare
010: Toggle output on compare
011: Set on compare-up, clear on compare-down in up-down mode. Otherwise, set output on
compare, clear on 0.
100: Clear output on compare-up, set on compare-down in up-down mode. Otherwise clear
output on compare, set on 0.
101: Set output on compare, clear on 0xFF
110: Clear output on compare, set on 0x00
111: Initialize output pin. CMP[2:0] is not changed.
2 MODE 0 R/W Mode. Select Timer 4 channel 1 mode
0: Capture mode
1: Compare mode
1:0 CAP[1:0] 00 R/W Capture mode select. 00 – No Capture, 01 – Capture on rising edge, 10 – Capture on falling
edge, 11 – Capture on both edges
SWRU191F – April 2009 – Revised April 2014 Timer 3 and Timer 4 (8-Bit Timers) 127
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Chapter 11
SWRU191F – April 2009 – Revised April 2014
Sleep Timer
The Sleep Timer is used to set the period during which the system enters and exits low-power modes
PM1 and PM2. The Sleep Timer is also used to maintain timing in Timer 2 when entering power mode
PM1 or PM2.
The main features of the Sleep Timer are the following:
• 24-bit timer up-counter operating at 32-kHz clock rate
• 24-bit compare with interrupt and DMA trigger
• 24-bit capture
11.1 General
The Sleep Timer is a 24-bit timer running on the 32-kHz clock (either RCOSC or XOSC). The timer starts
running immediately after a reset and continues to run uninterrupted.
The current value of the timer can be read from SFR registers ST2:ST1:ST0. When ST0 is read, the
current value of the 24-bit counter is latched. Thus, the ST0 register must be read before ST1 and ST2 to
read a correct Sleep Timer count value.
The Sleep Timer is running when operating in all power modes except PM3. The value of the Sleep Timer
is not preserved in PM3. When returning from PM1 or PM2 (where the system clock is shut down), the
Sleep Timer value in ST2:ST1:ST0 is not up-to-date until a positive edge on the 32-kHz clock has been
detected after the system clock restarted. To ensure an updated value is read, wait for a positive transition
on the 32-kHz clock by polling the SLEEPSTA.CLK32K bit, before reading the Sleep Timer value.
Note that if supply voltage drops below 2 V while in PM2, the sleep interval might be affected.
P0IFG[0]
STCS.VALID
SLEEPSTA.CLK32K
STCV[23:0]
Figure 11-1. Sleep Timer Capture (Example Using Rising Edge on P0_0)
It is not possible to switch the input-capture pin while capture is enabled. Capture must be disabled before
a new input-capture pin can be selected. To disable capture, follow these steps (note that interrupts are
disabled for up to half of a 32-kHz cycle, or 15.26 µs):
1. Disable interrupts.
2. Wait until SLEEPSTA.CLK32K is high.
3. Set STCC.PORT[1:0] to 3. This disables capture.
ADC
The ADC (in the CC2530, CC2531, CC2540, and CC2541) supports 14-bit analog-to-digital conversion
with up to 12 effective number of bits (ENOB). It includes an analog multiplexer with up to eight
individually configurable channels and a reference voltage generator. Conversion results can be written to
memory through DMA. Several modes of operation are available.
AIN0
...
AIN7
VDD/3 Input Sigma-Delta Decimation
Mux Modulator Filter
TMP_ SENSOR
B0304-01
The single-ended inputs AIN0 through AIN7 are represented by channel numbers 0 to 7. Channel
numbers 8 through 11 represent the differential inputs consisting of AIN0–AIN1, AIN2–AIN3, AIN4–AIN5,
and AIN6–AIN7. Channel numbers 12 through 15 represent GND (12), temperature sensor (14), and
AVDD5/3 (15), with channel 13 being reserved. These values are used in the ADCCON2.SCH and
ADCCON3.SCH fields.
The ADC input is a switched capacitance stage which draws current during the conversion. As an
example, the equivalent input impedance of a typical device was found to be 176 kΩ when used with an
input voltage of 3 V, a 512× decimation rate, and the internal reference.
To enable the temperature sensor as an input to the ADC, the TR0.ADCTM bit must be set to 1 before
setting the ATEST.ATESTCTRL bit to 1. When disabling the temperature sensor as an input, the
ATEST.ATESTCTRL bit must be set to 0 before clearing the TR0.ADCTM bit. The TR0 register does not
have any retention in PM2 or PM3, so ATEST and TR0 must be cleared in the correct manner before
entering these power modes.
The ADCCON2.SDIV bits select the decimation rate, thereby also the resolution and time required to
complete a conversion, and hence the sample rate. The decimation rate should only be changed when no
conversion is running.
The last channel of a sequence is selected with the ADCCON2.SCH bits as described previously.
The ADCCON3 register controls the channel number, reference voltage, and decimation rate for a single
conversion. The single conversion takes place immediately after the ADCCON3 register is written to, or if a
conversion sequence is ongoing, immediately after the sequence has ended. The coding of the register
bits is exactly as for ADCCON2.
In addition, one DMA trigger, ADC_CHALL, is active when new data is ready from any of the channels in
the ADC conversion sequence.
Battery Monitor
The battery monitor (in the CC2533 only) enables simple voltage monitoring in the devices that do not
include an ADC. It is designed such that it is accurate in the voltage areas around 2 V, with lower
resolution at higher voltages. The registers BATTMON and MONMUX are used to access and control the
functionality of the battery monitor.
The battery monitor can also be used to do simple temperature monitoring by connecting it to the chip
internal temperature sensor instead of the supply voltage. The input is controlled using the MONMUX
register.
NOTE: One should turn the battery monitor off (BATTMON_PD = 1) after reading the measurement
BATTMON_OUT in order to save power, as the battery monitor consumes power when
enabled ( = 0).
Recommended usage of the battery monitor can be summarized in the following way:
1. Set BATTMON_VOLTAGE to the value to be monitored.
2. Enable the battery monitor by setting BATTMON_PD =
0.
3. Wait for at least 2 µs.
4. Read the BATTMON_OUT result to see whether the voltage level is above or below the value set in
BATTMON_VOLTAGE.
5. Disable the battery monitor (BATTMON_PD = 1) to avoid unnecessary current consumption.
The temperature sensor is inversely proportional to BATTMON_VOLTAGE. The temperature (in °C)
corresponding to a given BATTMON_VOLTAGE is given by:
A
Temp = -B
BATTMON_VOLTAGE<4:0> (1)
Assuming BATTMON_VOLTAGE < 27, and only valid for –40°C < Temp < 125°C, A and B for a typical
device are given in Table 13-2.
Note that A should be relatively constant for all devices, but B is not. Information that can be used to
calculate B for a given chip is included in the chip's information page (see Section 2.2.3 for information
about the information page).
Example:
Find the BATTMON_VOLTAGE setting that tells whether the temperature is above or below 75°C.
6470
BATTMON_VOLTAGE<4:0> = = 15.82
75 + 334 (2)
The closest setting is 16, which corresponds to approximately 70°C (see Table 13-1). By writing 16 to
BATTMON_VOLTAGE, an output of BATTMON_OUT = 1 tells that the temperature is above 70°C, whereas
BATTMON_OUT = 0 tells that it is below 70°C.
Random-Number Generator
This chapter provides information about the random-number generator and its usage.
14.1 Introduction
The random-number generator has the following features.
• Generates pseudorandom bytes which can be read by the CPU or used directly by the command
strobe processor (see Section 23.14)
• Calculates CRC16 of bytes that are written to RNDH
• Seeded by value written to RNDL
The random-number generator is a 16-bit linear-feedback shift register (LFSR) with polynomial X16 + X15 +
X2 + 1 (that is, CRC16). It uses different levels of unrolling depending on the operation it performs. The
basic version (no unrolling) is shown in Figure 14-1.
The random-number generator is turned off when ADCCON1.RCTRL = 11.
15 + 14 13 12 11 10 9 8 7 6 5 4 3 2 + 1 0
in_bit +
M0105-01
14.2.2 Seeding
The LFSR can be seeded by writing to the RNDL register twice. Each time the RNDL register is written, the
8 LSBs of the LFSR are copied to the 8 MSBs and the 8 LSBs are replaced with the new data byte that
was written to RNDL.
For the CC253x, when a random value is required, the LFSR should be seeded by writing RNDL with
random bits from the IF_ADC in the RF receive path. To use this seeding method, the radio must first be
powered on. The radio should be placed in the infinite RX state to avoid possible sync detect in the RX
state. The random bits from the IF_ADC are read from the least-significant bit position of the RF register
RFRND. These bits should be concatenated over time to form the bytes needed for the random-number-
generator seed. See Section 23.12 for a description of the randomness of these numbers. Note that this
cannot be done while the radio is in use for normal tasks.
Note that a seed value of 0x0000 or 0x8003 always leads to an unchanged value in the LFSR after
clocking, as no values are pushed in via in_bit (see Figure 14-1); hence, neither of these seed values
should be used for random-number generation.
14.2.3 CRC16
The LFSR can also be used to calculate the CRC value of a sequence of bytes. Writing to the RNDH
register triggers a CRC calculation. The new byte is processed from the MSB end and an 8× unrolling is
used, so that a new byte can be written to RNDH every clock cycle.
Note that the LFSR must be properly seeded by writing to RNDL before the CRC calculations start.
Usually, the seed value for CRC calculations should be 0x0000 or 0xFFFF.
AES Coprocessor
The Advanced Encryption Standard (AES) coprocessor allows encryption or decryption to be performed
with minimal CPU usage.
The coprocessor has the following features:
• Supports all security suites in IEEE 802.15.4
• ECB, CBC, CFB, OFB, CTR, and CBC-MAC modes
• Hardware support for CCM mode
• 128-bit key and IV/nonce
• DMA transfer trigger capability
15.6 CBC-MAC
When performing CBC-MAC encryption, data is downloaded to the coprocessor in CBC-MAC mode one
block at a time, except for the last block. Before the last block is loaded, the mode is changed to CBC.
The last block is downloaded and the block uploaded is the message MAC.
CBC-MAC decryption is similar to encryption. The message MAC uploaded must be compared with the
MAC to be verified.
Name Designation
B0 First Block for Authentication in CCM Mode
Byte 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Name Flag Nonce L_M
Figure 15-1. Message Authentication Phase Block B0
There is no restriction on the nonce value. L_M is the message length in bytes.
For 802.15.4, nonce is 13 bytes and L_M is 2 bytes.
The content of the authentication flag byte is described in Figure 15-2.
L is set to 6 in this example. So, L – 1 is set to 5. M and A_Data can be set to any value.
Name Designation
FLAG-B0 Authentication Flag Field for CCM mode
Bit 7 6 5 4 3 2 1 0
Name Reserved A_Data (M – 2) / 2 L–1
Value 0 x x x x 1 0 1
Figure 15-2. Authentication Flag Byte
3. If some additional authentication data (denoted a, following) is needed (that is, A_Data = 1), the
software creates the A_Data length field, called L(a) by:
• (a) If l(a) = 0, (that is, A_Data = 0), then L(a) is the empty string. Note that l(a) is the length of a in
octets.
• (b) If 0 < l(a) < 216 – 28, then L(a) is the 2-octet encoding of l(a).
The additional authentication data is appended to the A_Data length field L(a). The additional
authentication blocks are padded with zeros until the last additional authentication block is full. There is
no restriction on the length of a.
AUTH-DATA = L(a) + Authentication Data + (zero padding)
4. The last block of the message is padded with zeros until full (that is, if its length is not an integral
multiple of 128 bits).
5. The software concatenates block B0, the additional authentication blocks if any, and the message;
Input message = B0 + AUTH-DATA + Message + (zero padding of message)
6. Once the input message authentication by CBC-MAC is finished, the software leaves the uploaded
buffer contents unchanged (M = 16), or keeps only the higher-M bytes of the buffer unchanged, while
setting the lower bits to 0 (M != 16).
The result is called T.
Message Encryption
7. The software creates the key stream block A0. Note that L = 6, with the current example of the CTR
generation. The content is shown in Figure 15-3.
Note that when encrypting authentication data T to generate U in OFB mode, the CTR value must be
zero. When encrypting message blocks using CTR mode, the CTR value must be any value but zero.
The content of the encryption-flag byte is described in Figure 15-4.
Name Designation
FLAG-A0 Encryption Flag Field for CCM Mode
Bit 7 6 5 4 3 2 1 0
Name Reserved — L–1
Value 0 0 0 0 0 1 0 1
Figure 15-4. Encryption Flag Byte
8. The software loads A0 by selecting a Load IV/nonce command. To do so, it sets the mode to CFB or
OFB at the same time it selects the Load IV/nonce command.
9. The software calls a CFB or an OFB encryption on the authenticated data T. The uploaded buffer
contents stay unchanged (M = 16), or only its first M bytes stay unchanged, the others being set to 0
(M – 16). The result is U, which is used later.
10. The software calls a CTR-mode encryption immediately on the still-padded message blocks. It must
reload the IV when the CTR value is any value but zero.
11. The encrypted authentication data U is appended to the encrypted message. This gives the final
result, C.
Result C = encrypted message(m) + U
Message Decryption
CCM Mode Decryption
In the coprocessor, the automatic generation of CTR works on 32 bits; therefore, the maximum length of a
message is 128 × 232 bits, that is 236 bytes, which can be written in a 6-bit word. So, the value L is set to 6.
To decrypt a CCM-mode processed message, the following sequence can be conducted (key is already
loaded).
Message Parsing Phase
1. The software parses the message by separating the M rightmost octets, namely U, and the other
octets, namely string C.
2. C is padded with zeros until it can fill an integral number of 128-bit blocks.
3. U is padded with zeros until it can fill a 128-bit block.
4. The software creates the key stream block A0. It is done the same way as for CCM encryption.
5. The software loads A0 by selecting a Load IV/nonce command. To do so, it sets the mode to CFB or
OFB at the same time as it selects the IV load.
6. The software calls a CFB or an OFB encryption on the encrypted authenticated data U. The uploaded
buffer contents stay unchanged (M = 16), or only its first M bytes stay unchanged, the others being set
to 0 (M != 16). The result is T.
7. The software calls a CTR-mode decryption immediately on the encrypted message blocks C.
Reloading the IV/CTR is not necessary.
Reference Authentication Tag Generation
This phase is identical to the authentication phase of CCM encryption. The only difference is that the
result is named MACTag (instead of T).
Message Authentication Checking Phase
The software compares T with MACTag.
Watchdog Timer
The Watchdog Timer (WDT) is intended as a recovery method in situations where the CPU may be
subjected to a software upset. The WDT resets the system when software fails to clear the WDT within
the selected time interval. The watchdog can be used in applications that are subject to electrical noise,
power glitches, electrostatic discharge, and so forth, or where high reliability is required. If the watchdog
function is not needed in an application, it is possible to configure the Watchdog Timer to be used as an
interval timer that can be used to generate interrupts at selected time intervals.
The features of the Watchdog Timer are as follows:
• Four selectable timer intervals
• Watchdog mode
• Timer mode
• Interrupt request generation in timer mode
The WDT is configured as either a Watchdog Timer or as a timer for general-purpose use. The operation
of the WDT module is controlled by the WDCTL register. The Watchdog Timer consists of a 15-bit counter
clocked by the 32-kHz clock source. Note that the contents of the 15-bit counter are not user-accessible.
The contents of the 15-bit counter are retained during all power modes, and the Watchdog Timer
continues counting when entering active mode again.
USART
USART 0 and USART 1 are serial communications interfaces that can be operated separately in either
asynchronous UART mode or in synchronous SPI mode. The two USARTs have identical functions, and
are assigned to separate I/O pins. See Section 7.6 for I/O configuration.
NOTE: When the application has read UxDBUF, it is important that it does not clear
UxCSR.RX_BYTE. Clearing UxCSR.RX_BYTE implicitly makes the UART believe that the
UART RX shift register is empty, even though it might hold pending data (typically due to
back-to-back transmission). Consequently, the UART asserts (TTL low) the RT/RTS line,
which allows flow into the UART, leading to potential overflow. Hence, the
UxCSR.RX_BYTE flag integrates closely with the automatic RT/RTS function and must
therefore be controlled solely by the SoC UART itself. Otherwise, the application could
typically experience that the RT/RTS line remains asserted (TTL low), even though a back-
to-back transmission clearly suggests it ought to intermittently pause the flow.
Table 17-1. Commonly Used Baud-Rate Settings for 32 MHz System Clock
Baud Rate (bps) UxBAUD.BAUD_M UxGCR.BAUD_E Error (%)
2400 59 6 0.14
4800 59 7 0.14
9600 59 8 0.14
14,400 216 8 0.03
19,200 59 9 0.14
Operational Amplifier
The operational amplifier (in the CC2530, CC2531, and CC2540) has the following features:
• Low offset
• Ideal for use in combination with the onboard ADC in sensor applications
18.1 Description
The operational amplifier is connected to the I/O pins as follows:
• The positive input pin is connected to P0_0.
• The negative input pin is connected to P0_1.
• The output is connected to P0_2.
The pins used by the operational amplifier must be configured as analog pins, by setting bits APCFG[2:0]
to 1. The OPAMPC.EN bit is used to enable or disable the operational amplifier. When power mode PM2 or
PM3 is entered, the operational amplifier is shut down automatically and must be restarted when entering
PM0 again.
18.2 Calibration
The operational amplifier must be calibrated. A calibration is started by writing 1 to OPAMPC.CAL. During
calibration, OPAMPS.CAL_BUSY is 1. A new calibration is not accepted before OPAMPS.CAL_BUSY goes
low. Every time after enabling the operational amplifier, calibration must be performed.
18.4 Registers
This section describes the registers for the operational amplifier.
A
OPAMPMC (CC2530, CC2531: 0x61A6. CC2540: 0x61AD) – Operational Amplifier Mode Control
Bit Name Reset R/W Description
7:2 – 0000 00 R/W Reserved. Always write 0000 00.
1:0 MODE 00 R/W Operational amplifier mode
00 and 01: Non-chop mode – Higher offset (approximately 500 µV), but no
chopper ripple. Use in conjunction with Mode 10 if offset cancellation is
required. Offset for these two modes is the opposite of the offset seen in Mode
10.
10: Non-chop mode – Higher offset (approximately 500 µV), but no chopper
ripple. Use in conjunction with Mode 00 or Mode 01 to double sample and
correct for the offset by averaging the two samples.
11: Chop mode – Very low offset (approximately 50 µV), and very low noise (1
/ f noise shifted to 1 MHz due to chopping), and 1 MHz ripple
Analog Comparator
The analog comparator (in the CC2530, CC2531, CC240 and CC2541) has the following features:
• Low-power operation
• Wake-up source
19.1 Description
The analog comparator is connected to the I/O pins as follows:
• The positive input pin is connected to P0_5.
• The negative input pin is connected to P0_4.
• The output can be read from CMPCTL.OUTPUT.
The comparator pins must be configured as analog pins by setting bits APCFG[5:4] to 1. The
CMPCTL.EN bit is used to enable or disable the comparator. The output from the comparator is connected
internally to the edge detector that controls P0IFG[5]. This makes it possible to associate an I/O interrupt
with a rising or falling edge on the comparator output. When enabled, the comparator remains active while
in power mode 2 or 3. Thus, it is possible to wake up from power mode 2 or 3 on a rising or falling edge
on the comparator output.
ENB
P0_4
(Pad)
Analog
Comparator
1
Edge Detector
for P0_5
ENB 0
P0_5
(Pad)
19.2 Register
This section describes the registers for the analog comparator.
A
I 2C
The I2C module (in the CC2533 and CC2541) provides an interface between the device and I2C-
compatible devices connected by the two-wire I2C serial bus. External components attached to the I2C bus
serially transmit and/or receive serial data to or from the I2C module through the two-wire I2C interface.
The I2C module features include:
• Compliance with the I2C specification v2.1 (published by NXP)
• 7-bit device addressing modes
• General call
• START, RESTART, and STOP
• Multi-master transmitter and receiver modes
• Slave receiver and transmitter modes
• Standard mode up to 100-kbps and fast mode up to 400-kbps support
Figure 20-1 shows the block diagram of the I2C module.
On the CC2533 and CC2541, the I2C module is connected to pins 2 and 3 on the chip and uses the P2
interrupt to the CPU. Pins 2 and 3 can alternatively be controlled as two GPIO pins if they are not used by
the I2C module.
The I2C pins cannot be used to wake the device from PM2 or PM3. To wake up on activity on the I2C, the
I2C bus must be connected to a normal GPIO in parallel.
Address comparator
System
clock
Serial clock generator SCL
Control Interrupt P2
Control register (I2CCFG)
logic interrupt
20.1 Operation
The I2C module supports any slave or master I2C-compatible device. Figure 20-2 shows an example of an
I2C bus. Each I2C device is recognized by a unique address and can operate as either a transmitter or a
receiver. A device connected to the I2C bus can be considered as the master or the slave when
performing data transfers. A master initiates a data transfer and generates the clock signal, SCL. Any
device addressed by a master is considered a slave.
I2C data is communicated using the serial data (SDA) pin and the serial clock (SCL) pin. Both SDA and
SCL are bidirectional and must be connected to a positive supply voltage using a pullup resistor.
VCC
CC253x
CC2541 Device A
Device B Device C
SDA
MSB Acknowledgement Acknowledgement
Signal From Receiver Signal From Receiver
SCL
START 1 2 7 8 9 1 2 8 9 STOP
Condition (S) R/W ACK ACK Condition (P)
START and STOP conditions are generated by the master and are shown in Figure 20-3. A START
condition is a high-to-low transition on the SDA line while SCL is high. A STOP condition is a low-to-high
transition on the SDA line while SCL is high.
Data on SDA must be stable during the high period of SCL (see Figure 20-4). The state of SDA can only
change when SCL is low, otherwise a START or STOP condition is generated.
Data Line
Stable Data
SDA
SCL
S Slave Address R/W ACK Data ACK S Slave Address R/W ACK Data ACK P
1 Any 1 Any Number
Number
Figure 20-6. I2C Module Addressing Format With Repeated START Condition
When a START condition is detected on the bus, the I2C module receives the transmitted address and
compares it against its own address stored in I2CADDR.ADDR. If the compare is successful, an interrupt is
generated and the I2CCFG.SI bit is set. The same is done for a general call address match if the
I2CADDR.GC bit is set.
20.1.4.3 Arbitration
If two or more master transmitters simultaneously start a transmission on the bus, an arbitration procedure
is invoked. Figure 20-7 shows the arbitration procedure between two devices. The arbitration procedure
uses the data presented on SDA by the competing transmitters. The first master transmitter that generates
a logic high is overruled by the opposing master generating a logic low. The arbitration procedure gives
priority to the device that transmits the serial data stream with the lowest binary value. The master
transmitter that lost arbitration switches to the slave receiver mode. If two or more devices send identical
first bytes, arbitration continues on the subsequent bytes.
Bus Line
SCL
Device #1 Lost Arbitration
n and Switches Off
Data From
Device #1
1
0 0 0
Data From
Device #2
1 1 1
0 0 0
Bus Line
SDA
1 1 1
Figure 20-7. Arbitration Procedure Between Two Master Transmitters
SCL From
Device #2
Bus Line
SCL
Figure 20-8. Synchronization of Two I2C Clock Generators During Arbitration
USB Controller
This section focuses on describing the functionality of the USB controller (in the CC2531 and CC2540
only), and it is assumed that the reader has a good understanding of USB and is familiar with the terms
and concepts used. See the Universal Serial Bus Specification for details ([8], Appendix C).
Standard USB nomenclature is used regarding IN and OUT. That is, IN is always into the host (PC) and
OUT is out of the host.
USB Controller
EP0
EP1
DP EP2
Memory
USB PHY USB SIE Arbiter
DM EP3
EP4
EP5
1 KB
SRAM
(FIFOs)
B0305-01
The USB controller uses interrupt number 6 for USB interrupts. This interrupt number is shared with Port 2
inputs; hence, the interrupt routine must also handle Port 2 interrupts if they are enabled. For an interrupt
request to be generated, IEN2.P2IE must be set to 1, together with the desired interrupt enable bits from
the USBCIE, USBIIE, and USBOIE registers. When an interrupt request has been generated, the CPU
starts executing the ISR if there are no higher-priority interrupts pending. The interrupt routine should read
all the interrupt flag registers and take action depending on the status of the flags. The interrupt flag
registers are cleared when they are read, and the status of the individual interrupt flags should therefore
be saved in memory (typically in a local variable on the stack) to allow them to be accessed multiple
times.
At the end of the ISR, after the interrupt flags have been read, the interrupt flags should be cleared to
allow for new USB and P2 interrupts to be detected. The Port 2 interrupt status flags in the P2IFG register
should be cleared prior to clearing IRCON2.P2IF.
When waking up from suspend (typically in PM1), the USB D+ interrupt flag, P2IFG.DPIF, is set. The D+
interrupt flag indicates that there has been a falling edge on the D+ USB data pin. This is a resume event.
21.5 Endpoint 0
Endpoint 0 (EP0) is a bidirectional control endpoint, and during the enumeration phase all communication
is performed across this endpoint. Before the USBADDR register has been set to a value other than 0, the
USB controller is only able to communicate through endpoint 0. Setting the USBADDR register to a value
between 1 and 127 brings the USB function out of the default state in the enumeration phase and into the
address state. All configured endpoints are then available for the application.
The EP0 FIFO is only used as either IN or OUT, and double buffering is not provided for endpoint 0. The
maximum packet size for endpoint 0 is fixed at 32 bytes.
Endpoint 0 is controlled through the USBCS0 register by setting the USBINDEX register to 0. The USBCNT0
register contains the number of bytes received.
(1)
For isochronous transfers there would not be a handshake packet from the host.
Firmware should load the EP0 FIFO with the first data packet and set the USBCS0.INPKT_RDY bit as
soon as possible after the USBCS0.CLR_OUTPKT_RDY bit has been set. The USBCS0.INPKT_RDY is
cleared and an EP0 interrupt is generated when the data packet has been sent. Firmware might then load
more data packets as necessary. An EP0 interrupt is generated for each packet sent. Firmware must set
USBCS0.DATA_END in addition to USBCS0.INPKT_RDY when the last data packet has been loaded. This
starts the status stage of the control transfer.
EP0 switches to the IDLE state when the status stage has completed. The status stage may fail if the
USBCS0.SEND_STALL bit is set to 1. The USBCS0.SENT_STALL bit is then asserted, and an EP0
interrupt is generated.
If USBCS0.INPKT_RDY is not set when receiving an IN token, the USB controller replies with a NAK to
indicate that the endpoint is working, but temporarily has no data to send.
(2)
For isochronous transfers, there is no handshake packet from the device.
When the IN or OUT endpoint of an endpoint number uses double buffering, the sum of USBMAXI and
USBMAXO must not exceed half the FIFO size for the endpoint. Figure 21-2 b) illustrates the IN and OUT
FIFO memory for an endpoint that uses double buffering. Notice that the second OUT buffer starts from
the middle of the memory region and grows upward. The second IN buffer also starts from the middle of
the memory region but grows downward.
To configure an endpoint as IN-only, set USBMAXO to 0, and to configure an endpoint as OUT-only, set
USBMAXI to 0.
For unused endpoints, both USBMAXO and USBMAXI should be set to 0.
0 0
IN FIFO
IN FIFO (Buffer 1)
USBMAXI-1 USBMAXI-1
USBMAXO-1
OUT FIFO
(Buffer 2)
0
0
IN FIFO
(Buffer 2)
USBMAXI -1
USBMAXO-1 USBMAXO-1
OUT FIFO
OUT FIFO (Buffer 1)
0 0
a) Single Buffering b) Double Buffering
M0106-02
21.8 DMA
DMA should be used to fill the IN endpoint FIFOs and empty the OUT endpoint FIFOs. Using DMA
improves the read and write performance significantly compared to using the CPU. It is therefore highly
recommended to use DMA unless timing is not critical or only a few bytes are to be transferred.
There are no DMA triggers for the USB controller, meaning that DMA transfers must be triggered by
firmware.
Byte-size transfer should be used.
Timer 2 is mainly used to provide timing for 802.15.4 command-strobe-processor algorithms and for
general timekeeping in the 802.15.4 MAC layer on CC253x devices, for timekeeping in the BLE link layer
on CC2540 and CC2541, and for general radio timekeeping when running the radio in proprietary mode
on CC2541. Timer 2 must not be used by the application on the CC2540 or CC2541 when the BLE stack
is running. When Timer 2 is used together with the Sleep Timer, the timing function is provided even when
the system enters low-power modes PM1 and PM2. The timer runs at a speed according to the system
clock. If Timer 2 is to be used with the Sleep Timer, the system clock source must be the 32-MHz crystal
whenever Timer 2 is running, and an external 32-kHz XOSC should be used for accurate results.
The main features of Timer 2 are the following:
• 16-bit timer up-counter providing, for example, a symbol period of 16 µs or a frame period of 320 µs
• Adjustable period with accuracy of 31.25 ns
• 2 × 16-bit timer compare function
• 24-bit overflow count
• 2 × 24-bit overflow compare function
• Start-of-frame-delimiter capture function
• Timer start and stop synchronous with 32-kHz clock and timekeeping maintained by Sleep Timer.
• Interrupts generated on compare and overflow
• DMA trigger capability
• Possible to adjust timer value while counting by introducing delay
SWRU191F – April 2009 – Revised April 2014 Timer 2 (MAC Timer) 197
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Timer Operation www.ti.com
22.1.1 General
After a reset, the timer is in the timer IDLE mode, where it is stopped. The timer starts running when
T2CTRL.RUN is set to 1. The timer then enters the timer RUN mode. Either the entry is immediate, or it is
performed synchronously with the 32-kHz clock. See Section 22.4 for a description of the synchronous
start-and-stop mode.
Once the timer is running in RUN mode, it can be stopped by writing a 0 to T2CTRL.RUN. The timer then
enters the timer IDLE mode. The stopping of the timer is performed either immediately or synchronously
with the 32-kHz clock.
22.1.2 Up Counter
Timer 2 contains a 16-bit timer, which increments on each clock cycle. The counter value can be read
from registers T2M1:T2M0 with register T2MSEL.T2MSEL set to 000. Note that the register content in
T2M1 is latched when T2M0 is read, meaning that T2M0 must always be read first.
When the timer is idle, the counter can be modified by writing to registers T2M1:T2M0 with register
T2MSEL.T2MSEL set to 000. T2M0 must be written first.
198 Timer 2 (MAC Timer) SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Timer Operation
If one wants to read just the overflow counter without reading timer first, read T2MOVF0 with
T2MSEL.T2MOVFSEL set to 000 and T2CTRL.LATCH_MODE set to 0. This returns the low byte of the
overflow counter, and latches the two most-significant bytes of the overflow counter so the values are
ready to be read.
22.2 Interrupts
The timer has six (eight on CC2541) individually maskable interrupt sources. These are the following:
• Timer overflow
• Timer compare 1
• Timer compare 2
• Overflow-count overflow
• Overflow-count compare 1
• Overflow-count compare 2
SWRU191F – April 2009 – Revised April 2014 Timer 2 (MAC Timer) 199
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Event Outputs (DMA Trigger and Radio Events) www.ti.com
22.4.1 General
The timer can be started and stopped synchronously with the 32-kHz clock rising edge. Note that this
event is derived from a 32-kHz clock signal, but is synchronous with the 32-MHz system clock and thus
has a period approximately equal to that of the 32-kHz clock period. Synchronous starting and stopping
must not be attempted unless both the 32-kHz clock and 32-MHz XOSC are running and stable.
At the time of a synchronous start, the timer is reloaded with new calculated values for the timer and
overflow count such that it appears that the timer has not been stopped.
200 Timer 2 (MAC Timer) SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Timer Start-and-Stop Synchronization
SWRU191F – April 2009 – Revised April 2014 Timer 2 (MAC Timer) 201
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Timer 2 Registers www.ti.com
For a given Timer 2 period value, PT, there is a maximum duration between Timer 2 synchronous stop and
start for which the timer value is correctly updated after starting. The maximum value is given in terms of
the number of Sleep Timer clock periods, that is, 32-kHz clock periods, tST(max).
(224 - 1) ´ PT + TOH
t ST(max) £
K ck
202 Timer 2 (MAC Timer) SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Timer 2 Registers
Timer 2 has several multiplexed registers. This is to be able to fit all the registers into the limited SFR
address space. The internal registers listed in Table 22-1 can be accessed indirectly through T2M0, T2M1,
T2MOVF0, T2MOVF1, and T2MOVF2.
The registers listed in the remainder of this section are directly accessible in the SFR address space.
SWRU191F – April 2009 – Revised April 2014 Timer 2 (MAC Timer) 203
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Timer 2 Registers www.ti.com
204 Timer 2 (MAC Timer) SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Timer 2 Registers
T2IRQF (0xA1) – Timer 2 Interrupt Flags (CC2541 Only)
Bit Name Reset R/W Function
No.
7 TIMER2_LONG_COMPARE2F 0 R/W0 Set when the Timer 2 overflow counter is equal to t2ovf_cmp2 and the timer
counts to the value set at t2_cmp2
6 TIMER2_LONG_COMPARE1F 0 R/W0 Set when the Timer 2 overflow counter is equal to t2ovf_cmp1 and the timer
counts to the value set at t2_cmp1
5 TIMER2_OVF_COMPARE2F 0 R/W0 Set when the Timer 2 overflow counter counts to the value set at t2ovf_cmp2
4 TIMER2_OVF_COMPARE1F 0 R/W0 Set when the Timer 2 overflow counter counts to the value set at Timer 2
t2ovf_cmp1
3 TIMER2_OVF_PERF 0 R/W0 Set when the Timer 2 overflow counter would have counted to a value equal to
t2ovf_per, but instead wraps to 0
2 TIMER2_COMPARE2F 0 R/W0 Set when the Timer 2 counter counts to the value set at t2_cmp2
1 TIMER2_COMPARE1F 0 R/W0 Set when the Timer 2 counter counts to the value set at t2_cmp1
0 TIMER2_PERF 0 R/W0 Set when the Timer 2 counter would have counted to a value equal to t2_per,
but instead wraps to 0.
SWRU191F – April 2009 – Revised April 2014 Timer 2 (MAC Timer) 205
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Timer 2 Registers www.ti.com
206 Timer 2 (MAC Timer) SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Timer 2 Registers
T2EVTCFG (0x9C) – Timer 2 Event Configuration (CC2541)
Bit Name Reset R/W Function
No.
7:4 TIMER2_EVENT2_CFG 0000 R/W Selects the event that triggers a T2_EVENT2 pulse
0000: t2_per_event
0001: t2_cmp1_event
0010: t2_cmp2_event
0011: t2ovf_per_event
0100: t2ovf_cmp1_event
0101: t2ovf_cmp2_event
0110: Reserved
0111: No event
1000: t2ovf_long_cmp1_event
1001: t2ovf_long_cmp2_event
1010–1110: Reserved
1111: No event
3:0 TIMER2_EVENT1_CFG 0000 R/W Selects the event that triggers a T2_EVENT1 pulse
0000: t2_per_event
0001: t2_cmp1_event
0010: t2_cmp2_event
0011: t2ovf_per_event
0100: t2ovf_cmp1_event
0101: t2ovf_cmp2_event
0110: Reserved
0111: No event
1000: t2ovf_long_cmp1_event
1001: t2ovf_long_cmp2_event
1010–1110: Reserved
1111: No event
SWRU191F – April 2009 – Revised April 2014 Timer 2 (MAC Timer) 207
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Chapter 23
SWRU191F – April 2009 – Revised April 2014
CC253x Radio
The RF Core controls the analog radio modules. In addition, it provides an interface between the MCU
and the radio which makes it possible to issue commands, read status, and automate and sequence radio
events.
23.1 RF Core
The RF Core controls the analog radio modules. In addition, it provides an interface between the MCU
and the radio which makes it possible to issue commands, read status, and automate and sequence radio
events.
The FSM submodule controls the RF transceiver state, the transmitter and receiver FIFOs, and most of
the dynamically controlled analog signals, such as power up and power down of analog modules. The
FSM is used to provide the correct sequencing of events (such as performing an FS calibration before
enabling the receiver/transmitter). Also, it provides step-by-step processing of incoming frames from the
demodulator: reading the frame length, counting the number of bytes received, checking the FCS, and
finally, optionally handling automatic transmission of ACK frames after successful frame reception. It
performs similar tasks in TX, including performing an optional CCA before transmission and automatically
going to RX after the end of transmission to receive an ACK frame. Finally, the FSM controls the transfer
of data between modulator or demodulator and the TXFIFO or RXFIFO in RAM.
The modulator transforms raw data into I/Q signals to the transmitter DAC. This is done in compliance
with the IEEE 802.15.4 standard.
The demodulator is responsible for retrieving the over-the-air data from the received signal.
The amplitude information from the demodulator is used by the automatic gain control (AGC). The AGC
adjusts the gain of the analog LNA so that the signal level within the receiver is approximately constant.
The frame filtering and source matching supports the FSM in the RF Core by performing all operations
needed in order to do frame filtering and source address matching, as defined by IEEE 802.15.4.
The frequency synthesizer (FS) generates the carrier wave for the RF signal.
The command strobe processor (CSP) processes all commands issued by the CPU. It also has a short
program memory of 24 bytes, making it possible to automate CSP algorithms.
The radio RAM holds a FIFO for transmit data (TXFIFO) and a FIFO for receive data (RXFIFO). Both
FIFOs are 128 bytes long. In addition, the RAM holds parameters for frame filtering and source matching,
and for which 128 bytes are reserved.
Timer 2 (MAC Timer) is used for timing of radio events and to capture time stamps of incoming packets.
This timer keeps counting even in power modes PM1 and PM2.
23.1.1 Interrupts
The radio is associated with two interrupt vectors on the CPU. These are the RFERR interrupt (interrupt
0) and the RF interrupt (interrupt 12) with the following functions.
• RFERR: Error situations in the radio are signaled using this interrupt.
• RF: Interrupts coming from normal operation are signaled using this interrupt.
The RF interrupt vector combines the interrupts in RFIF. Note that these RF interrupts are rising-edge
triggered. Thus, an interrupt is generated when, for example, the SFD status flag goes from 0 to 1. The
RFIF interrupt flags are described in Section 23.1.2.
The interrupt-enable bits in the mask registers are used to enable individual interrupt sources for the two
RF interrupts. Note that masking an interrupt source does not affect the updating of the status in the flag
registers.
Due to the use of individual interrupt masks in the RF Core, the interrupts coming from RF Core have two-
layered masking, and care must be taken when processing these interrupts. The procedure is described
as follows.
To clear an interrupt from the RF Core, one must clear two flags, both the flag set in RF Core and the one
set in S1CON or TCON (depending on which interrupt is triggered). If a flag is cleared in the RF Core and
there are other unmasked flags standing, another interrupt is generated.
23.3 DMA
It is possible to use direct memory access (DMA) to move data between memory and the radio. The DMA
controller is described in Chapter 8. See this section for a detailed description on how to set up and use
DMA transfers.
To support the DMA controller, there is one DMA trigger associated with the radio, the RADIO DMA trigger
(DMA trigger 19). The RADIO DMA trigger is activated by two events. The first event to cause a RADIO
DMA trigger is when the first data is present in the RXFIFO, that is, when the RXFIFO goes from the
empty state to a nonempty state. The second event that causes a RADIO DMA trigger is when data is
read from the RXFIFO (through RFD) and there is still more data available in the RXFIFO.
23.4.1 RXFIFO
The RXFIFO memory area is located at addresses 0x6000 to 0x607F and is thus 128 bytes. Although this
memory area is intended for the RXFIFO, it is not protected in any way, so it is still accessible in the
XREG memory space. Normally, only the designated instructions should be used to manipulate the
contents of the RXFIFO. The RXFIFO can contain more than one frame at a time.
23.4.2 TXFIFO
The TXFIFO memory area is located at addresses 0x6080 to 0x60FF and is thus 128 bytes. Although this
memory area is intended for the TXFIFO, it is not protected in any way, so it is still accessible in the
XREG memory space. Normally, only the designated instructions should be used to manipulate the
contents of the TXFIFO. The TXFIFO can only contain one frame at a time.
Table 23-1. Frame Filtering and Source Matching Memory Map (continued)
ADDRESS REGISTER/VARIABLE ENDIAN DESCRIPTION
24-bit mask that indicates source address match for each individual
0x6162 SRCRESMASK2
entry in the source address table
Short address matching. When there is a match on entry panid_n +
0x6161 SRCRESMASK1 short_n, bit n is set in SRCRESMASK.
Extended address matching. When there is a match on entry ext_n,
0x6160 SRCRESMASK0 bits 2n and 2n + 1 are set in SRCRESMASK.
SOURCE ADDRESS TABLE
0x615E–0x615F short_23 LE
0x615C–0x615D panid_23 LE Two individual short-address entries (combination of 16-bit PAN ID
ext_11 LE
0x615A–0x615B short_22 LE and 16-bit short address) or one extended address entry
0x6158–0x6159 panid_22 LE
... ... ... ... ... ...
0x610E–0x610F short_03 LE
0x610C–0x610D panid_03 LE Two individual short address entries (combination of 16-bit PAN ID
ext_01 LE
0x610A–0x610B short_02 LE and 16-bit short address) or one extended address entry
0x6108–0x6109 panid_02 LE
0x6106–0x6107 short_01 LE
0x6104–0x6105 panid_01 LE Two individual short address entries (combination of 16-bit PAN ID
ext_00 LE
0x6102–0x6103 short_00 LE and 16-bit short address) or one extended address entry
0x6100–0x6101 panid_00 LE
I
Transmitted Bit-to- Symbol- Modulated
Bit-Stream
O-QPSK Signal
(LSB First) Symbol to-Chip Modulator ( to DACs)
Q
1 Mchips/s
B0306-01
The modulation format is offset – quadrature phase shift keying (O-QPSK) with half-sine chip shaping.
This is equivalent to MSK modulation. Each chip is shaped as a half-sine, transmitted alternately in the I
and Q channels with one-half chip-period offset. This is illustrated for the zero-symbol in Figure 23-2.
tC
I-Phase 1 0 1 0 1 0 0 1 0 0 0 1 0 1 1 1
Q-Phase 1 1 0 1 1 0 0 1 1 1 0 0 0 0 1 0
2tC
M0107-01
Figure 23-2. I/Q Phases When Transmitting a Zero-Symbol Chip Sequence, tC = 0.5 μs
Bytes: 4 1 1 5 + (0 to 20) + n
Start-of-Frame MAC Protocol
PHY Preamble Frame
Delimiter Data Unit
Layer Sequence Length
(SFD) (MPDU)
Synchronization Header PHY Header PHY Service Data Unit
(SHR) (PHR) (PSDU)
11 + (0 to 20) + n
M0108-01
Figure 23-3. Schematic View of the IEEE 802.15.4 Frame Format [1]
Frame-Check Sequence
A 2-byte frame-check sequence (FCS) follows the last MAC payload byte as shown in Figure 23-3. The
FCS is calculated over the MPDU, that is, the frame-length field is not part of the FCS.
The FCS polynomial defined in [1] is
G(s) = x16 + x12 + x5 + 1
The radio supports automatic calculation and verification of the FCS. See Section 23.8.10 for details.
23.8.1 TX Control
The radio has many built-in features for frame processing and status reporting. Note that the radio
provides features that make it easy to have precise control of the timing of outgoing frames. This is very
important in an IEEE 802.15.4/ZigBee® system, because there are strict timing requirements to such
systems.
Frame transmission is started by the following actions:
• The STXON command strobe
– The SAMPLED_CCA signal is not updated.
• The STXONCCA command strobe, provided that the CCA signal is high.
– Aborts ongoing transmission or reception and forces a TX calibration followed by transmission.
– The SAMPLED_CCA signal is updated.
Clear-channel assessment is described in detail in Section 23.8.12.
Frame transmission is aborted by the following command actions:
• The SRXON command strobe
– Aborts ongoing transmission and forces an RX calibration
• The SRFOFF command strobe
– Aborts ongoing transmission or reception and forces the FSM to the IDLE state
• The STXON command strobe
– Aborts ongoing transmission and forces an RX calibration
To enable the receiver after transmission with STXON, the FRMCTRL1.SET_RXENMASK_ON_TX bit should
be set. This sets bit 6 in RXENABLE when STXON is executed. When transmitting with STXONCCA, the
receiver is on before the transmission and is turned back on afterwards (unless the RXENABLE registers
have been cleared in the meantime).
Figure 23-5 illustrates what must be written to the TXFIFO (marked blue). Additional bytes are ignored,
unless TX overflow occurs (see the error conditions listed in Section 23.8.5).
FCS –
AUTOCRC = 0 LEN LEN –2 Bytes (Ignored)
(2 Bytes)
–
AUTOCRC = 1 LEN LEN –2 Bytes (Ignored)
M0109-01
23.8.4 Retransmission
In order to support simple retransmission of frames, the radio does not delete the TXFIFO contents as
they are transmitted. After a frame has been successfully transmitted, the FIFO contents are left
unchanged. To retransmit the same frame, simply restart TX by issuing an STXON or STXONCCA
command strobe. Note that a retransmission of a packet is only possible if the packet has been completely
transmitted; that is, a packet cannot be aborted and then be retransmitted.
If a different frame is to be transmitted, issue an ISFLUSHTX strobe and then write the new frame to the
TXFIFO.
SSAMPLECCA
Yes No
(SAMPLED_CCA = 1) TX started? (SAMPLED_CCA = 0)
TX buffer overfilled
TX is aborted by
TX completes? No Why? SRXON,
STXON or SRFOFF
Yes
TIME
ignored because the
TX buffer is corrupted.)
Between two transmissions, there can be multiple other activities such as frame reception, RX FIFO access, and acknowledgment transmission (using SACK,
SACKPEND, or AUTOACK), or idle periods (random backoffs). This has no side effects on the state of the TX buffer.
The placement of the SFLUSHTX strobe in the diagram shows the latest point in time where this strobe can be executed. If fewer special cases is desired, it is
always possible to use the SFLUSHTX strobe and then load or reload TXBUF with the next frame to be transmitted.
F0035-01
(1) Generation and automatic transmission of the PHY layer synchronization header, which consists of the
preamble and the SFD
(2) Transmission of the number of bytes specified by the frame-length field
(3) Calculation of and automatic transmission of the FCS (can be disabled)
Figure 23-7. Single Transmitted Frame
The recommended usage is to write the frame-length field followed by the MAC header and MAC payload
to the TXFIFO and let the radio handle the rest. Note that the frame-length field must include the two FCS
bytes, even though the radio adds these automatically.
Synchronization Header
Preamble SFD
1 Symbol 1 Byte
IEEE 802.15.4 0 0 0 0 0 0 0 0 7 A
The radio has programmable preamble length. The default value is compliant with [1], and changing the
value makes the system noncompliant to IEEE 802.15.4.
The preamble sequence length is set by MDMCTRL0.PREAMBLE_LENGTH. Figure 23-8 shows how the
synchronization header relates to the IEEE 802.15.4 specification.
When the required number of preamble bytes has been transmitted, the radio automatically transmits the
1-byte SFD. The SFD is fixed, and it is not possible to change this value from software.
Data Input
(LSB First) + + +
23.8.11 Interrupts
The SFD interrupt is raised when the SFD field of the frame has been transmitted. At the end of the frame,
the TX_FRM_DONE interrupt is raised when the complete frame has been successfully transmitted.
Note that there is a second SFD signal available on GPIO (through radio observation mux) that should not
be confused with the SFD interrupt.
23.9.1 RX Control
The receiver is turned on and off with the SRXON and SRFOFF command strobes, and with the
RXENABLE registers. The command strobes provide a hard on-off mechanism, whereas RXENABLE
manipulation provides a soft on-off mechanism.
The receiver is turned on by the following actions:
• The SRXON strobe:
– Sets RXENABLE[7]
– Aborts ongoing transmission or reception by forcing a transition to RX calibration.
• The STXON strobe, when FRMCTRL1.SET_RXENMASK_ON_TX is enabled:
– Sets RXENABLE[6]
– The receiver is enabled after transmission completes.
• Setting RXENABLE != 0x00 by writing to RXENMASKOR:
– Does not abort ongoing transmission or reception.
The receiver is turned off by the following actions:
• The SRFOFF strobe:
– Clears RXENABLE[7:0]
– Aborts ongoing transmission or reception by forcing the transition to IDLE mode.
• Setting RXENABLE = 0x00 by writing to RXENMASKAND
– Does not abort ongoing transmission or reception. Once the ongoing transmission or reception is
finished, the radio returns to the IDLE state.
There are several ways to manipulate the RXENABLE registers:
• The SRXMASKBITSET and SRXMASKBITCLR strobes (affecting RXENABLE[5])
• The SRXON, SRFOFF and STXON strobes, including the FRMCTRL1.SET_RXMASK_ON_TX setting
(1) Detection and removal of the received PHY synchronization header (preamble and SFD), and reception of
the number of bytes specified by the frame-length field.
(2) Frame filtering as specified by [1], section 7.5.6.2, third filtering level.
(3) Matching of the source address against a table containing up to 24 short addresses or 12 extended IEEE
addresses. The source address table is stored in the radio RAM.
(4) Automatic FCS checking, and attaching this result and other status values (RSSI, correlation, and source-
match result) to received frames.
(5) Automatic acknowledgment transmission with correct timing, and correct setting of the frame-pending bit,
based on the results from source address matching and FCS checking.
Figure 23-10. Single Received Frame and Transmitted Acknowledgment Frame
Frame Rejected
T0319-01
– If a destination PAN ID is included in the frame, it must match PAN_ID or must be the broadcast
PAN identifier (0xFFFF).
– If a short destination address is included in the frame, it must match either SHORT_ADDR or the
broadcast address (0xFFFF).
– If an extended destination address is included in the frame, it must match EXT_ADDR.
• Frame type:
– Beacon frames (0) are only accepted when:
• FRMFILT1.ACCEPT_FT0_BEACON = 1
• Length byte ≥ 9
• The destination address mode is 0 (no destination address).
• The source address mode is 2 or 3 (that is, a source address is included).
• The source PAN ID matches PAN_ID, or PAN_ID equals 0xFFFF.
– Data (1) frames are only accepted when:
• FRMFILT1.ACCEPT_FT1_DATA = 1
• Length byte ≥ 9
• A destination address and/or source address is included in the frame. If no destination address
is included in the frame, the FRMFILT0.PAN_COORDINATOR bit must be set, and the source
PAN ID must equal PAN_ID.
– Acknowledgment (2) frames are only accepted when:
• FRMFILT1.ACCEPT_FT2_ACK = 1
• Length byte = 5
– MAC command (3) frames are only accepted when:
• FRMFILT1.ACCEPT_FT3_MAC_CMD = 1
•Length byte ≥ 9
•A destination address and/or source address is included in the frame. If no destination address
is included in the frame, the FRMFILT0.PAN_COORDINATOR bit must be set, and the source
PAN ID must equal PAN_ID for the frame to be accepted.
– Reserved frame types (4, 5, 6, and 7) are only accepted when
• FRMFILT1.ACCEPT_FT4TO7_RESERVED = 1 (default is 0)
• Length byte ≥ 9
The following operations are performed before the filtering begins, with no effect on the frame data stored
in the RXFIFO:
• Bit 7 of the length byte is masked out (don't care).
• If FRMFILT1.MODIFY_FT_FILTER is not equal to zero, the MSB of the frame-type subfield of the FCF
is either inverted or forced to 0 or 1.
If a frame is rejected, the radio only starts searching for a new frame after the rejected frame has been
completely received (as defined by the frame-length field) to avoid detecting false SFDs within the frame.
Note that a rejected frame can generate RX overflow if it occurs before the frame is rejected.
Interrupts
When frame filtering is enabled and the filtering algorithm accepts a received frame, an
RX_FRM_ACCEPTED interrupt is generated. It is not generated if frame filtering is disabled or
RX_OVERFLOW or RX_FRM_ABORTED is generated before the filtering result is known.
Figure 23-12 illustrates the three different scenarios (not including the overflow and abort-error conditions).
Filtering is Disabled
SFD RX_FRM_DONE
Interrupt Interrupt
M0112-01
The FSMSTAT1.SFD register bit goes high when a start-of-frame delimiter is completely received and
remains high until either the last byte in MPDU is received or the received frame has failed to pass
address recognition and been rejected.
Tips and Tricks
The following register settings must be configured correctly:
• FRMFILT0.PAN_COORDINATOR must be set if the device is a PAN coordinator, and cleared if not.
• FRMFILT0.MAX_FRAME_VERSION must correspond to the supported version(s) of the IEEE 802.15.4
standard.
• The local address information must be loaded into RAM.
To avoid completely the receiving of frames during energy-detection scanning, set FRMCTRL0.RX_MODE =
11b and then (re)start RX. This disables symbol search and thereby prevents SFD detection.
To resume normal RX mode, set FRMCTRL0.RX_MODE = 00b and (re)start RX.
During operation in a busy IEEE 802.15.4 environment, the radio receives large numbers of nonintended
acknowledgment frames. To block reception of these frames effectively, use the
FRMFILT1.ACCEPT_FT2_ACK bit to control when acknowledgment frames should be received:
• Set FRMFILT1.ACCEPT_FT2_ACK after successfully starting a transmission with acknowledgment
request, and clear the bit again after the acknowledgment frame has been received or the time-out has
been reached.
226 CC253x Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Receive Mode
• Short address entries are enabled in the SRCSHORTEN0, SRCSHORTEN1, and SRCSHORTEN2 registers.
Register bit n corresponds to short address entry n.
• Extended address entries are enabled in the SRCEXTEN0, SRCEXTEN1, and SRCEXTEN2 registers. In
this case, register bit 2n corresponds to extended address entry n. This mapping is convenient when
creating a combined bit vector (of short and extended enable bits) to find unused entries. Moreover,
when read, register bit 2n + 1 always has the same value as register bit 2n, because an extended
address occupies the same memory as two short-address entries.
Matching Algorithm
The SRCMATCH.SRC_MATCH_EN bit controls whether source address matching is enabled or not. When
enabled (which is the default setting) and a frame passes the filtering algorithm, the radio applies one of
the algorithms outlined in Figure 23-13, depending on which type of source address is present.
The result is reported in two different forms:
• A 24-bit vector called SRCRESMASK contains a 1 for each enabled short entry with a match, or two
1s for each enabled extended entry with a match (the bit mapping is the same as for the address-
enable registers on read access).
• A 7-bit value called SRCRESINDEX:
– When no source address is present in the received frame, or there is no match on the received
source address:
• Bits 6:0: 011 1111
– If there is a match on the received source address:
• Bits 4:0: The index of the first entry (that is, the one with the lowest index number) with a match,
0–23 for short addresses or 0–11 for extended addresses.
• Bit 5: 0 if the match is on a short address, 1 if the match is on an extended address
• Bit 6: The result of the AUTOPEND function
SRCRESMASK and SRCRESINDEX are written to RF Core memory as soon as the result is available.
SRCRESINDEX is also appended to received frames if the FRMCTRL0.AUTOCRC and
FRMCTRL0.APPEND_DATA_MODE bits have been set. The value then replaces the 7-bit correlation value
of the 16-bit status word.
Interrupts
When source address matching is enabled and the matching algorithm completes, the
SRC_MATCH_DONE interrupt flag is set, regardless of the result. If a match is found, the
SRC_MATCH_FOUND flag is also set immediately before SRC_MATCH_DONE.
Figure 23-14 illustrates the timing of the setting of flags:
----- Last
SFD LEN FCF + SEQ + Destination Byte
SRC_MATCH_DONE
Interrupt
SRC_MATCH_FOUND interrupt
may occur during this interval
SRC_MATCH_DONE interrupt
occurs during this interval
AUTOCRC = 1 and 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
CRC Correlation Value (Unsigned)
APPEND_DATA_MODE = 0 RSSI (Signed 2s Complement)
OK
AUTOCRC = 1 and 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
RSSI (Signed 2s Complement) CRC
APPEND_DATA_MODE = 1 SRCRESINDEX
OK
M0114-01
Field Descriptions:
• The RSSI value is measured over the first eight symbols following the SFD.
• The CRC_OK bit indicates whether the FCS is correct (1) or incorrect (0). When incorrect, software is
responsible for discarding the frame.
• The correlation value is the average correlation value over the first eight symbols following the SFD.
• SRCRESINDEX is the same value that is written to RAM after completion of source address matching.
Calculation of the LQI value used by IEEE 802.15.4 is described in Section 23.10.4.
There are three different sources for setting the pending bit in an ACK frame (that is, the SACKPEND
strobe, the PENDING_OR register bit, and the AUTOPEND feature). The pending bit is set if one or more
of these sources are set.
Transmission Timing
Acknowledgment frames can only be transmitted immediately after frame reception. The transmission
timing is controlled by the FSMCTRL.SLOTTED_ACK bit.
12 Symbol Periods = 192 ms
Unslotted ACK (0) Preamble SFD RX Frame Preamble SFD ACK Frame
Slotted ACK (1) Preamble SFD RX Frame Preamble SFD ACK Frame
The IEEE 802.15.4 requires unslotted mode in nonbeacon-enabled PANs, and slotted mode for beacon-
enabled PANs.
Manual Control
The SACK, SACKPEND, and SNACK command strobes can only be issued during frame reception. If the
strobes are issued at any other time, they have no effect but generating a STROBE_ERROR interrupt.
The command strobes may be issued several times during reception; however, only the last strobe has an
effect:
• No strobe, or SNACK, or incorrect FCS: No acknowledgment transmission
• SACK: Acknowledgment transmission with the frame-pending bit cleared
• SACKPEND: Acknowledgment transmission with the frame-pending bit set
Automatic Control (AUTOACK)
When FRMFILT0.FRM_FILTER_EN and FRMCTRL0.AUTOACK are both enabled, the radio determines
automatically whether or not to transmit acknowledgment frames:
• The RX frame must be accepted by frame filtering (indicated by the RX_FRM_ACCEPTED exception).
• The acknowledgment request bit must be set in the RX frame.
• The RX frame must not be a beacon or an acknowledgment frame.
• The FCS of the RX frame must be correct.
Automatic acknowledgments can be overridden by the SACK, SACKPEND, and SNACK command
strobes. For instance, if the microcontroller is low on memory resources and cannot store a received
frame, the SNACK strobe can be issued during reception and prevent acknowledging the discarded frame.
By default, the AUTOACK feature never sets the frame-pending bit in the acknowledgment frames. Apart
from manual override with command strobes, there are two options:
• Automatic control, using the AUTOPEND feature
• Manual control, using the FRMCTRL1.PENDING_OR bit
FSMSTAT1:SFD
Accepted Frame
FSMSTAT1:FIFO
FSMSTAT1:FIFOP
(Low Threshold)
FSMSTAT1:FIFOP
(High Threshold)
FSMSTAT1:SFD
Rejected Frame
FSMSTAT1:FIFO
FSMSTAT1:FIFOP
When using the FIFOP as an interrupt source for the microcontroller, the FIFOP threshold should be
adjusted by the interrupt service routine to prepare for the next interrupt. When preparing for the last
interrupt for a frame, the threshold should match the number of bytes remaining.
23.10.3 RSSI
The radio has a built-in received signal-strength indication (RSSI), which calculates an 8-bit signed digital
value that can be read from a register or automatically appended to received frames. The RSSI value is
the result of averaging the received power over eight symbol periods (128 μs) as specified by IEEE
802.15.4 [1].
The RSSI value is a 2s-complement signed number on a logarithmic scale with 1-dB steps.
The status bit RSSI_VALID should be checked before reading the RSSI value register. RSSI_VALID
indicates that the RSSI value in the register is in fact valid, which means that the receiver has been
enabled for at least eight symbol periods.
To find the actual signal power P at the RF pins with reasonable accuracy, an offset must be added to the
RSSI value.
P = RSSI – OFFSET [dBm]
For example, with an offset of 73 dB, reading an RSSI value of –10 from the RSSI register means that the
RF input power is approximately –83 dBm. For the correct offset value to use, see the data sheet
(Appendix C).
There are two ways the radio can update the RSSI register after it has first become valid. If
FRMCTRL0.ENERGY_SCAN = 0 (default), the RSSI register contains the latest value available, but if this bit
is set to 1, a peak search is performed, and the RSSI register contains the largest value since the energy
scan was enabled.
RX TX
Timeout
RX TX shutdown
Overflow rxenmask! = 0
RX overflow
17
Slotted ACK
Unslotted ACK SRFOFF or
r xenable = 0 SRXON
ACK all TX
ACK delay ACK and
calibration ACK
55 49–54
48 Timeout states
Timeout x ms
(depending on length byte 192 ms
of the received frame)
CC253x Radio
F0036-01
Radio-Control State Machine
235
Random-Number Generation www.ti.com
Table 23-3 shows the mapping from FSM state to the number which can be read from the FSMSTAT0
register. Note that although it is possible to read the state of the FSM, this information should not be used
to control the program flow in the application software. The states may change very quickly (every 32-MHz
clock cycle), and an 8-MHz SPI is not able to capture all the activities.
645
PSD – Power Spectral Density – Power/Bin
–10
640
–20
635
–30
630
Count
–40 625
620
–50
615
–60
610
–70
605
–80 600
–3 –2 –1 0 1 2 3 0 50 100 150 200 250
f – Frequency – rad Bin Number
G001 G002
Figure 23-21. FFT of the Random Bytes Figure 23-22. Histogram of 20 Million Bytes Generated
With the RANDOM Instruction
For the first 20 million individual bits, the probability of a one is P(1) = 0.500602 and P(0) = 1 – P(1) =
0.499398.
Note that to fully qualify the random generator as true random, much more elaborate tests are required.
There are software packages available on the internet that may be useful in this respect.
Step3: For packet sniffing, the packet sniffer module must be enabled in the MDMTEST1 register.
NOTE: If the CSPT register compare function is not used, this register must be set to 0xFF before
the program execution is started.
Write instruction to
RFST
No All instructions
written?
Yes
SSTOP instruction,
end of program, or
writing ISTOP to
RFST stops program
Rerun last
No program? Yes
F0037-01
23.14.7 Registers
23.14.9.1 DECZ
Function: Decrement Z
Description: The Z register is decremented by 1. An original value of 0x00 underflows to 0xFF.
Operation: Z=Z–1
Opcode: 0xC5
7 6 5 4 3 2 1 0
1 1 0 0 0 1 0 1
23.14.9.2 DECY
Function: Decrement Y
Description: The Y register is decremented by 1. An original value of 0x00 underflows to 0xFF.
Operation: Y=Y–1
Opcode: 0xC4
7 6 5 4 3 2 1 0
1 1 0 0 0 1 0 0
23.14.9.3 DECX
Function: Decrement X
Description: The X register is decremented by 1. An original value of 0x00 underflows to 0xFF.
Operation: X=X–1
Opcode: 0xC3
7 6 5 4 3 2 1 0
1 1 0 0 0 0 1 1
23.14.9.4 INCZ
Function: Increment Z
Description: The X register is incremented by 1. An original value of 0xFF overflows to 0x00.
Operation: Z=Z+1
Opcode: 0xC2
7 6 5 4 3 2 1 0
1 1 0 0 0 0 1 0
23.14.9.5 INCY
Function: Increment Y
Description: The Y register is incremented by 1. An original value of 0xFF overflows to 0x00.
Operation: Y=Y+1
Opcode: 0xC1
7 6 5 4 3 2 1 0
1 1 0 0 0 0 0 1
23.14.9.6 INCX
Function: Increment X
Description: The X register is incremented by 1. An original value of 0xFF overflows to 0x00.
Operation: X=X+1
Opcode: 0xC0
7 6 5 4 3 2 1 0
1 1 0 0 0 0 0 0
23.14.9.7 INCMAXY
23.14.9.8 RANDXY
Opcode: 0xBD
7 6 5 4 3 2 1 0
1 0 1 1 1 1 0 1
23.14.9.9 INT
Function: Interrupt
Description: The interrupt IRQ_CSP_INT is asserted when this instruction is executed.
Operation: IRQ_CSP_INT = 1
Opcode: 0xBA
7 6 5 4 3 2 1 0
1 0 1 1 1 0 1 0
23.14.9.10 WAITX
Opcode: 0xBC
7 6 5 4 3 2 1 0
1 0 1 1 1 1 0 0
23.14.9.11 SETCMP1
Function: Set the compare value of the MAC Timer to the current timer value.
Description: Set the compare value of the MAC Timer to the current timer value.
Operation: Csp_mact_setcmp1 = 1
Opcode: 0xBE
7 6 5 4 3 2 1 0
1 0 1 1 1 1 1 0
23.14.9.12 WAIT W
23.14.9.13 WEVENT1
Opcode: 0xB8
7 6 5 4 3 2 1 0
1 0 1 1 1 0 0 0
23.14.9.14 WEVENT2
Opcode: 0xB9
7 6 5 4 3 2 1 0
1 0 1 1 1 0 0 1
23.14.9.15 LABEL
Opcode: 0xBB
7 6 5 4 3 2 1 0
1 0 1 1 1 0 1 1
23.14.9.16 RPT C
23.14.9.17 SKIP S, C
Opcode: 0x00 | S | N | C
7 6 5 4 3 2 1 0
0 S N C
23.14.9.18 STOP
Opcode: 0xD2
7 6 5 4 3 2 1 0
1 1 0 1 0 0 1 0
23.14.9.19 SNOP
Function: No operation
Description: Operation continues at the next instruction.
Operation: PC = PC + 1
Opcode: 0xD0
7 6 5 4 3 2 1 0
1 1 0 1 0 0 0 0
23.14.9.20 SRXON
23.14.9.21 STXON
Opcode: 0xD9
7 6 5 4 3 2 1 0
1 1 0 1 1 0 0 1
23.14.9.22 STXONCCA
Opcode: 0xDA
7 6 5 4 3 2 1 0
1 1 0 1 1 0 1 0
23.14.9.23 SSAMPLECCA
Opcode: 0xDB
7 6 5 4 3 2 1 0
1 1 0 1 1 0 1 1
23.14.9.24 SRFOFF
Opcode: 0xDF
7 6 5 4 3 2 1 0
1 1 0 1 1 1 1 1
23.14.9.25 SFLUSHRX
Opcode: 0xDD
7 6 5 4 3 2 1 0
1 1 0 1 1 1 0 1
23.14.9.26 SFLUSHTX
Opcode: 0xDE
7 6 5 4 3 2 1 0
1 1 0 1 1 1 1 0
23.14.9.27 SACK
Opcode: 0xD6
7 6 5 4 3 2 1 0
1 1 0 1 0 1 1 0
23.14.9.28 SACKPEND
Opcode: 0xD7
7 6 5 4 3 2 1 0
1 1 0 1 0 1 1 1
23.14.9.29 SNACK
Opcode: 0xD8
7 6 5 4 3 2 1 0
1 1 0 1 1 0 0 0
23.14.9.30 SRXMASKBITSET
Opcode: 0xD4
7 6 5 4 3 2 1 0
1 1 0 1 0 1 0 0
23.14.9.31 SRXMASKBITCLR
Opcode: 0xD5
7 6 5 4 3 2 1 0
1 1 0 1 0 1 0 1
23.14.9.32 ISSTOP
Opcode: 0xE2
7 6 5 4 3 2 1 0
1 1 1 0 0 0 1 0
23.14.9.33 ISSTART
Opcode: 0xE1
7 6 5 4 3 2 1 0
1 1 1 0 0 0 0 1
23.14.9.34 ISRXON
Opcode: 0xE3
7 6 5 4 3 2 1 0
1 1 1 0 0 0 1 1
23.14.9.35 ISRXMASKBITSET
Opcode: 0xE4
7 6 5 4 3 2 1 0
1 1 1 0 0 1 0 0
23.14.9.36 ISRXMASKBITCLR
Opcode: 0xE5
7 6 5 4 3 2 1 0
1 1 1 0 0 1 0 1
23.14.9.37 ISTXON
23.14.9.38 ISTXONCCA
Opcode: 0xEA
7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 0
23.14.9.39 ISSAMPLECCA
Opcode: 0xEB
7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 1
23.14.9.40 ISRFOFF
Opcode: 0xEF
7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1
23.14.9.41 ISFLUSHRX
Opcode: 0xED
7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 1
23.14.9.42 ISFLUSHTX
Opcode: 0xEE
7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0
23.14.9.43 ISACK
Opcode: 0xE6
7 6 5 4 3 2 1 0
1 1 1 0 0 1 1 0
23.14.9.44 ISACKPEND
Opcode: 0xE7
7 6 5 4 3 2 1 0
1 1 1 0 0 1 1 1
23.14.9.45 ISNACK
Opcode: 0xE8
7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 0
23.14.9.46 ISCLEAR
Opcode: 0xFF
7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1
23.15 Registers
Table 23-6. Registers That Require Update From Their Default Value
Register Name New Value (Hex) Description
AGCCTRL1 0x15 Adjusts AGC target value
TXFILTCFG 0x09 Sets TX anti-aliasing filter to appropriate bandwidth
FSCAL1 0x00 Recommended setting for lowest spurious emission
read_data
AGC 0
Module
B0308-01
Figure 23-24. Example Hardware Structure for the R* Register Access Mode
The CC2540 and CC2541 provide a Bluetooth low energy compliant radio transceiver. On the CC2540
and CC2541, radio operation is controlled by the Bluetooth low energy stack. The application is not
allowed to access the radio directly. The application interacts with the radio by sending API commands to
the stack. The TI BLE stack with documentation is available at www.ti.com/blestack. The CC2541 may
also be run in proprietary mode; see Chapter 25 for a description of the operation in that case.
SWRU191F – April 2009 – Revised April 2014 CC2540 and CC2541 Bluetooth low energy Radio 275
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Registers www.ti.com
24.1 Registers
The following status registers are available to the user:
276 CC2540 and CC2541 Bluetooth low energy Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Registers
RFC_OBS_CTRL2 (0x61B0) RF Observation Mux Control 2
Bit Name Reset R/W Description
7 – 0 R0 Reserved. Read as 0
6 RFC_OBS_POL2 0 R/W The signal chosen by RFC_OBS_MUX2 is XORed with this bit.
5:0 RFC_OBS_MUX2 00 0000 R/W Controls which observable signal from rf_core is to be muxed out to
rfc_obs_sigs(2).
00 0000: 0 – Constant value
00 0001: 1 – Constant value
00 1001: TX active
00 1010: RX_active
11 0000: High from when receiver has found access address until packet is
finished, low otherwise
11 0001: High from when the access address has been transmitted until end of
packet, low otherwise
Other values reserved
SWRU191F – April 2009 – Revised April 2014 CC2540 and CC2541 Bluetooth low energy Radio 277
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Chapter 25
SWRU191F – April 2009 – Revised April 2014
In proprietary mode, the CC2541 radio supports data rates up to 2 Mbps, and has extensive baseband
automation, including auto-acknowledgment and address decoding. The RF Core controls the analog
radio module and the RF transceiver state. In addition, it provides an interface between the MCU and the
radio which makes it possible to issue commands, read status, and automate and sequence radio events.
It has 1 KB of dedicated RAM, which holds the 128-byte transmit and receive FIFO.
This chapter describes the proprietary mode operation of the CC2541 devices and features in the LLE
program. For Bluetooth low energy operation, see Chapter 24.
278 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com RF Core
25.1 RF Core
The RF core contains several submodules that support and control the analog radio modules. In addition,
it provides an interface between the MCU and the radio which makes it possible to issue commands, read
status, and automate and sequence radio events.
The link-layer engine (LLE) controls the RF transceiver state and most of the dynamically controlled
analog signals such as power up and power down of analog modules. The LLE is used to provide the
correct sequencing of events (such as performing an FS calibration before enabling the receiver). It
handles packet assembly and decoding, including automatic length field handling, address insertion and
filtering, and CRC generation and checking.
The radio data RAM holds a FIFO for transmit data (TX FIFO) and a FIFO for receive data (RX FIFO).
Both FIFOs are 128 bytes long and have hardware control of pointers when data is entered and removed
from the FIFOs. In addition, the RAM contains six segments of 128 bytes, one of which is used for
communication with the LLE.
The bit-stream processor is used for whitening and de-whitening transferred signals and CRC
generation and check.
The modulator transforms raw data into I/Q signals to the transmitter DAC.
The demodulator is responsible for retrieving the over-the-air data from the received signal.
The frequency synthesizer (FS) generates the carrier wave for the RF signal.
25.2 Interrupts
The radio is associated with two interrupt vectors on the CPU. These are the RFERR interrupt (interrupt
0) and the RF interrupt (interrupt 12) with the following functions.
• RFERR: Error situations in the radio are signaled using this interrupt.
• RF: Interrupts coming from normal operation are signaled using this interrupt.
The RF interrupt vector combines the interrupts in RFIF. Note that these RF interrupts are rising-edge
triggered. Thus, an interrupt is generated when, for example, the TASKDONE status flag in the RFIRQF1
register goes from 0 to 1. The RFIF interrupt flags are described in Section 25.2.1.
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 279
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
RF Core Data Memory www.ti.com
To clear an interrupt from the RF core, one must clear two flags, both the flag set in the RF core and the
one set in the main interrupt flag SFR registers, S1CON or TCON (depending on which interrupt is
triggered). If a flag is cleared in the RF core and there are other unmasked flags standing, the main
interrupt flag is set. Exiting the interrupt service routine with the main interrupt flag set causes the interrupt
service routine to be executed again.
TIP: For proper handling of interrupts in ISRs, the following is advised:
• At the start of the ISR, read and store the RF core flags
• Process the interrupts
• Clear the main interrupt flag
• Clear the processed RF core flags. It is important that this is done in a single operation.
The active memory page is selected in register RFRAMCFG.PRE. The selected page is accessible at
XDATA addresses 0x6000–0x607F. The RX FIFO page (page 6) is also accessible at XDATA addresses
0x6080–0x60FF. The TX FIFO page (page 7) is also accessible at XDATA addresses 0x6100–0x617F.
A page is used for transferring parameters to the LLE; see Section 25.3.3.
There is no hardware protection to prevent the MCU from overwriting memory used by the LLE and the
FIFO. Thus, the MCU should never write to page 5 (except for special dedicated registers). The MCU
should write to pages 0, 1, 2, 3, and 7 only as specified in this chapter. Writes to the FIFO pages should
only be done in ways compatible with FIFO operation, except for accessing the TX FIFO page while
running an RX task with auto ACK.
Pages 0, 1, 6, and 7 have retention in all power modes, whereas the contents of pages 2–5 are lost in
PM2 and PM3.
Radio core hardware registers are located at XDATA addresses 0x6180–0x61F7. Figure 25-1 shows the
mapping of radio memory to MCU XDATA memory space.
280 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com RF Core Data Memory
0x61F7
Radio XREG
0x6180
Page7 0x617F
Page 6 Tx FIFO
Page 5 0x6100
. 0x60FF
.
Page 4 .
Rx FIFO
Page 3
0x6080
Page 2 . 0x607F
.
Page 1 . Radio RAM
Page 0 0x6000
M0219-01
25.3.1 FIFOs
The FIFOs are used for transporting data between the MCU and the radio. The FIFOs have hardware
support for read and write pointer increment with circular buffering, overflow and underflow detection, and
flushing of last entry or the entire FIFO.
The RX and TX FIFOs are fundamentally two similar modules. Each FIFO has four pointers: the write
pointer (WP), the read pointer (RP), the start-of-packet write pointer (SWP), and the start-of-packet read
pointer (SRP). WP and RP give the index in the FIFO where the next byte is to be written and read,
respectively. SWP is used to indicate the start of the current packet being written, and SRP is used to
indicate the start of the current packet being read. The use of the pointers is indicated in Figure 25-2.
127
Last Packet
SWP
Available Data
n -Packets
RP
First Packet
SRP
Free Space
WP
0
M0220-01
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 281
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
RF Core Data Memory www.ti.com
The TX FIFO and RX FIFO may be accessed though the SFR register RFD (0xD9). Data is written to the
TX FIFO when writing to the RFD register. Data is read from the RX FIFO when the RFD register is read.
In addition, there are separate read and write registers for each FIFO (RFRXFRD, RFRXFWR, RFTXFRD,
RFTXFWR).
The RX FIFO or TX FIFO can be cleared by issuing CMD_RXFIFO_RESET or CMD_TXFIFO_RESET
(see Section 25.3.1.2), respectively. The contents of both FIFOs can be cleared by issuing
CMD_FIFO_RESET.
Four operations are defined to handle the four pointers:
• Deallocate is setting SRP equal to RP. This should be done when the treatment of a packet that has
been read from the FIFO is finished.
• Retry is setting RP equal to SRP. This is done to re-read a packet that has been read from the FIFO
previously.
• Discard is setting WP equal to SWP. This is done to remove a packet that had been written to the
FIFO.
• Commit is setting SWP equal to WP. This is done to confirm the writing of a packet to the FIFO and
making it available to be read out.
Using the register RFFCFG, it is possible to set up auto-commit and auto-deallocate for each of the FIFOs.
If auto-commit is enabled, SWP is set equal to WP each time a byte is written to the FIFO. If auto-
deallocate is enabled, SRP is set equal to RP each time a byte is read from the FIFO. By default, auto-
commit is enabled for the TX FIFO and auto-deallocate is enabled for the RX FIFO. This is also the
recommended setting. However, if packets that exceed the FIFO size are to be supported, auto-commit
must be enabled for the RX FIFO and auto-deallocate for the TX FIFO; see Section 25.8.1 and
Section 25.8.2 for details. If auto-commit is disabled for the TX FIFO, the MCU must issue a commit
command after writing a packet to the TX FIFO, and if auto-deallocate is disabled for the RX FIFO, the
MCU must issue a deallocate command after reading a packet from the RX FIFO.
282 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com RF Core Data Memory
The supported FIFO commands are listed in Table 25-2. A command in the range of 0x80–0xFF that does
not match any of the listed commands is ignored.
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 283
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
RF Core Data Memory www.ti.com
25.3.2 DMA
It is possible to use direct memory access (DMA) to move data between memory and the radio. See
Chapter 8 for a detailed description on how to set up and use DMA transfers.
There are two DMA triggers associated with the radio: the RADIO DMA triggers 0 and 1 (DMA triggers 19
and 11).
The radio DMA trigger source is selected in registers RFFDMA0 and RFFDMA1. See the register
descriptions in Section 25.12 for details.
284 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com RF Core Data Memory
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 285
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
RF Core Data Memory www.ti.com
286 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com RF Core Data Memory
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 287
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
RF Core Data Memory www.ti.com
288 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com RF Core Data Memory
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 289
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
RF Core Data Memory www.ti.com
290 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com RF Core Data Memory
The parts of RAM page 5 that are not listed in Table 25-7 are reserved for use by the LLE and should not
be written by the MCU.
25.4.1 Whitening
The BSP supports two whiteners, a PN7 and a PN9 whitener. The register BSP_MODE is used to enable or
disable each whitener. When no whitener is enabled, it outputs zero. The whitener sequence is XORed
with the transmitted or received signal.
It is possible to enable both whiteners. This is useful, for example, in conjunction with the test command
CMD_TX_TEST ( #IMPLIED) to transmit a white test signal.
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 291
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Bit-Stream Processor www.ti.com
The w register must be initialized by writing w into register BSP_W.W before starting receiving or
transmitting a packet. Doing this sets w 6 to BSP_W[0], w 5 to BSP_W[1] and so on up to w 1 to
BSP_W[5]; w 0 is set to 1.
When running normal receive or transmit tasks, writing to BSP_W is done by the LLE, which writes the
value in PRF_W_INIT to this register, but for test commands and co-processor mode, the BSP_W register
must be written by the MCU.
The PN7 whitener is enabled by the bit W_PN7_EN of the BSP_MODE register.
PN7 Whitening
w0 w1 w2 w3 w4 w5 w6
0 4 7
x x x
Output BSP_MODE.W_PN7_EN
B0466-01
292 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Bit-Stream Processor
PN9 Whitening
s8 s7 s6 s5 s4 s3 s2 s1 s0
b0 b1 b2 b3 b4 b5 b6 b7
BSP_MODE.W_PN9_EN Output
B0467-01
25.4.3 CRC
A block diagram showing the operation of the CRC module is given in Figure 25-5. The CRC sub-module
has two registers:
• A 32-bit data shift register d
• A 32-bit register p for holding the polynomial
The p register defines the shift register used for calculating CRC. There is a feedback tap in the locations
where the corresponding bit of p is set to 1. The module input is XORed by the output of the shift register,
and this becomes the feedback of the shift register.
The current value of the data shift register d is the CRC value. Prior to the start of CRC calculation, the d
and p registers should be initialized by writing d to registers BSP_D[0–3] and p to registers
BSP_P[0–3]. The BSP_P[0–3] registers only must be set once, whereas the BSP_D[0–3] registers
should be set again for each packet. In normal transmit and receive modes, this is handled by the LLE,
which writes the value of PRF_CRC_INIT[0–3] to BSP_D[0–3]. At the end of CRC calculation, the value
of the register is serially shifted out on the output. When performing CRC checking, all the BSP_D[0–3]
registers should be 0 for the CRC to be OK after the received CRC has been fed through the shift register.
If whitening is enabled, calculated CRC bytes are whitened before transmission, and received CRC bytes
are de-whitened before CRC checking.
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 293
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Bit-Stream Processor www.ti.com
CRC
32
x
p0 p1 p2 p30 p31
0 1 2 30 31
x x x x x
d0 d1 d2 d30 d31
Input Output
B0468-01
A 32-bit CRC polynomial can be described by the equation x 32+ a 31x 31+ … + a 1x 1+ 1, where all an are 0
or 1. To represent this, each P[n] bit in the BSP_P0–BSP_P3 registers should be set to an , and P[0]
should be set to 1. To reduce the size of the polynomial to k, set the bits P[33 – k:0] to 0 and
P[32 – k] to 1. In this case, the initialization value must have zeros at D[33 – k:0]. In practice, only
polynomials of order 8, 16, 24, and 32 are supported, as the number of CRC bits produced in the
transmitter and checked in the receiver is always a multiple of 8. The number of CRC bytes produced in
normal transmit tasks is given by RAM register PRF_CRC_LEN.
This is summarized in Table 25-8 for the four CRC polynomial orders supported. In the BSP_Px column,
the numbers are binary, with the most significant bit at the left. In the PRF_CRC_INIT column, an X
indicates the initialization value to use (each X does not have to be the same). Some examples are shown
in Table 25-9.
294 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Bit-Stream Processor
Table 25-9. Register Settings for Some Commonly Used CRCs, Assuming Initialization With All 1s
Order PRF_CRC_LEN CRC BSP_Px PRF_CRC_INIT
BSP_P0 = 0x00 PRF_CRC_INIT[0] = 0x00
8 2 BSP_P1 = 0x00 PRF_CRC_INIT[1] = 0x00
8 1 CRC-8-ATM x + x + x + 1
BSP_P2 = 0x00 PRF_CRC_INIT[2] = 0x00
BSP_P3 = 0x07 PRF_CRC_INIT[3] = 0xFF
BSP_P0 = 0x00 PRF_CRC_INIT[0] = 0x00
8 7 6 4 2 BSP_P1 = 0x00 PRF_CRC_INIT[1] = 0x00
8 1 CRC-8 x + x + x + x + x + 1
BSP_P2 = 0x00 PRF_CRC_INIT[2] = 0x00
BSP_P3 = 0xD3 PRF_CRC_INIT[3] = 0xFF
BSP_P0 = 0x00 PRF_CRC_INIT[0] = 0x00
CRC-16 (used in CC2500) x16 + x15 + BSP_P1 = 0x00 PRF_CRC_INIT[1] = 0x00
16 2
x2 + 1 BSP_P2 = 0x05 PRF_CRC_INIT[2] = 0xFF
BSP_P3 = 0x80 PRF_CRC_INIT[3] = 0xFF
BSP_P0 = 0x00 PRF_CRC_INIT[0] = 0x00
16 12 5 BSP_P1 = 0x00 PRF_CRC_INIT[1] = 0x00
16 2 CRC-16-CCITT x + x + x + 1
BSP_P2 = 0x21 PRF_CRC_INIT[2] = 0xFF
BSP_P3 = 0x10 PRF_CRC_INIT[3] = 0xFF
BSP_P0 = 0x00 PRF_CRC_INIT[0] = 0x00
CRC-24 x24 + x22 + x20 + x19 + x18 + x16 BSP_P1 = 0xCB PRF_CRC_INIT[1] = 0xFF
24 3 + x14 + x13 + x11 + x10 + x8 + x7 + x6 + x3
+x+1 BSP_P2 = 0x6D PRF_CRC_INIT[2] = 0xFF
BSP_P3 = 0x5D PRF_CRC_INIT[3] = 0xFF
BSP_P0 = 0xB7 PRF_CRC_INIT[0] = 0xFF
CRC-32-IEEE 802.3 x32 + x26 + x23 + BSP_P1 = 0x1D PRF_CRC_INIT[1] = 0xFF
32 4 x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5
+ x4 + x2 + x + 1 BSP_P2 = 0xC1 PRF_CRC_INIT[2] = 0xFF
BSP_P3 = 0x04 PRF_CRC_INIT[3] = 0xFF
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 295
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Frequency and Channel Programming www.ti.com
25.7 Receiver
When the receiver is started, it searches for the preamble and the sync word. These are used for
frequency offset compensation and bit and byte synchronization. The sync word can be programmed to be
from 16 to 32 bits.
296 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Packet Format
Checking the sync word is done in a two-stage process. First, a correlation value is calculated. If this
correlation is above a programmable threshold, a data decision of the received sync word is done. It can
be programmed in MDMCTRL3.SYNC_MODE whether this data decision is to be ignored, no bit errors are to
be accepted, or one bit error is to be accepted. The correlation threshold value is programmed in
MDMCTRL1.CORR_THR. This threshold value should depend on the sync word length. As a rule of thumb,
a value of 0.25 times the number of bits (rounded down) can be used.
For the bit synchronization to work well, some guidelines should be followed for the sync word. It should
have enough transitions, but not long runs of 10 1010... or other short, repeated patterns. Generally, a
longer sync word gives better performance.
The CC2541 devices have support for two independent sync words. The primary and secondary sync
words are specified in two sets of registers. The secondary sync word can be enabled by the
SW_CONF.DUAL_RX bit, and if enabled, the received signal is correlated against both sync words. If the
correlation with one of the sync words is above the threshold, data decision is done against that sync
word.
While the receiver is running, a received signal strength indicator (RSSI) is updated. The RSSI is available
some time after the receiver is started, regardless of whether sync is found. It can be read from the RSSI
register, which is 0x80 when no RSSI is available. The value given is in the range 0 to approximately 64,
with a change of 1 corresponding to a 1-dB change. The offset from a true dBm value depends on the
receiver mode and can be found in the device data sheet. For high received signal levels, the reported
RSSI saturates at one of the highest possible reported values. The accuracy and update time of the RSSI
can be traded off using MDMTEST0.RSSI_ACC. The RSSI can be calculated over a window of 5.33 µs or
21.3 µs, and 1, 2, or 4 such windows can be averaged to give the result. Using a longer average time
gives higher accuracy, but it takes longer before a result is ready, and doing the average over a longer
time means that the result may be wrong for short packets. An average of n windows of length t RSSIshould
only be used for packets lasting longer than (n + 1) tRSSI (including preamble, sync word, and CRC).
The receiver must run dc offset estimation and removal. The dc offset estimation mode can be controlled
with MDMTEST0.DC_BLOCK_MODE. For data rates of 1 Mbps and lower, where the receiver runs on a low
IF, it is recommended to use the default setting for this register (continuous estimation). For 2 Mbps,
where the receiver runs on zero IF, delayed dc offset estimation should normally be used. This causes the
dc offset estimation to be done in front of the packet. The delay can be controlled through
MDMTEST0.DC_BLOCK_LENGTH and MDMTEST1.DC_DELAY. The recommendation is to set
MDMTEST0.DC_BLOCK_LENGTH to 11 (128 samples) and MDMTEST1.DC_DELAY to 00 (5 delays), which
allows for up to approximately 105 µs of energy in front of the packet payload, including the preamble and
sync word. As an alternative for 2 Mbps, dc offset estimation can be turned off, and a previously found
value can be used, written into the DC_I_L, DC_I_H, DC_Q_L, and DC_Q_H registers. Values can be
found in advance, but differ for each frequency. For auto acknowledgments and other packets that are
received at a known time, the LLE can perform a special dc offset algorithm as described in
Section 25.9.2.
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 297
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Packet Format www.ti.com
When using a 9 bit header, the payload length is limited to the range 0-63 bytes. Note that the LLE must be reset
when the device enters PM2 or PM3. This means that the PRFX registers must be re-initialized after the LLE has
been re-enabled after coming up from one of these power modes.
Figure 25-7. Air Interface Packet Format for Auto Mode
The preamble is a sequence of 1010 1010 or 0101 0101. It can be from 1 to 16 bytes. The type of
preamble and the number of bytes can be set up in the MDMCTRL2 register.
The sync-word field is a synchronization word that can have any length from 16 to 32 bits. The length is
programmed in the SW_CONF.SW_LEN register. The sync word itself is programmed in the SW0, SW1, SW2,
and SW3 registers for the primary sync word, and SW4, SW5, SW6, and SW7 for the secondary sync word.
The bit ordering of the sync word is set up with MDMCTRL2.SW_BIT_ORDER. If SW_BIT_ORDER is 0, the
LSB of SW0 (SW4) is transmitted first and the MSB of SW3 (SW7) is transmitted last. If SW_BIT_ORDER
is 1, the MSB of SW3 (SW7) is transmitted first and the LSB of SW0 (SW4) is transmitted last. The first bit
transmitted is always the same regardless of the sync word length; the unused bits for sync word length of
less than 32 bits are the ones that would have been transmitted last.
The optional length byte in basic mode (see Figure 25-6) is present if PRF_TASK_CONF.MODE = 01. It
indicates the number of address and payload bytes following the length byte. If the length field is not
present, the length is fixed as described in Section 25.9.2.
The optional address is 1 byte if present; the length is configured with the PRF_PKT_CONF.ADDR_LEN
register. In the transmitter, the address can be used for identification or to direct the message to a
particular receiver, and in the receiver, the address can be used to filter out messages from unknown or
unwanted transmitters and to distinguish between messages from different transmitters. See
Section 25.9.2 for details on how the address is used. Note that for the packet format in Figure 25-7 or if a
length field is not used, the address field immediately follows the sync word, and can thus be seen as an
extension of it.
The 9-bit or 10-bit header shown in Figure 25-7 is shown in more detail in Figure 25-8 and Figure 25-9.
This field consists of a 6-bit or 7-bit length followed by a 2-bit sequence number and a flag called
NO_ACK (NOA in Figure 25-8 and Figure 25-9) to inform that acknowledgment of the packet is not
expected. If the configuration is to use a fixed length, the value of the length field is ignored in the
receiver. It can be configured always to set the length field to 11 0011 in the transmitter for fixed-length
packets.
The payload can be from zero to 255 bytes in basic mode, but the sum of the number of address and
payload bytes must not exceed 255. In auto mode, the payload can be from 0 to 63 bytes with a 9-bit
header or 0 to 127 bytes with a 10-bit header. The maximum packet length can be limited, see
Section 25.9.2.3.1 and Section 25.9.2.3.2
298 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Packet Format
The bit ordering when transmitting the length, address, payload, and CRC bytes is set up with the
ENDIANNESS bit of the FRMCTRL0 register; if 0, the LSB of each byte is transmitted first and if 1, the MSB
is transmitted first. Normally, FRMCTRL0.ENDIANNESS and MDMCTRL2.SW_BIT_ORDER should have the
same value. Note that for correct operation in auto mode, FRMCTRL0.ENDIANNESS must be set to 1 so
that MSB is transmitted first.
The CRC field contains 0 to 4 bytes and is used to check the packet for errors if present. See
Section 25.4.3 on how to set up the CRC generation and checking.
Status
Length Address config Payload
RSSI RES
1 Byte 0–1 Bytes 0–1 Bytes (Length – (Length of Address + config)) Bytes 1 Byte 1 Byte
Address Index SW Unused NOA SEQ Address Index SW Unused IGN CRC
LSB Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 MSB LSB Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 MSB
R0013-02
The structure of a packet in the RX FIFO is shown in Figure 25-10. All packets start with a length byte,
regardless of whether a length byte is present on the air. The length is the number of bytes in the address,
config, and payload fields following the length byte, and it may be modified compared to the length
received on the air or configured as fixed-length. If packets are longer than what can fit in the FIFO,
packets must be read from the FIFO while reception takes place, either by DMA or directly by the MCU.
The auto-flush options in PRF_FIFO_CONF cannot be used in this case, and auto-commit and auto-
deallocate must be enabled for the RX FIFO in RFFCFG.
The address byte is placed after the length byte and is present if configured in
PRF_FIFO_CONF.RX_ADDR_CONF. The address is written in the FIFO as it was received on the air.
The config byte following the length byte and address byte is present if configured in
PRF_FIFO_CONF.RX_ADDR_CONF. In this case, the index n to the PRF_ADDR_ENTRYn containing the
received address is present in bits 0–2, and bit 3 is 0 if the primary sync word was received and 1 if the
secondary sync word was received. In auto mode, the 3 MSBs of the config byte are set to the 3 LSBs of
the received header.
The payload is as received on the air. In case of an empty packet, there is no payload.
The status field consists of 2 bytes appended to the FIFO entry if configured in
PRF_FIFO_CONF.RX_STATUS_CONF. The presence of a status field is not reflected in the value of the
length byte, so if a status field is present, the MCU must read 2 extra bytes. It is possible to configure this
even using DMA with automatic length extraction. The status bytes are:
• RSSI is the received signal-strength indication from the demodulator.
• RES contains information on the address and CRC result.
– The 3 LSBs contain the address index as in the config byte.
– Bit 3 is 0 if the primary sync word was received and 1 if the secondary sync word was received.
– IGN is 1 for packets that may be ignored by the MCU due to repeated sequence number and 0
otherwise.
– CRC is 1 if there was a CRC error and 0 otherwise.
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 299
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Packet Format www.ti.com
1 Byte 0–1 Bytes 0–1 Bytes (Length – (Length of Address + config)) Bytes
The structure of a packet in the TX FIFO is shown in Figure 25-11. All packets start with a length byte,
regardless of whether a length byte is present on the air. The length is the number of bytes in the address,
config, and payload fields following the length byte, and it may be modified before being transmitted on the
air. If a fixed length is used, it is up to the MCU to ensure that the length is correct given the fixed length
expected by the receiver. If packets are longer than what can fit in the FIFO, packets must be written to
the FIFO while transmission takes place, either by DMA or directly by the MCU. Auto-commit and auto-
deallocate must then be enabled for the TX FIFO in RFFCFG.
The address byte is placed after the length byte and is present if configured in
PRF_FIFO_CONF.TX_ADDR_CONF. If it is included, the address is transmitted on the air as it is read from
the FIFO. If it is not included, but a config byte is included, the three LSBs of the config byte tell the index
n of PRF_ADDR_ENTRYn from which the address is inserted. If neither an address nor a config byte is
included, the address is inserted from PRF_ADDR_ENTRY0.ADDRESS.
The config byte following the length byte and optional address byte is present if configured in
PRF_FIFO_CONF.TX_ADDR_CONF. This byte contains an address index which is used to determine the
address if no address byte is included as explained previously. If an address byte is included, the address
index is used to determine which address entry to read the configuration from, but the ADDRESS field in
that address entry is ignored. In auto mode, the NO_ACK bit (LSB) of the transmitted header is set to bit 5
of the config byte. If PRF_ADDR_ENTRYn.CONF.FIXEDSEQ, where n is the index of the address used, is
1, the SEQ field of the transmitted header is taken from the SEQ field (bits 6–7) of the config byte;
otherwise, the sequence number on the air is inserted from PRF_ADDR_ENTRYn.SEQSTAT.SEQ. If the
config byte is not included, the NO_ACK bit is always sent as 0 and
PRF_ADDR_ENTRYn.CONF.FIXEDSEQ should be 0 (otherwise the SEQ field always remains 0).The
payload is transmitted as present in the FIFO.
Table 25-11. Segments for Holding ACK Payload for Each Address Entry
Address Entry Number Buffer Number Setting of RFRAMCFG Start Address
0 0 7 or X 0x6000 or 0x6100
0 1 7 or X 0x6020 or 0x6120
1 0 7 or X 0x6040 or 0x6140
1 1 7 or X 0x6060 or 0x6160
2 0 1 0x6000
300 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Link Layer Engine
Table 25-11. Segments for Holding ACK Payload for Each Address Entry (continued)
Address Entry Number Buffer Number Setting of RFRAMCFG Start Address
2 1 1 0x6020
3 0 1 0x6040
3 1 1 0x6060
4 0 2 0x6000
4 1 2 0x6020
5 0 2 0x6040
5 1 2 0x6060
6 0 3 0x6000
6 1 3 0x6020
7 0 3 0x6040
7 1 3 0x6060
The status of buffer k for address n is contained in the PRF_ADDR_ENTRYn.ACKLENGTHk register. If the
value is 0, the buffer is free.
In order to enter a payload for address n, the MCU must follow the following procedure:
1. Read PRF_ADDR_ENTRYn.ACKLENGTH0 and PRF_ADDR_ENTRYn.ACKLENGTH1. Call the values
len_0 and len_1, respectively.
2. Read PRF_ADDR_ENTRYn.SEQSTAT.NEXTACK and call this value k. Let m be NOT k (that is, 1 – k).
3. Check if len_k is 0. If so, write the payload to buffer k for address entry n (see Table 25-11), then write
the payload length to PRF_ADDR_ENTRYn.ACKLENGTHk. End the procedure.
4. Otherwise, check whether len_ m is 0. If so, write the payload to buffer m for address entry n (see
Table 25-11), then write the payload length to PRF_ADDR_ENTRYn.ACKLENGTHm. End the procedure.
5. Otherwise, no ACK payload buffer for that address is free, and no payload can be entered at this time.
The ACK payload length can be 1–32. When a buffer becomes free, the LLE writes the
PRF_ADDR_ENTRYn.ACKLENGTHk to 0 and raises a TXDONE interrupt.
A buffer contains only the payload to be transmitted. The length is given by
PRF_ADDR_ENTRYn.ACKLENGTHk, and the address and sequence number are as described in
Section 25.9.2.3.2.
In order to flush the buffers for address n, issue the command CMD_FLUSH_ACK n (see Table 25-12).
This causes the LLE to write PRF_ADDR_ENTRYn.ACKLENGTH0 and PRF_ADDR_ENTRYn.ACKLENGTH1
to 0 and clear PRF_ADDR_ENTRYn.SEQSTAT.ACK_PAYLOAD_SENT. If no task is running, the LLE takes
SEMAPHORE1; if it fails, it does not write to PRF_ADDR_ENTRYn.SEQSTAT.ACK_PAYLOAD_SENT. If the
transmission of an acknowledgment with payload had started on that address, flushing happens after the
transmission is finished. After the flushing is done, the LLE raises a TXFLUSHED interrupt.
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 301
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Link Layer Engine www.ti.com
unwanted events from reaching the LLE, Timer 2 event 1 can be disabled in the T2EVTCFG register; see
Chapter 22. The frequency word is programmed according to the setting of PRF_CHAN.FREQ, except if it
is 127, in which case no frequency programming is done and any value written by the MCU is retained.
When using auto mode on 2 Mbps, the frequency must be programmed through the PRF_CHAN.FREQ
register. Then the LLE changes the IF frequency automatically (for 2 Mbps, the recommended settings
use different IF for transmission and reception) when changing from receive operation to transmit
operation (for sending an acknowledgment packet) and vice versa. The LLE starts configuring the
transmitter or receiver, depending on the type of task. After the transmitter or receiver has been set up,
the LLE takes SEMAPHORE1 to gain access to the remaining RAM-based registers, read the parameters,
and start transmission or reception.
Programming of frequency is done as described in Section 25.5. For symbol rates of 1 Mbps and lower,
RX and TX are done on the same synthesizer frequency, whereas for a symbol rate of 2 Mbps, the
synthesizer frequency changes between RX and TX. This change is done without a recalibration of the
synthesizer.
At the end of a packet, the LLE reads the RSSI register and writes the value to the PRF_LAST_RSSI
register and, if so configured, to the RSSI byte of the RX FIFO. This read is done after the next-to-last
byte has been obtained from the demodulator. Note that for a bit rate of 2 Mbps and for sync words
shorter than 32 bits, MDMCTRL3.RSSI_MODE should be set to 11 to ensure a correct reading. Before
turning off the demodulator, the LLE reads the dc offset from the DC_I_L, DC_I_H, DC_Q_L, and DC_Q_H
registers and writes the result to PRF_LAST_DCOFF (in the byte order listed for the register read). The LLE
also reads the frequency offset from the FREQEST register and writes the result to PRFX_LAST_FREQEST
(see Table 25-7).
If PRF_RADIO_CONF.DCOFF is 1, the LLE runs a procedure that estimates the dc offset right after
receiver startup. This mode is suitable for packets that are known to be received at a certain time, such as
acknowledgment packets. In this mode, the LLE starts the receiver with normal dc cancellation mode and
forces the LNA gain to minimum. After a short time, the LLE reads out the value of the dc offset estimate,
writes it into the override registers, and selects manual override mode for dc offset estimation. It sets the
LNA gain back to the programmed value and after a waiting time to allow the LNA to stabilize, starts sync
search. The time to start RX with this mode is the same as for ordinary start of RX.
If PRF_RADIO_CONF.DCWB is 1, the LLE writes the dc offset estimate read out at the end of the packet
into the dc offset override register, provided that the received packet did not have a CRC error. This is
suited for the delayed dc offset mode, where the override value for dc offset is used before a delayed dc
offset is available.
Some of the RAM registers are checked by the LLE to verify that their values are permitted. This applies
to PRF_CHAN.FREQ, PRF_FIFO_CONF.TX_ADDR_CONF, and PRF_CRC_LEN. If any of these registers has
values that are not permitted, the task ends with an error.
A CMD_SHUTDOWN command, undefined command, or any command starting a new task, ends the task
immediately. If a packet was being transmitted or received, an RXTXABO interrupt to the MCU is raised.
This means that to avoid unwanted abort of commands, the CPU should wait for a TASKDONE interrupt
or check that LLESTAT.LLE_IDLE is 1 before starting another command.
If a CMD_STOP command is received, the task ends after the current reception or transmission is done.
Timer 2 event 2 can be configured to end a task: If PRF_TASK_CONF.STOP_CONF is 01, Timer 2 event 2
behaves as a CMD_STOP, and if PRF_TASK_CONF.STOP_CONF is 10, Timer 2 event 2 behaves as a
CMD_SHUTDOWN. Setting PRF_TASK_CONF.STOP_CONF to 00 disables Timer 2 event 2 as a stop
event. With the 11 setting, Timer 2 event 2 only applies to sync search or listen right after a CMD_RX or
CMD_TX_ON_CC (this setting is not meaningful for a CMD_TX task) or a start by Timer 2 event 1. This is
explained in later subsections.
Timer 2 may capture the time of a packet based on the setting in PRF_RADIO_CONF. The fields TXCAP
and RXCAP decide how capture is configured for TX and RX, respectively; see Table 25-13. The captured
value can be read from the registers T2M0, T2M1, T2MOVF0, T2MOVF1, and T2MOVF2 when t2_cap and
t2ovf_cap are selected using the T2MSEL register; see Chapter 22.
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 303
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Link Layer Engine www.ti.com
When capture is done at the beginning of a packet, the time captured is the time right after the sync word
has been received or transmitted. Setting TXCAP or RXCAP to 11 enables capture at the start of a packet,
but the capture is turned off after a packet has been transmitted or fully received in a task, so it is the start
of the first packet in the task that is captured. The MCU should normally only read the captured value after
a task is done; otherwise, the captured value may be overwritten with a new value. The user must take
into account that a timer value may be captured on a received packet that does not match the address or
that has a length which is not permitted, and that is thus not reported. It is possible to turn on capture for
both received and transmitted packets in the same task. If so, it is up to the user to determine if the
captured value was from a received or transmitted packet.
When a task is finished, the LLE writes an end-of-task cause in PRF_ENDCAUSE, frees the semaphores,
raises a TASKDONE interrupt, and halts its operation. The possible values of PRF_ENDCAUSE are listed in
Table 25-14.
If PRF_CHAN.SYNTH_ON is 1, the synthesizer is not turned off after the task ends. This can be used to
start a new task immediately on the same channel and get faster start of RX or TX. To do so, the next
task should be started with PRF_CHAN.FREQ set to 127. Note that the synthesizer should not be allowed
to run for a long time after a task has ended, as this causes excessive power consumption. The
synthesizer can be stopped by sending a CMD_SHUTDOWN command.
304 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Link Layer Engine
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 305
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Link Layer Engine www.ti.com
Tone transmission is allowed to coincide with the synthesizer stabilizing (this may, however, cause the
start of the tone to have larger frequency variations than the packet). For this reason, when
PRF_PKT_CONF.START_TONE is 1, the synthesizer startup time is reduced by the value of the register
PRFX_TONE_OFFSET. This should normally correspond to the time of the extra preambles, but it must not
be larger than 4096 (corresponding to 128 µs). PRFX_TONE_OFFSET can thus be used to compensate for
the extra time added by the extra preamble bytes used for tone generation. However, the duration of the
extra preamble bytes configured must be accounted for in PRF_TX_DELAY, PRF_RETRANS_DELAY, and
PRF_RX_TX_TIME.
The default values of PRFX_TONE_DURATION and PRFX_TONE_OFFSET correspond to 48 µs and are
tuned for using 12 extra preamble bytes (13 in total) on 2 Mbps. When using the reset values,
MDMCTRL2.NUM_PREAM_BYTES should thus be set to 0x0C.
If PRFX_TONE_DURATION is set too large compared to the number of preamble bytes configured, the
modulator underflows. If this happens, the task ends with TASKERR_MODUNF as end cause.
1 Mbps
MDMCTRL2.NUM_PREAM_BYTES × 0x100 + MDMCTRL2.NUM_PREAM_BYTES × 0x100
0x52
500 kbps
MDMCTRL2.NUM_PREAM_BYTES × 0x200 + min(MDMCTRL2.NUM_PREAM_BYTES × 0x200,
0x62 0x1000)
250 kbps
MDMCTRL2.NUM_PREAM_BYTES × 0x400 + min(MDMCTRL2.NUM_PREAM_BYTES × 0x400,
0x82 0x1000)
306 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Link Layer Engine
An address entry should not be modified while the receiver is running. In order to modify, stop the
receiver, modify the entry or entries, and restart the receiver.
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 307
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Link Layer Engine www.ti.com
Next, the 9-bit or 10-bit header is read. If PRF_ADDR_ENTRYn.CONF.VARLEN is 1, the length is fetched
from the header and compared against PRF_ADDR_ENTRYn.RXLENGTH. If it is greater than that value,
reception is stopped and the device goes back to sync search. If PRF_ADDR_ENTRYn.CONF.VARLEN is 0,
the length field in the received header is ignored and the packet length is read from
PRF_ADDR_ENTRYn.RXLENGTH. In both cases, the length is the number of bytes after the header and
before the CRC. The length must be less than or equal to 63 for a 9-bit header and 127 for a 10-bit
header. When a 10-bit header is used, the MCU must ensure that an entire packet can fit in the RX FIFO
for auto ACK to be possible. This limits the maximum packet size based on the settings in
PRF_FIFO_CONF.
If reception is stopped due to address mismatch or invalid length, the time-out given by
PRF_SEARCH_TIME or Timer 2 event 2 still applies. If the first packet of the task is being received and
PRF_TASK_CONF.STOP_CONF is 11, this still counts as the first packet.
If a CRC field is present, it is checked using the polynomial configured in the BSP and the initialization
value from PRF_CRC_INIT. The result of the CRC is written in the MSB of the RES byte in the status field
if a status field is configured. If the CRC is not correct and PRF_FIFO_CONF.AUTOFLUSH_CRC is 1, the
LLE sends a discard RX FIFO command to remove the packet from the RX FIFO.
If the CRC is correct, the sequence number is checked against the sequence number stored in
PRF_ADDR_ENTRYn.SEQSTAT.SEQ. If the sequence numbers are equal and
PRF_ADDR_ENTRYn.SEQSTAT.VALID is 1, the two last received CRC bytes are compared against the 2
bytes in PRF_ADDR_ENTRYn.LASTCRC. If they are equal, the packet is determined to be a retransmission
which can be ignored. If the CRC is 1 byte only, the received CRC byte is compared to
PRF_ADDR_ENTRYn.LASTCRC[0] only, and if there is no CRC, the comparison is always viewed as
equal. If the packet was a retransmission, the IGN bit of the RES byte in the status field is set if a status
field is configured. After reception of a packet with CRC OK and which fits in the RX FIFO,
PRF_ADDR_ENTRYn.SEQSTAT.VALID is set to 1, PRF_ADDR_ENTRYn.SEQSTAT.SEQ is set to the
sequence number of the header of the received packet, and PRF_ADDR_ENTRYn.LASTCRC is set to the
value of the last two received CRC bytes.
If the RX FIFO becomes full while receiving a packet, the packet is discarded from the FIFO and no more
bytes are stored in the RX FIFO, but the packet is received to its end. After that, it is checked whether the
packet would be discarded from the RX FIFO anyway due to the setting of PRF_FIFO_CONF. If so, the
task proceeds as normally. Otherwise, an RXFIFOFULL error interrupt is raised, and no acknowledgment
is transmitted. The sequence number is not updated so that a retransmission of the packet is not ignored.
If the received packet was not a retransmission and PRF_ADDR_ENTRYn.SEQSTAT.ACK_PAYLOAD_SENT
is 1, the packet is seen as a confirmation of the last transmitted acknowledgment payload. If so,
PRF_ADDR_ENTRYn.SEQSTAT.ACK_PAYLOAD_SENT is set to 0, a TXDONE interrupt is raised, and the
PRF_ADDR_ENTRYn.NTXDONE counter is incremented. PRF_ADDR_ENTRYn.ACKLENGTHk is set to 0 for
the k found in PRF_ADDR_ENTRYn.SEQSTAT.NEXTACK, and PRF_ADDR_ENTRYn.SEQSTAT.NEXTACK is
inverted.
After receiving a packet, the LLE raises an interrupt to the MCU. Depending on the CRC result, the
payload length, and whether the received packet is a retransmission to be ignored, the interrupts are
generated as shown in Table 25-17. The table also shows which of the counters among the RAM registers
are to be updated.
308 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Link Layer Engine
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 309
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Link Layer Engine www.ti.com
• 11: If received while in sync search for the first packet after the task was started, or if
PRF_TASK_CONF.START_CONF is 1 while in sync search for any packet, the task ends immediately
with TASK_RXTIMEOUT as the end cause. Otherwise, nothing happens.
In addition, the task can end due to an internal time-out as described in the beginning of Section 25.9.2.1,
or it can end due to an error condition. The full list of possible end causes is summarized in Table 25-18.
310 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Link Layer Engine
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 311
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Link Layer Engine www.ti.com
Next, the 9-bit or 10-bit header is read. If PRF_ADDR_ENTRYn.CONF.VARLEN is 1, the length is fetched
from the header and compared against PRF_ADDR_ENTRYn.RXLENGTH. The maximum allowed value of
this register is 32. If the received length is greater than PRF_ADDR_ENTRYn.RXLENGTH, reception is
stopped and the device goes back to sync search. If PRF_ADDR_ENTRYn.CONF.VARLEN is 0, the length
field in the received header is ignored and the packet length is read from PRF_ADDR_ENTRYn.RXLENGTH,
which should normally be 0 in this case. The length is the number of bytes after the header and before the
CRC.
If a CRC field is present, it is checked using the polynomial configured in the BSP and the initialization
value from PRF_CRC_INIT. The result of the CRC is written in the MSB of the RES byte in the status field
if a status field is configured. If the CRC is not correct and PRF_FIFO_CONF.AUTOFLUSH_CRC is set, the
LLE sends a discard RX FIFO command to remove the packet from the RX FIFO.
The received sequence number is written to the config byte of the RX FIFO if configured, but is otherwise
ignored.
If the RX FIFO becomes full while receiving an acknowledgment packet, the packet is discarded from the
FIFO and no more bytes are stored in the RX FIFO, but the packet is received to its end. After that, it is
checked to see whether the packet would be discarded from the RX FIFO anyway due to the setting of
PRF_FIFO_CONF. If so, the task proceeds as normally. Otherwise, the task ends after the packet is
received and an RXFIFOFULL error interrupt is raised. In this case, the treatment of the packet is as if the
acknowledgment were not successfully received. This means that the next time a transmit task is started,
the packet is retransmitted so that the receiver retransmits the ACK payload.
After receiving an acknowledgment, the LLE raises an interrupt to the MCU. Depending on the CRC
result, the payload length, and whether the received packet had the same sequence number as the
transmitted one, the interrupts are generated as shown in Table 25-19. It also shows which of the counters
among the RAM registers are to be updated.
Table 25-19. Interrupt and Counter Operation for Received ACK Packets
CRC Result Length Counter Incremented Interrupt Raised
OK >0 PRF_ADDR_ENTRYn.N_RXOK RXOK
OK =0 PRF_ADDR_ENTRYn.N_RXIGNORED RXEMPTY
NOK X PRF_ADDR_ENTRYn.N_RXNOK RXNOK
If an acknowledgment was not received (because no sync was obtained in time, the address did not
match, the sequence number was wrong, the CRC check failed, or the ACK did not fit in the RX FIFO and
was not otherwise to be discarded) the LLE sends a retry TX FIFO command. If the number of
retransmissions already performed (not including the original transmission) is equal to
PRF_RETRANS_CNT, the task ends. Otherwise, the packet is retransmitted. The time from the end of the
previous transmission to the start of the retransmission is given in units of 62.5 ns by
PRF_RETRANS_DELAY.
If the received packet was a valid acknowledgment, or if a packet was completely read out of the TX FIFO
and no acknowledgment was expected, the LLE sends a deallocate TX FIFO command if
PRF_ADDR_ENTRYn.REUSE is 0. Otherwise, the MCU must issue either a deallocate TX FIFO (to send a
new packet) or a retry TX FIFO (to reuse) before sending again. The PRF_ADDR_ENTRYn.NTXDONE
counter is incremented. A TXDONE interrupt to the MCU is raised. If
PRF_ADDR_ENTRYn.CONF.FIXEDSEQ = 0, PRF_ADDR_ENTRYn.SEQSTAT.SEQ is incremented by 1
modulo 4. The next action is as given in Section 25.9.2.3.3.
If the task ends because of a maximum number of retransmissions, a retry TX FIFO command is sent
before the task ends, and PRF_ADDR_ENTRYn.SEQSTAT.SEQ is not incremented. This means that by
default, the packet retransmission is attempted in the next task. If this is not desired, the packet must be
removed from the FIFO. This can be done either by issuing a CMD_TXFIFO_RESET (this also removes
any subsequent packets in the TX FIFO), by reading out the packet using the RFTXFRD register and
issuing a CMD_TX_FIFO_DEALLOC command, or by TX FIFO pointer manipulation (Section 25.3.1.3).
PRF_ADDR_ENTRYn.SEQSTAT.SEQ should then be incremented by one. These operations should only
take place between tasks (that is, while the LLE does not have SEMAPHORE1).
312 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Link Layer Engine
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 313
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Link Layer Engine www.ti.com
314 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Link Layer Engine
The task can end for all the same reasons as a normal transmit task summarized in Table 25-20. In
addition it can end for the reasons listed in Table 25-21.
25.9.2.6 Timing
The timing in tasks is given in registers PRF_TX_DELAY, PRF_RETRANS_DELAY, PRF_SEARCH_TIME,
PRF_RX_TX_TIME, and PRF_TX_RX_TIME. The first two of these registers are multiplied by 2 and then
represent the number of 32-MHz samples, while the rest directly give the number of 32-MHz samples.
PRF_TX_DELAY gives the time from the end of the previous transmission in the task to the start of the
next transmission. Some examples of these delays are shown in Figure 25-12 and Figure 25-13 for RX
and TX tasks, respectively. The time from the end of a received packet to the beginning of a transmitted
packet is 130 µs in an RX task with auto ACK.
When sync search takes place, either for receiving a normal packet or for receiving ACK, a time-out can
be set up for when to give up the search. This time-out, given in 32-MHz cycles, is set up in the
PRF_SEARCH_TIME register. Setting this register to 0 disables the time-out. In case of a time-out, the task
ends for a normal sync search, or a packet is retransmitted in case of an ACK sync search.
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 315
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Link Layer Engine www.ti.com
Sync Search Receive Packet Sync Search Receive Packet Sync Search
CMD_RX
Give up sync search,
end task
Sync Search Receive Packet Transmit ACK Sync Search Receive Packet
CMD_RX
CMD_RX
Give up sync search,
end task
T0536-01
NOTE: The time given by PRF_SEARCH_TIME is denoted tSearch and the time given by PRF_RX_TX is denoted
tRX-TX. The setup and wait time for the synthesizer, receiver, and transmitter are denoted tSynth, tTX, and tRX,
respectively.
Figure 25-12. Timing of Packets in RX Tasks
For auto retransmit tasks, the time PRF_RETRANS_DELAY is the time from the end of a transmission to the
retransmission of the packet in case an ACK is not found or there is a CRC error; see Figure 25-13. The
values of PRF_SEARCH_TIME and the maximum packet length in PRF_PAYLOAD_LEN should be set such
that this time can always be achieved. If it is not possible to achieve the retransmission time, the packet is
retransmitted as early as possible.
316 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Link Layer Engine
CMD_TX
tTx_Delay
tSynth tTx-Rx
CMD_TX
tRetrans
tSynth tTx-Rx tSearch tTx-Rx
tTx tRx tTx tRx
tRetrans
tSynth tTx-Rx tSearch tTx-Rx
tTx tRx tTx tRx
NOTE: The time given by PRF_TX_DELAY is denoted t TX_Delay, the time given by PRF_SEARCH_TIME is
denoted tSearch, the time given by PRF_RETRANS_DELAY is denoted tRetrans, and the time given by PRF_TX_RX
is denoted tTX-RX. The setup and wait times for the synthesizer, receiver, and transmitter are denoted tSynth, tTX, and tRX,
respectively.
Figure 25-13. Timing of Packets in TX Tasks
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 317
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Random Number Generation www.ti.com
When receiving CMD_DEMOD_TEST, the LLE starts the receiver, but does not start sync search. The
receiver runs until a CMD_SHUTDOWN command (or a command starting another task) is sent.
When receiving CMD_RX_TEST, the LLE starts the receiver and starts sync search. Any received data is
discarded. The receiver runs until a CMD_SHUTDOWN command (or a command starting another task) is
sent.
When receiving a CMD_TX_TEST, the LLE starts the transmitter and starts sending all zeros. The TX test
command is normally combined with configuration of the modem to send a tone or by the BSP to send a
whitening sequence. The transmitter runs until a CMD_SHUTDOWN command (or a command starting
another task) is sent. In order to send random modulated data for test purposes, it is recommended to set
BSP_MODE to 0x03 to enable both whiteners.
In order to send a continuous wave (CW), MDMCTRL0.TX_IF can be set to 1 before the CMD_TX_TEST
command is issued. In this case, the radio outputs a tone with the frequency given in
MDMTEST1.TX_TONE. In most cases, a tone at the synthesizer frequency is wanted (for example, to
measure phase noise), in which case MDMTEST.TX_TONE should be set to 0x0A. The frequency
synthesizer must be programmed to the carrier frequency with no offset in this case; see Section 25.5.
When receiving a CMD_TX_FIFO_TEST, the LLE starts the transmitter and starts sending from the TX
FIFO; otherwise, the command is as CMD_TX_TEST. The MCU must feed data into the TX FIFO to avoid
underflow, and the TX FIFO must be set up with auto commit and auto deallocate.
When receiving a CMD_PING command, the LLE responds with a PINGRSP. This can be used for
checking that the LLE code is running.
318 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Packet Sniffing
RFST = CMD_DEMOD_TEST;
// Seed RNG
RNDL = RFRND;
RNDL = RFRND;
The packet-sniffer clock frequency is equal to the RF data rate. The data is output serially, in the received
or transmitted order. It is possible to use a SPI slave to receive the data stream.
When a complete packet has been transferred, the packet sniffer appends a status byte that tells which
value of the FREQCTRL register was used and if it was a TX or RX packet (bit 0 is high if it was a TX
packet). The appended byte is formatted as follows (first transmitted bit to the left):
This allows for the external receiver to differentiate between RX and TX packets.
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 319
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Registers www.ti.com
To set up the packet-sniffer signals or some of the other RF core observation outputs (in total maximum 3;
rfc_obs_sig0, rfc_obs_sig1, and rfc_obs_sig2), the user must perform the following steps:
Step1: Determine which signal (RFC_OBS_CTRL[0–2]) to output on which GPIO pin (P1[0:5]). This is
done using the OBSSELx control registers (OBSSEL0–OBSSEL5) that control the observation output to the
pins P1[0:5] (overriding the standard GPIO behavior for those pins).
Step2: Set the (RFC_OBS_CTRL[0–2]) control registers to select the correct signals (rfc_obs_sig); for
example, for packet sniffing one needs the rfc_sniff_data for the packet-sniffer data signal.and rfc_sniff_clk
for the corresponding clock signal.
Step3: Enable the packet-sniffer module in the MDMCTRL3 register.
25.12 Registers
320 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Registers
Table 25-24. Registers That Should Be Updated From Their Default Value,
Bit Rates 1 Mbps and Lower
Standard Gain: High Gain:
Register Name Address (Hex) Description
New Value (Hex) (1) New Value (Hex)
Amplitude weight in frequency offset
FRMCTRL0 6180 43 43 compensation (assuming sync word
included in CRC and MSB first)
Sync word correlation threshold (32-bit
MDMCTRL1 6191 48 48
sync word)
Use inverse of preamble for frequency
MDMCTRL2 6192 C0 C0
offset estimation (assuming MSB first)
Set RSSI mode to peak detect after
MDMCTRL3 6193 63 63
sync
RXCTRL 619A 33 3F Receiver currents
FSCTRL 619B 55 5A Prescaler and mixer currents
LNAGAIN 61A0 3A 7F LNA gain
Sets TX anti-aliasing filter to appropriate
TXFILTCFG 61BC 03 03
bandwidth
TXPOWER 6186 E1 E1 TX power (0 dBm)
TXCTRL 6187 19 19 DAC current
IVCTRL 6265 1B 1B PA, mixer, and DAC bias
(1)
Not all modulation types are characterized for the standard gain setting; see the CC2541 2.4-GHz Bluetooth low energy and
Proprietary System-on-Chip data sheet (SWRS110).
Table 25-25. Registers That Should Be Updated From Their Default Value, Bit Rate 2 Mbps
Register Name Address (Hex) RX Tasks TX Tasks Description
Amplitude weight in frequency offset
FRMCTRL0 6180 43 43 compensation (assuming sync word is
included in CRC and MSB first)
Sync word correlation threshold (32-bit sync
MDMCTRL1 6191 48 48
word)
Use inverse of preamble for frequency offset
MDMCTRL2 6192 CC CC estimation (assuming MSB first); set extra
preamble bytes
MDMCTRL3 6193 63 63 Set RSSI mode to peak detect after sync
RXCTRL 619A 29 29 Receiver currents
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 321
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Registers www.ti.com
Table 25-25. Registers That Should Be Updated From Their Default Value, Bit Rate 2
Mbps (continued)
Register Name Address (Hex) RX Tasks TX Tasks Description
FSCTRL 619B 5A 5A Prescaler and mixer currents
ADCTEST0 61A2 66 66 Reduce ADC gain
Select dc offset compensation method;
MDMTEST0 61A5 0F 01
change RSSI averaging
TXFILTCFG 61BC 03 03 Transmit filter bandwidth
PRF_PKT_CONF 6003 06 06 Enable AGC and start tone
Set 1-MHz TX IF and dc write-back; for TX
PRF_RADIO_CONF 607E 90 D0
tasks also special dc offset compensation
TXPOWER 6186 E1 E1 TX power (0 dBm)
TXCTRL 6187 19 19 DAC current
IVCTRL 6265 1B 1B PA, mixer, and DAC bias
The values for FRMCTRL0, MDMCTRL2, and PRF_PKT_CONF may require further adjustment based on the
frame format, and the correlation threshold in MDMCTRL1 should be adjusted according to the sync word
length, see Section 25.7.
In addition to these modifications, registers must be set in order to set up the modulation format, packet
handling, and so forth, as explained throughout this chapter.
322 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Registers
RFIRQF1 (0x91) – RF Interrupt Flags
Bit
Name Reset R/W Description
No.
7 PINGRSP 0 R/W0 When receiving a CMD_PING command, the LLE responds with a
PINGRSP. This can be used for checking that the LLE is running.
0: No interrupt pending
1: Interrupt pending
6 TASKDONE 0 R/W0 TX FIFO packet completed
0: No interrupt pending
1: Interrupt pending
5 TXDONE 0 R/W0 Task ended
0: No interrupt pending
1: Interrupt pending
4 RXEMPTY 0 R/W0 Empty packet received
0: No interrupt pending
1: Interrupt pending
3 RXIGNORED 0 R/W0 Packet received with unexpected sequence number
0: No interrupt pending
1: Interrupt pending
2 RXNOK 0 R/W0 Packet received with CRC error
0: No interrupt pending
1: Interrupt pending
1 TXFLUSHED 0 R/W0 TX ACK buffer flushed
0: No interrupt pending
1: Interrupt pending
0 RXOK 0 R/W0 Packet received correctly
0: No interrupt pending
1: Interrupt pending
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 323
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Registers www.ti.com
324 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Registers
RFIRQM1 (0x6182) – RF Interrupt Masks
Bit
Name Reset R/W Description
No.
7 PINGRSP 0 R/W When receiving a CMD_PING command, the LLE responds with a
PINGRSP. This can be used for checking that the LLE is running.
0: Interrupt disabled
1: Interrupt enabled
6 TASKDONE 0 R/W TX FIFO packet completed
0: Interrupt disabled
1: Interrupt enabled
5 TXDONE 0 R/W Task ended
0: Interrupt disabled
1: Interrupt enabled
4 RXEMPTY 0 R/W Empty packet received
0: Interrupt disabled
1: Interrupt enabled
3 RXIGNORED 0 R/W Packet received with unexpected sequence number
0: Interrupt disabled
1: Interrupt enabled
2 RXNOK 0 R/W Packet received with CRC error
0: Interrupt disabled
1: Interrupt enabled
1 TXFLUSHED 0 R/W TX ACK buffer flushed
0: Interrupt disabled
1: Interrupt enabled
0 RXOK 0 R/W Packet received correctly
0: Interrupt disabled
1: Interrupt enabled
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 325
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Registers www.ti.com
326 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Registers
SEMAPHORE0 (0x618A) – Semaphore for Accessing RF Data Memory
Bit
Name Reset R/W Description
No.
7:1 – 0000 R0 Reserved, read as 0
000
0 SEMAPHORE 1 R/W1 When SEMAPHORE = 1 and SEMAPHORE0 is read, SEMAPHORE is
set to 0. SEMAPHORE can only be set to 1 by a reset or by writing 1 to
it.
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 327
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Registers www.ti.com
328 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Registers
MDMCTRL2 (0x6192) – Modem Configuration
Bit
Name Reset R/W Description
No.
7 SW_BIT_ORDER 0 R/W 0: The sync word is transmitted LSB to MSB (from SYNC_WORD[0] to
SYNC_WORD[31]), and in receive the correlator expects this bit
ordering.
1: The sync word is transmitted MSB to LSB (from SYNC_WORD[31]
to SYNC_WORD[0]), and in receive the correlator expects this bit
ordering.
6 DEM_PREAM_MODE 0 R/W Use PREAM_SEL[1:0] or 1s complement of PREAM_SEL[1:0] for
frequency offset estimation.
0: PREAM_SEL[1:0]
1: 1s complement of PREAM_SEL[1:0]
5:4 PREAM_SEL[1:0] 00 R/W 00: Select preamble based on first bit of sync word; last bit of preamble is
inverse of first bit of sync word.
01: Select preamble based on first bit of sync word; last bit of preamble is
same as first bit of sync word.
10: Use preamble 0101 0101
11: Use preamble 1010 1010
3:0 NUM_PREAM_BYTES[3:0] 0000 R/W The number of preamble bytes to be sent in TX mode prior to the sync
word
0000: 1 leading preamble byte
0001: 2 leading preamble bytes
0010: 3 leading preamble bytes
0011: 4 leading preamble bytes
…
1111: 16 leading preamble bytes
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 329
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Registers www.ti.com
330 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Registers
SW7 (0x61FB) – Secondary Sync Word Byte 3
Bit
Name Reset R/W Description
No.
7:0 SYNC_WORD2[31:24] 0x00 R/W Contains bits 31:24 of the secondary synchronization word
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 331
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Registers www.ti.com
332 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Registers
MDMTEST1 (0x61A6) – Modem Configuration
Bit
Name Reset R/W Description
No.
7:6 DC_DELAY 00 R/W Controls delay of dc estimate delayed dc block mode. Delay unit is set by
MDMTEST0.DC_BLOCK_LENGTH
00: 5 delays
01: 6 delays
10: 7 delays
11: 8 delays
5 RX_IF 0 R/W Controls mixer frequency in demodulator (not 2 Mbps)
0: 1 MHz
1: –1 MHz
For 2 Mbps, always write 0. The receiver then operates at zero IF.
4:0 TX_TONE[4:0] 0 0000 R/W Controls baseband frequency of transmission
Note: If MDMCTRL0.PHASE_INVERT is 1, the sign of the frequency
is inverted
0: –8 MHz
1: –6 MHz
2: –4 MHz
3: –3 MHz
4: –2 MHz
5: –1 MHz
6: –500 kHz
7: –250 kHz
8: –125 kHz
9: –4 kHz
10: 0 Hz
11: 4 kHz
12: 125 kHz
13: 250 kHz
14: 500 kHz
15: 1 MHz
16: 2 MHz
17: 3 MHz
18: 4 MHz
19: 6 MHz
20: 8 MHz
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 333
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Registers www.ti.com
334 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Registers
LLECTRL (0x61B1) – LLE Control
Bit
Name Reset R/W Description
No.
7:3 – 0000 0 R0 Reseved. Read as 0
2:1 LLE_MODE_SEL 00 R/W LLE mode. Changing this field has no effect unless LLE_EN is changed
from 0 to 1.
00: Proprietary mode (described in this chapter)
01: BLE mode (only for use by the BLE stack)
Others: Reserved
0 LLE_EN 0 R/W Must be set to 0 before entering PM2 or PM3, otherwise the behavior of
the RF core after waking up may be unpredictable.
0: LLE held in reset
1: LLE enabled
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 335
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Registers www.ti.com
336 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Registers
RFFSTATUS (0x61C5) – FIFO Status
Bit
Name Reset R/W Description
No.
7 TXAVAIL 0 R 0: No readable data in TX FIFO
1: Readable data present in TX FIFO
6 TXFEMPTY 1 R 0: Data present in TX FIFO
1: TX FIFO is empty
5 TXDTHEX 1 R 0: There is less data in TX FIFO than the threshold amount given by
RFTXFTHRS.
1: There is more than or equal amount of data in TX FIFO than the
threshold amount given by RFTXFTHRS
4 TXFFULL 0 R 0: TX FIFO has available space
1: TX FIFO is full
3 RXAVAIL 0 R 0: No readable data in RX FIFO
1: Readable data present in RX FIFO
2 RXFEMPTY 1 R 0: Data present in RX FIFO
1: RX FIFO is empty
1 RXDTHEX 1 R 0: There is less data in RX FIFO than the threshold amount given by
RFRXFTHRS.
1: There is more than or equal amount of data in RX FIFO than the
threshold amount given by RFRXFTHRS
0 RXFFULL 0 R 0: RX FIFO has available space
1: RX FIFO is full
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 337
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Registers www.ti.com
338 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Registers
RFTXFRD (0x61D3) – TX FIFO Read Register
Bit
Name Reset R/W Description
No.
7:0 D 0x00 R When this register is read, the data in TX FIFO address offset RFTXFRP
from the start of the TX FIFO area is returned (see Figure 25-1).
RFTXFRP (and RFTXFSRP if RFFCFG.TXAUTOCOMMIT = 1) is
incremented by 1 modulo 0x80 unless the read fails.
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 339
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Registers www.ti.com
340 CC2541 Proprietary Mode Radio SWRU191F – April 2009 – Revised April 2014
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
www.ti.com Registers
DC_I_L (0x61FC) – In-Phase DC Offset Estimate, Low Byte
Bit
Name Reset R/W Description
No.
7:0 DC_I[7:0] 0x00 R*/W When running dc estimation, this register reflects the 8 LSBs of the dc
estimate in the I channel. When manual dc override is selected, the
override value is written to this register.
SWRU191F – April 2009 – Revised April 2014 CC2541 Proprietary Mode Radio 341
Submit Documentation Feedback
Copyright © 2009–2014, Texas Instruments Incorporated
Chapter 26
SWRU191F – April 2009 – Revised April 2014
Voltage Regulator
The digital voltage regulator is used to power the digital core. The output of this regulator is available on
the DCOUPL pin and requires capacitive decoupling to function properly (see, for example, the CC2530
reference design).
The voltage regulator is disabled in power modes PM2 and PM3 (see Chapter 4). When the voltage
regulator is disabled, register and RAM contents are retained while the unregulated 2 V to 3.6 V power
supply is present
NOTE: The voltage regulator should not be used to provide power to external circuits.
Available Software
This chapter presents the various available software solutions relevant to the CC253x, CC2540, and
CC2541 family. They are all available free of charge on the TI Web site at www.ti.com/lprf when used with
TI LPRF devices.
As shown in Table 0-1 in the Preface, the members of the CC253x, CC2540, and CC2541 family have
different flash and RAM sizes; hence, they are not equally well suited for the different software offerings in
the sections below. For example, a user designing a ZigBee device should use the CC2530F256, as the
Z-Stack™ requires in most cases more than 128 KB of flash and needs the 8-KB RAM.
Abbreviations
FS Full scale
GPIO General-purpose input/output
HF High frequency
HSSD High-speed serial data
I/O Input/output
I/Q In-phase/quadrature-phase
IEEE Institute of Electrical and Electronics Engineers
IF Intermediate frequency
IOC I/O controller
IRQ Interrupt request
IR Infrared
ISM Industrial, scientific and medical
ITU-T International Telecommunication Union – Telecommunication
IV Initialization vector
KB 1024 bytes
kbps Kilobits per second
LFSR Linear feedback shift register
LLE Link-layer engine
LNA Low-noise amplifier
LO Local oscillator
LQI Link quality indication
LSB Least-significant bit/byte
MAC Medium access control
MAC Message authentication code
MCU Microcontroller unit
MFR MAC footer
MHR MAC header
MIC Message integrity code
MISO Master in, slave out
MOSI Master out, slave in
MPDU MAC protocol data unit
MSB Most-significant bit/byte
MSDU MAC service data unit
MUX Multiplexer
NA Not applicable/available
NC Not connected
OFB Output feedback (encryption)
O-QPSK Offset – quadrature phase-shift keying
PA Power amplifier
PC Program counter
PCB Printed circuit board
PER Packet error rate
PHR PHY header
PHY Physical layer
PLL Phase-locked loop
PM1, PM2, Power mode 1, 2, and 3
PM3
PMC Power management controller
PN7, PN9 7-bit or 9-bit pseudo-random sequence
POR Power-on reset
Additional Information
Texas Instruments offers a wide selection of cost-effective, low-power RF solutions for proprietary and
standard-based wireless applications for use in industrial and consumer applications. Our selection
includes RF transceivers, RF transmitters, RF front ends and System-on-Chips as well as various software
solutions for the sub-1 and 2.4-GHz frequency bands.
In addition, Texas Instruments provides a large selection of support collateral such as development tools,
technical documentation, reference designs, application expertise, customer support, third-party and
university programs.
The Low-Power RF E2E Online Community provides you with technical support forums, videos and blogs,
and the chance to interact with fellow engineers from all over the world.
With a broad selection of product solutions, end application possibilities, and the range of technical
support, Texas Instruments offers the broadest low-power RF portfolio. We make RF easy!
The following subsections point to where to find more information.
References
Revision History
NOTE: Page numbers for previous revisions may differ from page numbers in the current version.
NOTE: Page numbers for previous revisions may differ from page numbers in the current version.
Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265
Copyright © 2014, Texas Instruments Incorporated