EFM8 Universal Bee Family
EFM8UB3 Reference Manual
The EFM8UB3, part of the Universal Bee family of MCUs, is a
multi-purpose line of 8-bit microcontrollers with USB feature set in
small packages.
These devices offer high value by integrating an innovative energy-smart USB peripheral
interface, charger detect circuit, 8 kV ESD protection, and enhanced high speed communication interfaces into small packages, making them ideal for space-constrained USB
applications. With an efficient 8051 core and precision analog, the EFM8UB3 family is
also optimal for embedded applications.
EFM8UB3 applications include the following:
• USB I/O controls
• Docking stations/USB hubs
• Dongles
Core / MemoryClock Management
CIP-51 8051 Core
(48 MHz)
Flash Memory
40 KB
RAM Memory
3328 bytes
• Consumer electronics
• USB Type-C converters
• USB Type-C billboard/alternate mode
External CMOS
Oscillator
Debug Interface
with C2
Low Frequency
RC Oscillator
High Frequency
48 MHz RC
Oscillator
High Frequency
24.5 MHz RC
Oscillator
KEY FEATURES
• Pipelined 8-bit C8051 core with 48 MHz
maximum operating frequency
• Up to 17 multifunction I/O pins
• Low Energy USB with full- and low-speed
support saves up to 90% of the USB
energy
• USB charger detect circuit (USB-BCS 1.2
compliant)
• One 12-bit ADC and two analog
comparators with internal voltage DAC as
reference input
• Six 16-bit timers
• UART and SMBus master/slave
• Priority crossbar for flexible pin mapping
Energy Management
Internal LDO
Regulator
Brown-Out
Detector
Power-On Reset
5 V-to 3.3 V LDO
Regulator
8-bit SFR bus
Serial InterfacesTimers and TriggersAnalog Interfaces
UART
SMBus
Lowest power mode with peripheral operational:
silabs.com | Building a more connected world.Rev. 0.2
USB
SPI
IdleNormalShutdownSuspendSnooze
External
Interrupts
General
Purpose I/O
Pin Reset
Pin Wakeup
Timers
0/1/2
Watchdog
Timer
4 x Configurable Logic Units
PCA/PWM
Timer 3/4/5
ADC
Internal Voltage
Reference
Charger Det
Comparator 1
Comparator 0
SecurityI/O Ports
16-bit CRC
Page 2
Table of Contents
1. System Overview .............................13
silabs.com | Building a more connected world.Rev. 0.2 | 12
Page 13
1. System Overview
1.1 Introduction
EFM8UB3 Reference Manual
System Overview
C2CK/RSTb
VDD
VREGIN
GND
D+
VBUS
CIP-51 8051 Controller
C2D
Programming
Power-On
Independent
Watchdog
Timer
Debug /
Hardware
Reset
Reset
Supply
Monitor
Core
40 KB ISP Flash
Program Memory
256 Byte SRAM
2048 Byte XRAM
SYSCLK
System Clock
Configuration
EXTCLK
Voltage
Regulators
Power
Net
Low Freq.
Oscillator
CMOS Oscillator
Input
48 MHz 1.5%
Oscillator
Clock
Recovery
24.5 MHz 2%
Oscillator
SFR
Bus
USB Peripheral
D-
Full / Low
Speed
Transceiver
1 KB RAMLow Power
Controller
Charge
Detection
Port I/O Configuration
Digital Peripherals
UART1
Timers 0,
1, 2, 3, 4, 5
3-ch PCA
I2C /
SMBus
SPI
CRC
Config.
Logic
Units (4)
Analog Peripherals
Internal
Reference
VREFVDD
12/10 bit
ADC
2 Comparators
Priority
Crossbar
Decoder
Crossbar
Control
AMUX
Sensor
+
+
-
-
VDD
Temp
Port 0
Drivers
Port 1
Drivers
Port 2
Drivers
P0.n
P1.n
P2.n
Figure 1.1. Detailed EFM8UB3 Block Diagram
This section describes the EFM8UB3 family at a high level.
For more information on the device packages and pinout, electrical specifications, and typical connection diagrams, see the EFM8UB3
Data Sheet. For more information on each module including register definitions, see the EFM8UB3 Reference Manual. For more information on any errata, see the EFM8UB3 Errata.
silabs.com | Building a more connected world.Rev. 0.2 | 13
Page 14
EFM8UB3 Reference Manual
System Overview
1.2 Power
Control over the device power consumption can be achieved by enabling/disabling individual peripherals as needed. Each analog peripheral can be disabled when not in use and placed in low power mode. Digital peripherals, such as timers and serial buses, have their
clocks gated off and draw little power when they are not in use.
Table 1.1. Power Modes
Power ModeDetailsMode EntryWake-Up Sources
NormalCore and all peripherals clocked and fully operational——
Idle• Core halted
• All peripherals clocked and fully operational
• Code resumes execution on wake event
Suspend• Core and peripheral clocks halted
• HFOSC0 and HFOSC1 oscillators stopped
• Regulators in normal bias mode for fast wake
• Timer 3 and 4 may clock from LFOSC0
• Code resumes execution on wake event
Stop• All internal power nets shut down
• 5V regulator remains active (if enabled)
• Internal 1.8 V LDO on
• Pins retain state
• Exit on any reset source
Snooze• Core and peripheral clocks halted
• HFOSC0 and HFOSC1 oscillators stopped
• Regulators in low bias current mode for energy savings
• Timer 3 and 4 may clock from LFOSC0
• Code resumes execution on wake event
Set IDLE bit in PCON0Any interrupt
1. Switch SYSCLK to
HFOSC0
2. Set SUSPEND bit in
PCON1
• USB0 Bus Activity
• Timer 4 Event
• SPI0 Activity
• Port Match Event
• Comparator 0 Falling
Edge
• CLUn Interrupt-Enabled
Event
1. Clear STOPCF bit in
Any reset source
REG0CN
2. Set STOP bit in
PCON0
1. Switch SYSCLK to
HFOSC0
2. Set SNOOZE bit in
PCON1
• USB0 Bus Activity
• Timer 4 Event
• SPI0 Activity
• Port Match Event
• Comparator 0 Falling
Edge
• CLUn Interrupt-Enabled
Event
Shutdown• All internal power nets shut down
• 5V regulator remains active (if enabled)
• Internal 1.8 V LDO off to save energy
• Pins retain state
1. Set STOPCF bit in
REG0CN
2. Set STOP bit in
PCON0
• RSTb pin reset
• Power-on reset
• Exit on pin or power-on reset
1.3 I/O
Digital and analog resources are externally available on the device’s multi-purpose I/O pins. Port pins P0.0-P1.6 can be defined as general-purpose I/O (GPIO), assigned to one of the internal digital resources through the crossbar or dedicated channels, or assigned to an
analog function. Port pins P2.0 and P2.1 can be used as GPIO. Additionally, the C2 Interface Data signal (C2D) is shared with P2.0.
The port control block offers the following features:
• Up to 17 multi-functions I/O pins, supporting digital and analog functions.
• Flexible priority crossbar decoder for digital peripheral assignment.
• Two drive strength settings for each port.
• Two direct-pin interrupt sources with dedicated interrupt vectors (INT0 and INT1).
• Up to 17 direct-pin interrupt sources with shared interrupt vector (Port Match).
silabs.com | Building a more connected world.Rev. 0.2 | 14
Page 15
EFM8UB3 Reference Manual
System Overview
1.4 Clocking
The CPU core and peripheral subsystem may be clocked by both internal and external oscillator resources. By default, the system
clock comes up running from the 24.5 MHz oscillator divided by 8.
The clock control system offers the following features:
• Provides clock to core and peripherals.
• 24.5 MHz internal oscillator (HFOSC0), accurate to ±2% over supply and temperature corners.
• 48 MHz internal oscillator (HFOSC1), accurate to ±1.5% over supply and temperature corners.
• 80 kHz low-frequency oscillator (LFOSC0).
• External CMOS clock input (EXTCLK).
• Clock divider with eight settings for flexible clock scaling:
• Divide the selected clock source by 1, 2, 4, 8, 16, 32, 64, or 128.
• HFOSC0 and HFOSC1 include 1.5x pre-scalers for further flexibility.
1.5 Counters/Timers and PWM
Programmable Counter Array (PCA0)
The programmable counter array (PCA) provides multiple channels of enhanced timer and PWM functionality while requiring less CPU
intervention than standard counter/timers. The PCA consists of a dedicated 16-bit counter/timer and one 16-bit capture/compare module for each channel. The counter/timer is driven by a programmable timebase that has flexible external and internal clocking options.
Each capture/compare module may be configured to operate independently in one of five modes: Edge-Triggered Capture, Software
Timer, High-Speed Output, Frequency Output, or Pulse-Width Modulated (PWM) Output. Each capture/compare module has its own
associated I/O line (CEXn) which is routed through the crossbar to port I/O when enabled.
• 16-bit time base
• Programmable clock divisor and clock source selection
• Up to three independently-configurable channels
• 8, 9, 10, 11 and 16-bit PWM modes (center or edge-aligned operation)
• Output polarity control
• Frequency output mode
• Capture on rising, falling or any edge
• Compare function for arbitrary waveform generation
• Software timer (internal compare) mode
• Can accept hardware “kill” signal from comparator 0 or comparator 1
silabs.com | Building a more connected world.Rev. 0.2 | 15
Several counter/timers are included in the device: two are 16-bit counter/timers compatible with those found in the standard 8051, and
the rest are 16-bit auto-reload timers for timing peripherals or for general purpose use. These timers can be used to measure time intervals, count external events and generate periodic interrupt requests. Timer 0 and Timer 1 are nearly identical and have four primary
modes of operation. The other timers offer both 16-bit and split 8-bit timer functionality with auto-reload and capture capabilities.
Timer 0 and Timer 1 include the following features:
• Standard 8051 timers, supporting backwards-compatibility with firmware and hardware.
• Clock sources include SYSCLK, SYSCLK divided by 12, 4, or 48, the External Clock divided by 8, or an external pin.
• 8-bit auto-reload counter/timer mode
• 13-bit counter/timer mode
• 16-bit counter/timer mode
• Dual 8-bit counter/timer mode (Timer 0)
Timer 2, Timer 3, Timer 4, and Timer 5 are 16-bit timers including the following features:
• Clock sources for all timers include SYSCLK, SYSCLK divided by 12, or the External Clock divided by 8
• LFOSC0 divided by 8 may be used to clock Timer 3 and Timer 4 in active or suspend/snooze power modes
• Timer 4 is a low-power wake source, and can be chained together with Timer 3
• 16-bit auto-reload timer mode
• Dual 8-bit auto-reload timer mode
• External pin capture
• LFOSC0 capture
• Comparator 0 capture
• USB Start-of-Frame (SOF) capture
• Configurable Logic output capture
Watchdog Timer (WDT0)
The device includes a programmable watchdog timer (WDT) running off the low-frequency oscillator. A WDT overflow forces the MCU
into the reset state. To prevent the reset, the WDT must be restarted by application software before overflow. If the system experiences
a software or hardware malfunction preventing the software from restarting the WDT, the WDT overflows and causes a reset. Following
a reset, the WDT is automatically enabled and running with the default maximum time interval. If needed, the WDT can be disabled by
system software or locked on to prevent accidental disabling. Once locked, the WDT cannot be disabled until the next system reset.
The state of the RST pin is unaffected by this reset.
The Watchdog Timer has the following features:
• Programmable timeout interval
• Runs from the low-frequency oscillator
• Lock-out feature to prevent any modification until a system reset
silabs.com | Building a more connected world.Rev. 0.2 | 16
Page 17
EFM8UB3 Reference Manual
System Overview
1.6 Communications and Other Digital Peripherals
Universal Serial Bus (USB0)
The USB0 peripheral provides a full-speed USB 2.0 compliant device controller and PHY with additional Low Energy USB features. The
device supports both full-speed (12MBit/s) and low speed (1.5MBit/s) operation, and includes a dedicated USB oscillator with clock recovery mechanism for crystal-free operation. No external components are required. The USB function controller (USB0) consists of a
Serial Interface Engine (SIE), USB transceiver (including matching resistors and configurable pull-up resistors), and 1 KB FIFO block.
The Low Energy Mode ensures the current consumption is optimized and enables USB communication on a strict power budget.
The USB0 module includes the following features:
• Full and Low Speed functionality.
• Implements 4 bidirectional endpoints.
• Low Energy Mode to reduce active supply current based on bus bandwidth.
• USB 2.0 compliant USB peripheral support (no host capability).
• Direct module access to 1 KB of RAM for FIFO memory.
• Clock recovery to meet USB clocking requirements with no external components.
• Charger detection circuitry with automatic detection of SDP, CDP, and DCP interfaces.
• D+ and D- can be routed to ADC input to support ACM and proprietary charger architectures.
UART1 is an asynchronous, full duplex serial port offering a variety of data formatting options. A dedicated baud rate generator with a
16-bit timer and selectable prescaler is included, which can generate a wide range of baud rates. A received data FIFO allows UART1
to receive multiple bytes before data is lost and an overflow occurs.
UART1 provides the following features:
• Asynchronous transmissions and receptions.
• Dedicated baud rate generator supports baud rates up to SYSCLK/2 (transmit) or SYSCLK/8 (receive).
• 5, 6, 7, 8, or 9 bit data.
• Automatic start and stop generation.
• Automatic parity generation and checking.
• Four byte FIFO on transmit and receive.
• Auto-baud detection.
• LIN break and sync field detection.
• CTS / RTS hardware flow control.
Serial Peripheral Interface (SPI0)
The serial peripheral interface (SPI) module provides access to a flexible, full-duplex synchronous serial bus. The SPI can operate as a
master or slave device in both 3-wire or 4-wire modes, and supports multiple masters and slaves on a single SPI bus. The slave-select
(NSS) signal can be configured as an input to select the SPI in slave mode, or to disable master mode operation in a multi-master
environment, avoiding contention on the SPI bus when more than one master attempts simultaneous data transfers. NSS can also be
configured as a firmware-controlled chip-select output in master mode, or disabled to reduce the number of pins required. Additional
general purpose port I/O pins can be used to select multiple slave devices in master mode.
• Supports 3- or 4-wire master or slave modes.
• Supports external clock frequencies up to 12 Mbps in master or slave mode.
• Support for all clock phase and polarity modes.
• 8-bit programmable clock rate (master).
• Programmable receive timeout (slave).
• Two byte FIFO on transmit and receive.
• Can operate in suspend or snooze modes and wake the CPU on reception of a byte.
• Support for multiple masters on the same data lines.
silabs.com | Building a more connected world.Rev. 0.2 | 17
Page 18
EFM8UB3 Reference Manual
System Overview
System Management Bus / I2C (SMB0)
The SMBus I/O interface is a two-wire, bi-directional serial bus. The SMBus is compliant with the System Management Bus Specification, version 1.1, and compatible with the I2C serial bus.
The SMBus module includes the following features:
• Standard (up to 100 kbps), Fast (400 kbps), and Fast Mode Plus (1 Mbps) transfer speeds
• Support for master, slave, and multi-master modes
• Hardware synchronization and arbitration for multi-master mode
• Clock low extending (clock stretching) to interface with faster masters
• Hardware support for 7-bit slave and general call address recognition
• Firmware support for 10-bit slave address decoding
• Ability to inhibit all slave states
• Programmable data setup/hold times
• Transmit and receive FIFOs (two-byte) to help increase throughput in faster applications
16-bit CRC (CRC0)
The cyclic redundancy check (CRC) module performs a CRC using a 16-bit polynomial. CRC0 accepts a stream of 8-bit data and posts
the 16-bit result to an internal register. In addition to using the CRC block for data manipulation, hardware can automatically CRC the
flash contents of the device.
The CRC module is designed to provide hardware calculations for flash memory verification and communications protocols. The CRC
module supports the standard CCITT-16 16-bit polynomial (0x1021), and includes the following features:
• Support for CCITT-16 polynomial
• Byte-level bit reversal
• Automatic CRC of flash contents on one or more 256-byte blocks
• Initial seed selection of 0x0000 or 0xFFFF
Configurable Logic Units (CLU0, CLU1, CLU2, and CLU3)
The Configurable Logic block consists of multiple Configurable Logic Units (CLUs). CLUs are flexible logic functions which may be used
for a variety of digital functions, such as replacing system glue logic, aiding in the generation of special waveforms, or synchronizing
system event triggers.
• Four configurable logic units (CLUs), with direct-pin and internal logic connections
• Each unit supports 256 different combinatorial logic functions (AND, OR, XOR, muxing, etc.) and includes a clocked flip-flop for synchronous operations
• Units may be operated synchronously or asynchronously
• May be cascaded together to perform more complicated logic functions
• Can operate in conjunction with serial peripherals such as UART and SPI or timing peripherals such as timers and PCA channels
• Can be used to synchronize and trigger multiple on-chip resources (ADC, Timers, etc.)
• Asynchronous output may be used to wake from low-power states
silabs.com | Building a more connected world.Rev. 0.2 | 18
Page 19
EFM8UB3 Reference Manual
System Overview
1.7 Analog
12-Bit Analog-to-Digital Converter (ADC0)
The ADC is a successive-approximation-register (SAR) ADC with 12-, 10-, and 8-bit modes, integrated track-and hold and a programmable window detector. The ADC is fully configurable under software control via several registers. The ADC may be configured to
measure different signals using the analog multiplexer. The voltage reference for the ADC is selectable between internal and external
reference sources.
• Up to 16 external inputs.
• Single-ended 12-bit and 10-bit modes.
• Supports an output update rate of 200 ksps samples per second in 12-bit mode or 800 ksps samples per second in 10-bit mode.
• Operation in low power modes at lower conversion speeds.
• Asynchronous hardware conversion trigger, selectable between software, external I/O, internal timer sources, and configurable logic
(CLU) sources.
• Output data window comparator allows automatic range checking.
• Support for burst mode, which produces one set of accumulated data per conversion-start trigger with programmable power-on settling and tracking time.
• Conversion complete and window compare interrupts supported.
• Flexible output data formatting.
• Includes an internal fast-settling reference with two levels (1.65 V and 2.4 V) and support for external reference and signal ground.
• Integrated temperature sensor.
Low Current Comparators (CMP0, CMP1)
Analog comparators are used to compare the voltage of two analog inputs, with a digital output indicating which input voltage is higher.
External input connections to device I/O pins and internal connections are available through separate multiplexers on the positive and
negative inputs. Hysteresis, response time, and current consumption may be programmed to suit the specific needs of the application.
The comparator includes the following features:
• Up to 8 (CMP0) or 8 (CMP1) external positive inputs
• Up to 8 (CMP0) or 8 (CMP1) external negative inputs
• Additional input options:
• Internal connection to LDO output
• Direct connection to GND
• Direct connection to VDD
• Dedicated 6-bit reference DAC
• Synchronous and asynchronous outputs can be routed to pins via crossbar
• Programmable hysteresis between 0 and ±20 mV
• Programmable response time
• Interrupts generated on rising, falling, or both edges
• PWM output kill feature
silabs.com | Building a more connected world.Rev. 0.2 | 19
Page 20
EFM8UB3 Reference Manual
System Overview
1.8 Reset Sources
Reset circuitry allows the controller to be easily placed in a predefined default condition. On entry to this reset state, the following occur:
• The core halts program execution.
• Module registers are initialized to their defined reset values unless the bits reset only with a power-on reset.
• External port pins are forced to a known state.
• Interrupts and timers are disabled.
All registers are reset to the predefined values noted in the register descriptions unless the bits only reset with a power-on reset. The
contents of RAM are unaffected during a reset; any previously stored data is preserved as long as power is not lost. The Port I/O latches are reset to 1 in open-drain mode. Weak pullups are enabled during and after the reset. For Supply Monitor and power-on resets,
the RSTb pin is driven low until the device exits the reset state. On exit from the reset state, the program counter (PC) is reset, and the
system clock defaults to an internal oscillator. The Watchdog Timer is enabled, and program execution begins at location 0x0000.
Reset sources on the device include:
• Power-on reset
• External reset pin
• Comparator reset
• Software-triggered reset
• Supply monitor reset (monitors VDD supply)
• Watchdog timer reset
• Missing clock detector reset
• Flash error reset
• USB reset
1.9 Debugging
The EFM8UB3 devices include an on-chip Silicon Labs 2-Wire (C2) debug interface to allow flash programming and in-system debugging with the production part installed in the end application. The C2 interface uses a clock signal (C2CK) and a bi-directional C2 data
signal (C2D) to transfer information between the device and a host system. See the C2 Interface Specification for details on the C2
protocol.
silabs.com | Building a more connected world.Rev. 0.2 | 20
Page 21
EFM8UB3 Reference Manual
System Overview
1.10 Bootloader
All devices come pre-programmed with a USB bootloader. This bootloader resides in the code security page and last pages of code
flash; it can be erased if it is not needed.
The byte before the Lock Byte is the Bootloader Signature Byte. Setting this byte to a value of 0xA5 indicates the presence of the bootloader in the system. Any other value in this location indicates that the bootloader is not present in flash.
When a bootloader is present, the device will jump to the bootloader vector after any reset, allowing the bootloader to run. The bootloader then determines if the device should stay in bootload mode or jump to the reset vector located at 0x0000. When the bootloader
is not present, the device will jump to the reset vector of 0x0000 after any reset.
More information about the bootloader protocol and usage can be found in AN945: EFM8 Factory Bootloader User Guide. Application
notes can be found on the Silicon Labs website (www.silabs.com/8bit-appnotes) or within Simplicity Studio in the [Documentation]
area.
0xFFFF
0xFFC0
0xFBFF
0xFBFE
0xFBFD
0xFA00
0x9DFF
0x9A00
Read-Only
64 Bytes
Reserved
Lock Byte
Bootloader Signature Byte
Security Page
512 Bytes
Reserved
Bootloader
Bootloader Vector
Bootloader
Memory Lock
Read-Only
64 Bytes
128-bit UUID
0xFFFF
0xFFFE
0xFFD0
0xFFCF
0xFFC0
40 KB Flash
(79 x 512 Byte pages)
0x0000
Figure 1.2. Flash Memory Map with Bootloader—40 KB Devices
Table 1.2. Summary of Pins for Bootloader Communication
BootloaderPins for Bootload Communication
USBVBUS
silabs.com | Building a more connected world.Rev. 0.2 | 21
Reset Vector
D+
D-
Page 22
EFM8UB3 Reference Manual
Table 1.3. Summary of Pins for Bootload Mode Entry
Device PackagePin for Bootload Mode Entry
QFN24P2.0 / C2D
QSOP24P2.0 / C2D
QFN20P2.0 / C2D
System Overview
silabs.com | Building a more connected world.Rev. 0.2 | 22
Page 23
EFM8UB3 Reference Manual
Memory
2. Memory
2.1 Memory Organization
The memory organization of the CIP-51 System Controller is similar to that of a standard 8051. There are two separate memory
spaces: program memory and data memory. Program and data memory share the same address space but are accessed via different
instruction types. Program memory consists of a non-volatile storage area that may be used for either program code or non-volatile
data storage. The data memory, consisting of "internal" and "external" data space, is implemented as RAM, and may be used only for
data storage. Program execution is not supported from the data memory space.
2.2 Program Memory
The CIP-51 core has a 64 KB program memory space. The product family implements some of this program memory space as in-system, re-programmable flash memory. Flash security is implemented by a user-programmable location in the flash block and provides
read, write, and erase protection. All addresses not specified in the device memory map are reserved and may not be used for code or
data storage.
MOVX Instruction and Program Memory
The MOVX instruction in an 8051 device is typically used to access external data memory. On the devices, the MOVX instruction is
normally used to read and write on-chip XRAM, but can be re-configured to write and erase on-chip flash memory space. MOVC instructions are always used to read flash memory, while MOVX write instructions are used to erase and write flash. This flash access
feature provides a mechanism for the product to update program code and use the program memory space for non-volatile data storage.
2.3 Data Memory
The RAM space on the chip includes both an "internal" RAM area which is accessed with MOV instructions, and an on-chip "external"
RAM area which is accessed using MOVX instructions. Total RAM varies, based on the specific device. The device memory map has
more details about the specific amount of RAM available in each area for the different device variants.
Internal RAM
There are 256 bytes of internal RAM mapped into the data memory space from 0x00 through 0xFF. The lower 128 bytes of data memory are used for general purpose registers and scratch pad memory. Either direct or indirect addressing may be used to access the lower
128 bytes of data memory. Locations 0x00 through 0x1F are addressable as four banks of general purpose registers, each bank consisting of eight byte-wide registers. The next 16 bytes, locations 0x20 through 0x2F, may either be addressed as bytes or as 128 bit
locations accessible with the direct addressing mode.
The upper 128 bytes of data memory are accessible only by indirect addressing. This region occupies the same address space as the
Special Function Registers (SFR) but is physically separate from the SFR space. The addressing mode used by an instruction when
accessing locations above 0x7F determines whether the CPU accesses the upper 128 bytes of data memory space or the SFRs. Instructions that use direct addressing will access the SFR space. Instructions using indirect addressing above 0x7F access the upper
128 bytes of data memory.
General Purpose Registers
The lower 32 bytes of data memory, locations 0x00 through 0x1F, may be addressed as four banks of general-purpose registers. Each
bank consists of eight byte-wide registers designated R0 through R7. Only one of these banks may be enabled at a time. Two bits in
the program status word (PSW) register, RS0 and RS1, select the active register bank. This allows fast context switching when entering
subroutines and interrupt service routines. Indirect addressing modes use registers R0 and R1 as index registers.
silabs.com | Building a more connected world.Rev. 0.2 | 23
Page 24
EFM8UB3 Reference Manual
Memory
Bit Addressable Locations
In addition to direct access to data memory organized as bytes, the sixteen data memory locations at 0x20 through 0x2F are also accessible as 128 individually addressable bits. Each bit has a bit address from 0x00 to 0x7F. Bit 0 of the byte at 0x20 has bit address
0x00 while bit 7 of the byte at 0x20 has bit address 0x07. Bit 7 of the byte at 0x2F has bit address 0x7F. A bit access is distinguished
from a full byte access by the type of instruction used (bit source or destination operands as opposed to a byte source or destination).
The MCS-51™ assembly language allows an alternate notation for bit addressing of the form XX.B where XX is the byte address and B
is the bit position within the byte. For example, the instruction:
Mov C, 22.3h
moves the Boolean value at 0x13 (bit 3 of the byte at location 0x22) into the Carry flag.
Stack
A programmer's stack can be located anywhere in the 256-byte data memory. The stack area is designated using the Stack Pointer
(SP) SFR. The SP will point to the last location used. The next value pushed on the stack is placed at SP+1 and then SP is incremented. A reset initializes the stack pointer to location 0x07. Therefore, the first value pushed on the stack is placed at location 0x08, which
is also the first register (R0) of register bank 1. Thus, if more than one register bank is to be used, the SP should be initialized to a
location in the data memory not being used for data storage. The stack depth can extend up to 256 bytes.
External RAM
On devices with more than 256 bytes of on-chip RAM, the additional RAM is mapped into the external data memory space (XRAM).
Addresses in XRAM area accessed using the external move (MOVX) instructions.
Note: The 16-bit MOVX write instruction is also used for writing and erasing the flash memory. More details may be found in the flash
memory section.
silabs.com | Building a more connected world.Rev. 0.2 | 24
Page 25
2.4 Memory Map
EFM8UB3 Reference Manual
Memory
0xFFFF
0xFFC0
0xFBFF
0xFBFE
0xFBFD
0xFA00
0x9DFF
0x9A00
Read-Only
64 Bytes
Reserved
Lock Byte
Bootloader Signature Byte
Security Page
512 Bytes
Reserved
Bootloader
Bootloader Vector
Bootloader
Memory Lock
Read-Only
64 Bytes
128-bit UUID
0xFFFF
0xFFFE
0xFFD0
0xFFCF
0xFFC0
0x0000
40 KB Flash
(79 x 512 Byte pages)
Reset Vector
Figure 2.1. Flash Memory Map — 40 KB Devices
silabs.com | Building a more connected world.Rev. 0.2 | 25
Page 26
0xFF
EFM8UB3 Reference Manual
Memory
On-Chip RAM
Accessed with MOV Instructions as Indicated
Upper 128 Bytes
RAM
(Indirect Access)
0x80
0x7F
Lower 128 Bytes RAM
(Direct or Indirect Access)
0x30
0x2F
0x20
0x1F
0x00
Figure 2.2. Direct / Indirect RAM Memory
General-Purpose Register Banks
Bit-Addressable
On-Chip XRAM
Accessed with MOVX Instructions
Special Function
Registers
(Direct Access)
0xFFFF
0x0C00
0x0BFF
0x0800
0x07FF
0x0000
Shadow XRAM
Duplicates 0x0000-0x0BFF
On 3 KB boundaries
USB FIFO XRAM
1024 Bytes
(USBCLK Domain)
XRAM
2048 Bytes
(SYSCLK Domain)
Figure 2.3. XRAM Memory
silabs.com | Building a more connected world.Rev. 0.2 | 26
Page 27
EFM8UB3 Reference Manual
2.5 XRAM Control Registers
2.5.1 EMI0CN: External Memory Interface Control
Bit76543210
NameReservedPGSEL
AccessRRW
Reset0x00x0
SFR Page = ALL; SFR Address: 0xE7
BitNameResetAccess Description
7:4ReservedMust write reset value.
3:0PGSEL0x0RWXRAM Page Select.
The XRAM Page Select field provides the high byte of the 16-bit data memory address when using 8-bit MOVX commands,
effectively selecting a 256-byte page of RAM. Since the upper (unused) bits of the register are always zero, the PGSEL
field determines which page of XRAM is accessed.
For example, if PGSEL = 0x01, addresses 0x0100 to 0x01FF will be accessed by 8-bit MOVX instructions.
Memory
silabs.com | Building a more connected world.Rev. 0.2 | 27
Page 28
EFM8UB3 Reference Manual
Special Function Registers
3. Special Function Registers
3.1 Special Function Register Access
The direct-access data memory locations from 0x80 to 0xFF constitute the special function registers (SFRs). The SFRs provide control
and data exchange with the CIP-51's resources and peripherals. The CIP-51 duplicates the SFRs found in a typical 8051 implementation as well as implementing additional SFRs used to configure and access the sub-systems unique to the MCU. This allows the addi-
tion of new functionality while retaining compatibility with the MCS-51 ™ instruction set.
The SFR registers are accessed anytime the direct addressing mode is used to access memory locations from 0x80 to 0xFF. SFRs
with addresses ending in 0x0 or 0x8 (e.g., P0, TCON, SCON0, IE, etc.) are bit-addressable as well as byte-addressable. All other SFRs
are byte-addressable only. Unoccupied addresses in the SFR space are reserved for future use. Accessing these areas will have an
indeterminate effect and should be avoided.
SFR Paging
The CIP-51 features SFR paging, allowing the device to map many SFRs into the 0x80 to 0xFF memory address space. The SFR
memory space has 256 pages. In this way, each memory location from 0x80 to 0xFF can access up to 256 SFRs. The EFM8UB3
devices utilize multiple SFR pages. All of the common 8051 SFRs are available on all pages. Certain SFRs are only available on a
subset of pages. SFR pages are selected using the SFRPAGE register. The procedure for reading and writing an SFR is as follows:
1. Select the appropriate SFR page using the SFRPAGE register.
2. Use direct accessing mode to read or write the special function register (MOV instruction).
The SFRPAGE register only needs to be changed in the case that the SFR to be accessed does not exist on the currently-selected
page. See the SFR memory map for details on the locations of each SFR.
silabs.com | Building a more connected world.Rev. 0.2 | 28
Page 29
EFM8UB3 Reference Manual
Special Function Registers
Interrupts and the SFR Page Stack
When an interrupt occurs, the current SFRPAGE is pushed onto an SFR page stack to preserve the current context of SFRPAGE.
Upon execution of the RETI instruction, the SFRPAGE register is automatically restored to the SFR page that was in use prior to the
interrupt. The stack is five elements deep to accomodate interrupts of different priority levels pre-empting lower priority interrupts. Firmware can read any element of the SFR page stack by setting the SFRPGIDX field in the SFRPGCN register and reading the
SFRSTACK register.
Table 3.1. SFR Page Stack Access
SFRPGIDX ValueSFRSTACK Contains
0Value of the first/top byte of the stack
1Value of the second byte of the stack
2Value of the third byte of the stack
3Value of the fourth byte of the stack
4Value of the fifth/bottom byte of the stack
Notes:
1. The top of the stack is the current SFRPAGE setting, and can also be directly accessed via the SFRPAGE register.
SFRPGEN
Interrupt
Logic
SFR Page
SFRPAGE
SFRPGIDX
000
001
010
SFRSTACK
Stack
011
100
Figure 3.1. SFR Page Stack Block Diagram
When an interrupt occurs, hardware performs the following operations:
1. The value (if any) in the SFRPGIDX = 011b location is pushed to the SFRPAGE = 100b location.
2. The value (if any) in the SFRPGIDX = 010b location is pushed to the SFRPAGE = 011b location.
3. The value (if any) in the SFRPGIDX = 001b location is pushed to the SFRPAGE = 010b location.
4. The current SFRPAGE value is pushed to the SFRPGIDX = 001b location in the stack.
5. SFRPAGE is set to the page associated with the flag that generated the interrupt.
On a return from interrupt, hardware performs the following operations:
1. The SFR page stack is popped to the SFRPAGE register. This restores the SFR page context prior to the interrupt, without software intervention.
2. The value in the SFRPGIDX = 010b location of the stack is placed in the SFRPGIDX = 001b location.
3. The value in the SFRPGIDX = 011b location of the stack is placed in the SFRPGIDX = 010b location.
4. The value in the SFRPGIDX = 100b location of the stack is placed in the SFRPGIDX = 011b location.
Automatic hardware switching of the SFR page upon interrupt entries and exits may be enabled or disabled using the SFRPGEN located in SFRPGCN. Automatic SFR page switching is enabled after any reset.
silabs.com | Building a more connected world.Rev. 0.2 | 29
Page 30
EFM8UB3 Reference Manual
Special Function Registers
3.2 Special Function Register Memory Map
Table 3.2. Special Function Registers by Address
AddressSFR PageAddressSFR Page
(*bit-addressable)
0x000x100x20(*bit-address-
able)
0x000x100x20
0x80*P00xC0*SMB0CN0TMR5CN0SMB0CN0
0x81SP0xC1SMB0CFPFE0CNSMB0CF
0x82DPL0xC2SMB0DAT-SMB0DAT
0x83DPH0xC3ADC0GTLSMB0FCN0
0x84-CLU0MX0xC4ADC0GTHSMB0FCN1
0x85IT01CFCLU1MX0xC5ADC0LTLSMB0RXLN
0x86CRC0CN1-CRC0CN10xC6ADC0LTHREG1CN
0x87PCON00xC7HFO0CALCLU3FN
0x88*TCON0xC8*TMR2CN0-
0x89TMOD0xC9REG0CN-REG0CN
0x8ATL00xCATMR2RLLCLU3CF
0x8BTL10xCBTMR2RLHCLEN0
0x8CTH00xCCTMR2L-
0x8DTH10xCDTMR2HCLIE0
0x8ECKCON00xCECRC0CN0EIE2CRC0CN0
0x8FPSCTL0xCFCRC0FLIPSFRPGCNCRC0FLIP
0x90*P10xD0*PSW
0x91TMR3CN0CLU2MX0xD1REF0CN-
0x92TMR3RLLCLU3MX0xD2CRC0STTMR5RLLCRC0ST
0x93TMR3RLHSMOD10xD3CRC0CNTTMR5RLHCRC0CNT
0x94TMR3LSBCON10xD4P0SKIPTMR5LP0SKIP
0x95TMR3HSBRLL10xD5P1SKIPTMR5HP1SKIP
0x96PCA0POLSBRLH10xD6SMB0ADMHFO1CALSMB0ADM
0x97WDTCN0xD7SMB0ADRSFRSTACKSMB0ADR
0x98*SCON1TMR4CN0SCON10xD8*PCA0CN0UART1FCN1
0x99SBUF1CMP0CN1SBUF10xD9PCA0MDCLOUT0
0x9A-SPI0FCN00xDAPCA0CPM0UART1PCF
0x9BCMP0CN0SPI0FCN10xDBPCA0CPM1-
0x9CPCA0CLR-0xDCPCA0CPM2-
0x9DCMP0MDUART1FCN00xDDCRC0IN-CRC0IN
0x9EPCA0CENTUART1LIN0xDECRC0DAT-CRC0DAT
0x9FCMP0MX-0xDFADC0PWRSPI0PCF
silabs.com | Building a more connected world.Rev. 0.2 | 30
Page 31
EFM8UB3 Reference Manual
Special Function Registers
AddressSFR PageAddressSFR Page
(*bit-addressable)
0x000x100x20(*bit-address-
able)
0x000x100x20
0xA0*P20xE0*ACC
0xA1SPI0CFG-SPI0CFG0xE1XBR0-XBR0
0xA2SPI0CKRTMR4RLLSPI0CKR0xE2XBR1-XBR1
0xA3SPI0DATTMR4RLHSPI0DAT0xE3XBR2-XBR2
0xA4P0MDOUTTMR4LP0MDOUT0xE4PCON1
0xA5P1MDOUTTMR4HP1MDOUT0xE5-
0xA6P2MDOUTCKCON1P2MDOUT0xE6EIE1-
0xA7SFRPAGE0xE7EMI0CN
0xA8*IE0xE8*ADC0CN0CLIF0
0xA9CLKSEL0xE9PCA0CPL1-
0xAACMP1MX-0xEAPCA0CPH1-
0xABCMP1MD-0xEBPCA0CPL2-
0xACSMB0TCCMP1CN1SMB0TC0xECPCA0CPH2-
0xADDERIVIDPSTAT0CLU0FN0xEDP1MAT-P1MAT
0xAEUSB0ADR0xEEP1MASK-P1MASK
0xAFUSB0DAT0xEFRSTSRCHFOCNSMB0FCT
0xB0*-0xF0*B
0xB1LFO0CNCLU0CF0xF1P0MDINTMR5CN1P0MDIN
0xB2ADC0CN1USB0AEC0xF2P1MDINIPHP1MDIN
0xB3ADC0ACUSB0XCN0xF3EIP1P2MDIN
0xB4-0xF4-EIP2-
0xB5DEVICEID-USB0CF0xF5-EIP1H-
0xB6REVID-USB0CDCF0xF6PRTDRVEIP2HPRTDRV
0xB7FLKEY0xF7PCA0PWMSPI0FCT
0xB8*IP0xF8*SPI0CN0-SPI0CN0
0xB9ADC0TKCLU1FN0xF9PCA0L-
0xBA-0xFAPCA0HUART1FCT
0xBBADC0MXCLU1CF0xFBPCA0CPL0P2MAT
0xBCADC0CFCLU2FN0xFCPCA0CPH0P2MASK
0xBDADC0LCLU2CF0xFDP0MATTMR2CN1P0MAT
0xBEADC0HUSB0CDCN0xFEP0MASKTMR3CN1P0MASK
silabs.com | Building a more connected world.Rev. 0.2 | 31
silabs.com | Building a more connected world.Rev. 0.2 | 34
Page 35
Special Function Registers
RegisterAddress SFR PagesDescription
PFE0CN0xC10x10Prefetch Engine Control
PRTDRV0xF60x00, 0x20Port Drive Strength
PSCTL0x8FALLProgram Store Control
PSTAT00xAD0x10Power Status
PSW0xD0ALLProgram Status Word
REF0CN0xD10x00, 0x10Voltage Reference Control
REG0CN0xC90x00, 0x20Voltage Regulator 0 Control
REG1CN0xC60x20Voltage Regulator 1 Control
REVID0xB60x00Revision Identifcation
RSTSRC0xEF0x00Reset Source
SBCON10x940x20UART1 Baud Rate Generator Control
SBRLH10x960x20UART1 Baud Rate Generator High Byte
SBRLL10x950x20UART1 Baud Rate Generator Low Byte
EFM8UB3 Reference Manual
SBUF10x990x00, 0x20UART1 Serial Port Data Buffer
SCON10x980x00, 0x20UART1 Serial Port Control
SFRPAGE0xA7ALLSFR Page
SFRPGCN0xCF0x10SFR Page Control
SFRSTACK0xD70x10SFR Page Stack
SMB0ADM0xD60x00, 0x20SMBus 0 Slave Address Mask
SMB0ADR0xD70x00, 0x20SMBus 0 Slave Address
SMB0CF0xC10x00, 0x20SMBus 0 Configuration
SMB0CN00xC00x00, 0x20SMBus 0 Control
SMB0DAT0xC20x00, 0x20SMBus 0 Data
SMB0FCN00xC30x20SMBus 0 FIFO Control 0
SMB0FCN10xC40x20SMBus 0 FIFO Control 1
SMB0FCT0xEF0x20SMBus 0 FIFO Count
SMB0RXLN0xC50x20SMBus 0 Receive Length Counter
SMB0TC0xAC0x00, 0x20SMBus 0 Timing and Pin Control
SMOD10x930x20UART1 Mode
SP0x81ALLStack Pointer
SPI0CFG0xA10x00, 0x20SPI0 Configuration
SPI0CKR0xA20x00, 0x20SPI0 Clock Rate
SPI0CN00xF80x00, 0x20SPI0 Control
SPI0DAT0xA30x00, 0x20SPI0 Data
SPI0FCN00x9A0x20SPI0 FIFO Control 0
SPI0FCN10x9B0x20SPI0 FIFO Control 1
SPI0FCT0xF70x20SPI0 FIFO Count
silabs.com | Building a more connected world.Rev. 0.2 | 35
Page 36
RegisterAddress SFR PagesDescription
SPI0PCF0xDF0x20SPI0 Pin Configuration
TCON0x88ALLTimer 0/1 Control
TH00x8CALLTimer 0 High Byte
TH10x8DALLTimer 1 High Byte
TL00x8AALLTimer 0 Low Byte
TL10x8BALLTimer 1 Low Byte
TMOD0x89ALLTimer 0/1 Mode
TMR2CN00xC80x00, 0x10Timer 2 Control 0
TMR2CN10xFD0x10Timer 2 Control 1
TMR2H0xCD0x00, 0x10Timer 2 High Byte
TMR2L0xCC0x00, 0x10Timer 2 Low Byte
TMR2RLH0xCB0x00, 0x10Timer 2 Reload High Byte
TMR2RLL0xCA0x00, 0x10Timer 2 Reload Low Byte
EFM8UB3 Reference Manual
Special Function Registers
TMR3CN00x910x00, 0x10Timer 3 Control 0
TMR3CN10xFE0x10Timer 3 Control 1
TMR3H0x950x00, 0x10Timer 3 High Byte
TMR3L0x940x00, 0x10Timer 3 Low Byte
TMR3RLH0x930x00, 0x10Timer 3 Reload High Byte
TMR3RLL0x920x00, 0x10Timer 3 Reload Low Byte
TMR4CN00x980x10Timer 4 Control 0
TMR4CN10xFF0x10Timer 4 Control 1
TMR4H0xA50x10Timer 4 High Byte
TMR4L0xA40x10Timer 4 Low Byte
TMR4RLH0xA30x10Timer 4 Reload High Byte
TMR4RLL0xA20x10Timer 4 Reload Low Byte
TMR5CN00xC00x10Timer 5 Control 0
TMR5CN10xF10x10Timer 5 Control 1
TMR5H0xD50x10Timer 5 High Byte
TMR5L0xD40x10Timer 5 Low Byte
TMR5RLH0xD30x10Timer 5 Reload High Byte
TMR5RLL0xD20x10Timer 5 Reload Low Byte
UART1FCN00x9D0x20UART1 FIFO Control 0
UART1FCN10xD80x20UART1 FIFO Control 1
UART1FCT0xFA0x20UART1 FIFO Count
UART1LIN0x9E0x20UART1 LIN Configuration
UART1PCF0xDA0x20UART1 Configuration
USB0ADR0xAEALLUSB0 Indirect Address
silabs.com | Building a more connected world.Rev. 0.2 | 36
Page 37
RegisterAddress SFR PagesDescription
USB0AEC0xB20x20USB0 Advanced Energy Control
USB0CDCF0xB60x20USB0 Charger Detect Configuration
USB0CDCN0xBE0x20USB0 Charger Detect Control
USB0CDSTA0xBF0x20USB0 Charger Detect Status
USB0CF0xB50x20USB0 Configuration
USB0DAT0xAFALLUSB0 Data
USB0XCN0xB30x20USB0 Transceiver Control
VDM0CN0xFF0x00Supply Monitor Control
WDTCN0x97ALLWatchdog Timer Control
XBR00xE10x00, 0x20Port I/O Crossbar 0
XBR10xE20x00, 0x20Port I/O Crossbar 1
XBR20xE30x00, 0x20Port I/O Crossbar 2
EFM8UB3 Reference Manual
Special Function Registers
3.3 SFR Access Control Registers
3.3.1 SFRPAGE: SFR Page
Bit76543210
NameSFRPAGE
AccessRW
Reset0x00
SFR Page = ALL; SFR Address: 0xA7
BitNameResetAccess Description
7:0SFRPAGE0x00RWSFR Page.
Specifies the SFR Page used when reading, writing, or modifying special function registers.
silabs.com | Building a more connected world.Rev. 0.2 | 37
Page 38
EFM8UB3 Reference Manual
Special Function Registers
3.3.2 SFRPGCN: SFR Page Control
Bit76543210
NameReservedSFRPGIDXReservedSFRPGEN
AccessRWRWRWRW
Reset00x00x01
SFR Page = 0x10; SFR Address: 0xCF
BitNameResetAccess Description
7ReservedMust write reset value.
6:4SFRPGIDX0x0RWSFR Page Stack Index.
This field can be used to access the SFRPAGE values stored in the SFR page stack. It selects the level of the stack firmware can access when reading the SFRSTACK register.
ValueNameDescription
0x0FIRST_BYTESFRSTACK contains the value of SFRPAGE, the first/top byte of the
SFR page stack.
0x1SECOND_BYTESFRSTACK contains the value of the second byte of the SFR page
stack.
0x2THIRD_BYTESFRSTACK contains the value of the third byte of the SFR page stack.
0x3FOURTH_BYTESFRSTACK contains the value of the fourth byte of the SFR page
stack.
0x4FIFTH_BYTESFRSTACK contains the value of the fifth byte of the SFR page stack.
3:1ReservedMust write reset value.
0SFRPGEN1RWSFR Automatic Page Control Enable.
This bit is used to enable automatic page switching on ISR entry/exit. When set to 1, the current SFRPAGE value will be
pushed onto the SFR page stack and SFRPAGE will be set to the page corresponding to the flag which generated the interrupt; upon ISR exit, hardware will pop the value from the SFR page stack and restore SFRPAGE.
ValueNameDescription
0DISABLEDDisable automatic SFR paging.
1ENABLEDEnable automatic SFR paging.
3.3.3 SFRSTACK: SFR Page Stack
Bit
76543210
NameSFRSTACK
AccessR
Reset0x00
SFR Page = 0x10; SFR Address: 0xD7
BitNameResetAccess Description
7:0SFRSTACK0x00RSFR Page Stack.
This register is used to read the contents of the SFR page stack. The SFRPGIDX field in the SFRPGCN register controls
the level of the stack this register will access.
silabs.com | Building a more connected world.Rev. 0.2 | 38
Page 39
EFM8UB3 Reference Manual
Flash Memory
4. Flash Memory
4.1 Introduction
On-chip, re-programmable flash memory is included for program code and non-volatile data storage. The flash memory is organized in
512-byte pages. It can be erased and written through the C2 interface or from firmware by overloading the MOVX instruction. Any individual byte in flash memory must only be written once between page erase operations.
0xFFFF
0xFFC0
0xFBFF
0xFBFE
0xFBFD
0xFA00
0x9DFF
0x9A00
Read-Only
64 Bytes
Reserved
Lock Byte
Bootloader Signature Byte
Security Page
512 Bytes
Reserved
Bootloader
Bootloader Vector
Bootloader
Memory Lock
Read-Only
64 Bytes
128-bit UUID
0xFFFF
0xFFFE
0xFFD0
0xFFCF
0xFFC0
40 KB Flash
(79 x 512 Byte pages)
0x0000
Figure 4.1. Flash Memory Map — 40 KB Devices
4.2 Features
The flash memory has the following features:
• Up to 40 KB in 512-byte sectors, and 1 KB in 64-byte sectors.
• In-system programmable from user firmware.
• Security lock to prevent unwanted read/write/erase access.
Reset Vector
silabs.com | Building a more connected world.Rev. 0.2 | 39
Page 40
EFM8UB3 Reference Manual
Flash Memory
4.3 Functional Description
4.3.1 Security Options
The CIP-51 provides security options to protect the flash memory from inadvertent modification by software as well as to prevent the
viewing of proprietary program code and constants. The Program Store Write Enable (bit PSWE in register PSCTL) and the Program
Store Erase Enable (bit PSEE in register PSCTL) bits protect the flash memory from accidental modification by software. PSWE must
be explicitly set to 1 before software can modify the flash memory; both PSWE and PSEE must be set to 1 before software can erase
flash memory. Additional security features prevent proprietary program code and data constants from being read or altered across the
C2 interface.
A Security Lock Byte located in flash user space offers protection of the flash program memory from access (reads, writes, or erases)
by unprotected code or the C2 interface. See the specific device memory map for the location of the security byte. The flash security
mechanism allows the user to lock "n" flash pages, starting at page 0, where "n" is the 1s complement number represented by the
Security Lock Byte. Some devices may also include a read-only area in the flash memory space for constants such as UID and calibration values.
Note: The page containing the flash Security Lock Byte is unlocked when no other flash pages are locked (all bits of the Lock Byte are
1) and locked when any other flash pages are locked (any bit of the Lock Byte is 0).
The level of flash security depends on the flash access method. The three flash access methods that can be restricted are reads,
writes, and erases from the C2 debug interface, user firmware executing on unlocked pages, and user firmware executing on locked
pages.
silabs.com | Building a more connected world.Rev. 0.2 | 40
Page 41
Table 4.3. Flash Security Summary—C2 Permissions
Target Area for Read / Write / ErasePermissions from C2 interface
Any Unlocked Page[R] [W] [E]
Any Locked PageDevice Erase Only
Read-Only Area[R]
Reserved AreaNone
[R] = Read permitted
[W] = Write permitted
[E] = Erase permitted
Device Erase Only = No read, write, or individual page erase is allowed. Must erase entire flash space.
None = Read, write and erase are not permitted
4.3.2 Programming the Flash Memory
EFM8UB3 Reference Manual
Flash Memory
Writes to flash memory clear bits from logic 1 to logic 0 and can be performed on single byte locations. Flash erasures set bits back to
logic 1 and occur only on full pages. The write and erase operations are automatically timed by hardware for proper execution; data
polling to determine the end of the write/erase operation is not required. Code execution is stalled during a flash write/erase operation.
The simplest means of programming the flash memory is through the C2 interface using programming tools provided by Silicon Labs or
a third party vendor. Firmware may also be loaded into the device to implement code-loader functions or allow non-volatile data storage. To ensure the integrity of flash contents, it is strongly recommended that the on-chip supply monitor be enabled in any system that
includes code that writes and/or erases flash memory from software.
4.3.2.1 Flash Lock and Key Functions
Flash writes and erases by user software are protected with a lock and key function. The FLKEY register must be written with the correct key codes, in sequence, before flash operations may be performed. The key codes are 0xA5 and 0xF1. The timing does not matter, but the codes must be written in order. If the key codes are written out of order or the wrong codes are written, flash writes and
erases will be disabled until the next system reset. Flash writes and erases will also be disabled if a flash write or erase is attempted
before the key codes have been written properly. The flash lock resets after each write or erase; the key codes must be written again
before another flash write or erase operation can be performed.
4.3.2.2 Flash Page Erase Procedure
The flash memory is erased one page at a time by firmware using the MOVX write instruction with the address targeted to any byte
within the page. Before erasing a page of flash memory, flash write and erase operations must be enabled by setting the PSWE and
PSEE bits in the PSCTL register to logic 1 (this directs the MOVX writes to target flash memory and enables page erasure) and writing
the flash key codes in sequence to the FLKEY register. The PSWE and PSEE bits remain set until cleared by firmware.
Erase operation applies to an entire page (setting all bytes in the page to 0xFF). To erase an entire page, perform the following steps:
1. Disable interrupts (recommended).
2. Write the first key code to FLKEY: 0xA5.
3. Write the second key code to FLKEY: 0xF1.
4. Set the PSEE bit (register PSCTL).
5. Set the PSWE bit (register PSCTL).
6. Using the MOVX instruction, write a data byte to any location within the page to be erased.
7. Clear the PSWE and PSEE bits.
silabs.com | Building a more connected world.Rev. 0.2 | 41
Page 42
EFM8UB3 Reference Manual
Flash Memory
4.3.2.3 Flash Byte Write Procedure
The flash memory is written by firmware using the MOVX write instruction with the address and data byte to be programmed provided
as normal operands in DPTR and A. Before writing to flash memory using MOVX, flash write operations must be enabled by setting the
PSWE bit in the PSCTL register to logic 1 (this directs the MOVX writes to target flash memory) and writing the flash key codes in
sequence to the FLKEY register. The PSWE bit remains set until cleared by firmware. A write to flash memory can clear bits to logic 0
but cannot set them. A byte location to be programmed should be erased (already set to 0xFF) before a new value is written.
To write a byte of flash, perform the following steps:
1. Disable interrupts (recommended).
2. Write the first key code to FLKEY: 0xA5.
3. Write the second key code to FLKEY: 0xF1.
4. Set the PSWE bit (register PSCTL).
5. Clear the PSEE bit (register PSCTL).
6. Using the MOVX instruction, write a single data byte to the desired location within the desired page.
7. Clear the PSWE bit.
4.3.3 Flash Write and Erase Precautions
Any system which contains routines which write or erase flash memory from software involves some risk that the write or erase routines
will execute unintentionally if the CPU is operating outside its specified operating range of supply voltage, system clock frequency or
temperature. This accidental execution of flash modifying code can result in alteration of flash memory contents causing a system failure that is only recoverable by re-flashing the code in the device.
To help prevent the accidental modification of flash by firmware, hardware restricts flash writes and erasures when the supply monitor is
not active and selected as a reset source. As the monitor is enabled and selected as a reset source by default, it is recommended that
systems writing or erasing flash simply maintain the default state.
The following sections provide general guidelines for any system which contains routines which write or erase flash from code. Additional flash recommendations and example code can be found in AN201: Writing to Flash From Firmware, available from the Silicon
Laboratories website.
Voltage Supply Maintenance and the Supply Monitor
• If the system power supply is subject to voltage or current "spikes," add sufficient transient protection devices to the power supply to
ensure that the supply voltages listed in the Absolute Maximum Ratings table are not exceeded.
• Make certain that the minimum supply rise time specification is met. If the system cannot meet this rise time specification, then add
an external supply brownout circuit to the RSTb pin of the device that holds the device in reset until the voltage supply reaches the
lower limit, and re-asserts RSTb if the supply drops below the low supply limit.
• Do not disable the supply monitor. If the supply monitor must be disabled in the system, firmware should be added to the startup
routine to enable the on-chip supply monitor and enable the supply monitor as a reset source as early in code as possible. This
should be the first set of instructions executed after the reset vector. For C-based systems, this may involve modifying the startup
code added by the C compiler. See your compiler documentation for more details. Make certain that there are no delays in software
between enabling the supply monitor and enabling the supply monitor as a reset source.
Note: The supply monitor must be enabled and enabled as a reset source when writing or erasing flash memory. A flash error reset
will occur if either condition is not met.
• As an added precaution if the supply monitor is ever disabled, explicitly enable the supply monitor and enable the supply monitor as
a reset source inside the functions that write and erase flash memory. The supply monitor enable instructions should be placed just
after the instruction to set PSWE to a 1, but before the flash write or erase operation instruction.
• Make certain that all writes to the RSTSRC (Reset Sources) register use direct assignment operators and explicitly do not use the
bit-wise operators (such as AND or OR). For example, "RSTSRC = 0x02" is correct. "RSTSRC |= 0x02" is incorrect.
• Make certain that all writes to the RSTSRC register explicitly set the PORSF bit to a 1. Areas to check are initialization code which
enables other reset sources, such as the Missing Clock Detector or Comparator, for example, and instructions which force a Software Reset. A global search on "RSTSRC" can quickly verify this.
silabs.com | Building a more connected world.Rev. 0.2 | 42
Page 43
EFM8UB3 Reference Manual
Flash Memory
PSWE Maintenance
• Reduce the number of places in code where the PSWE bit (in register PSCTL) is set to a 1. There should be exactly one routine in
code that sets PSWE to a 1 to write flash bytes and one routine in code that sets PSWE and PSEE both to a 1 to erase flash pages.
• Minimize the number of variable accesses while PSWE is set to a 1. Handle pointer address updates and loop variable maintenance
outside the "PSWE = 1;... PSWE = 0;" area.
• Disable interrupts prior to setting PSWE to a 1 and leave them disabled until after PSWE has been reset to 0. Any interrupts posted
during the flash write or erase operation will be serviced in priority order after the flash operation has been completed and interrupts
have been re-enabled by software.
• Make certain that the flash write and erase pointer variables are not located in XRAM. See your compiler documentation for instructions regarding how to explicitly locate variables in different memory areas.
• Add address bounds checking to the routines that write or erase flash memory to ensure that a routine called with an illegal address
does not result in modification of the flash.
System Clock
• If operating from an external source, be advised that performance is susceptible to electrical interference and is sensitive to layout
and to changes in temperature. If the system is operating in an electrically noisy environment, use the internal oscillator or use an
external CMOS clock.
• If operating from the external oscillator, switch to the internal oscillator during flash write or erase operations. The external oscillator
can continue to run, and the CPU can switch back to the external oscillator after the flash operation has completed.
4.4 Flash Control Registers
4.4.1 PSCTL: Program Store Control
Bit76543210
NameReservedPSEEPSWE
AccessRRWRW
Reset0x0000
SFR Page = ALL; SFR Address: 0x8F
BitNameResetAccess Description
7:2ReservedMust write reset value.
1PSEE0RWProgram Store Erase Enable.
Setting this bit (in combination with PSWE) allows an entire page of flash program memory to be erased. If this bit is logic 1
and flash writes are enabled (PSWE is logic 1), a write to flash memory using the MOVX instruction will erase the entire
page that contains the location addressed by the MOVX instruction. The value of the data byte written does not matter.
ValueNameDescription
0ERASE_DISABLEDFlash program memory erasure disabled.
1ERASE_ENABLEDFlash program memory erasure enabled.
0PSWE0RWProgram Store Write Enable.
Setting this bit allows writing a byte of data to the flash program memory using the MOVX write instruction. The flash location should be erased before writing data.
ValueNameDescription
0WRITE_DISABLEDWrites to flash program memory disabled.
1WRITE_ENABLEDWrites to flash program memory enabled; the MOVX write instruction
targets flash memory.
silabs.com | Building a more connected world.Rev. 0.2 | 43
Page 44
EFM8UB3 Reference Manual
Flash Memory
4.4.2 FLKEY: Flash Lock and Key
Bit76543210
NameFLKEY
AccessRW
Reset0x00
SFR Page = ALL; SFR Address: 0xB7
BitNameResetAccess Description
7:0FLKEY0x00RWFlash Lock and Key.
Write:
This register provides a lock and key function for flash erasures and writes. Flash writes and erases are enabled by writing
0xA5 followed by 0xF1 to the FLKEY register. Flash writes and erases are automatically disabled after the next write or
erase is complete. If any writes to FLKEY are performed incorrectly, or if a flash write or erase operation is attempted while
these operations are disabled, the flash will be permanently locked from writes or erasures until the next device reset. If an
application never writes to flash, it can intentionally lock the flash by writing a non-0xA5 value to FLKEY from firmware.
Read:
When read, bits 1-0 indicate the current flash lock state.
00: Flash is write/erase locked.
01: The first key code has been written (0xA5).
10: Flash is unlocked (writes/erases allowed).
11: Flash writes/erases are disabled until the next reset.
silabs.com | Building a more connected world.Rev. 0.2 | 44
Page 45
EFM8UB3 Reference Manual
Device Identification
5. Device Identification
5.1 Device Identification
The SFR map includes registers that may be used to identify the device family (DEVICEID), derivative (DERIVID), and revision (REVID). These SFRs can be read by firmware at runtime to determine the capabilities of the MCU that is executing code. This allows the
same firmware image to run on MCUs with different memory sizes and peripherals, and dynamically change functionality to suit the
capabilities of that MCU.
5.2 Unique Identifier
A128-bit universally unique identifier (UUID) is pre-programmed into all devices. The value assigned to a device is random and not
sequential, but it is guaranteed unique. The UUID resides in the read-only area of flash memory which cannot be erased or written in
the end application. The UUID can be read by firmware or through the debug interface at flash locations 0xFFC0-0xFFCF.
Table 5.1. UID Location in Memory
DeviceFlash Addresses
EFM8UB30F40G
EFM8UB31F40G
EFM8UB32F40G
5.3 Device Identification Registers
5.3.1 DEVICEID: Device Identification
Bit76543210
NameDEVICEID
AccessR
Reset0x36
SFR Page = 0x0; SFR Address: 0xB5
BitNameResetAccess Description
7:0DEVICEID0x36RDevice ID.
(MSB)
0xFFCF, 0xFFCE, 0xFFCD, 0xFFCC,
0xFFCB, 0xFFCA, 0xFFC9, 0xFFC8,
0xFFC7, 0xFFC6, 0xFFC5, 0xFFC4,
0xFFC3, 0xFFC2, 0xFFC1, 0xFFC0
(LSB)
This read-only register returns the 8-bit device ID.
silabs.com | Building a more connected world.Rev. 0.2 | 45
Page 46
EFM8UB3 Reference Manual
Device Identification
5.3.2 DERIVID: Derivative Identification
Bit76543210
NameDERIVID
AccessR
ResetVaries
SFR Page = 0x0; SFR Address: 0xAD
BitNameResetAccess Description
7:0DERIVIDVariesRDerivative ID.
This read-only register returns the 8-bit derivative ID, which can be used by firmware to identify which device in the product
family the code is executing on. The '{R}' tag in the part numbers indicates the device revision letter in the ordering code.
The revision letter may be determined by decoding the REVID register.
ValueNameDescription
0x00EFM8UB30F40G_QFN20EFM8UB30F40G-{R}-QFN20
0x01EFM8UB31F40G_QFN24EFM8UB31F40G-{R}-QFN24
0x02EFM8UB31F40G_QSO
EFM8UB31F40G-{R}-QSOP24
P24
5.3.3 REVID: Revision Identifcation
Bit76543210
NameREVID
AccessR
ResetVaries
SFR Page = 0x0; SFR Address: 0xB6
BitNameResetAccess Description
7:0REVIDVariesRRevision ID.
This read-only register returns the revision ID.
ValueNameDescription
0x00REV_ARevision A.
silabs.com | Building a more connected world.Rev. 0.2 | 46
Page 47
EFM8UB3 Reference Manual
Interrupts
6. Interrupts
6.1 Introduction
The MCU core includes an extended interrupt system supporting multiple interrupt sources and priority levels. The allocation of interrupt
sources between on-chip peripherals and external input pins varies according to the specific version of the device.
Interrupt sources may have one or more associated interrupt-pending flag(s) located in an SFR local to the associated peripheral.
When a peripheral or external source meets a valid interrupt condition, the associated interrupt-pending flag is set to logic 1.
If interrupts are enabled for the source, an interrupt request is generated when the interrupt-pending flag is set. As soon as execution of
the current instruction is complete, the CPU generates an LCALL to a predetermined address to begin execution of an interrupt service
routine (ISR). Each ISR must end with an RETI instruction, which returns program execution to the next instruction that would have
been executed if the interrupt request had not occurred. If interrupts are not enabled, the interrupt-pending flag is ignored by the hardware and program execution continues as normal. The interrupt-pending flag is set to logic 1 regardless of whether the interrupt is enabled.
Each interrupt source can be individually enabled or disabled through the use of an associated interrupt enable bit in the IE and EIEn
registers. However, interrupts must first be globally enabled by setting the EA bit to logic 1 before the individual interrupt enables are
recognized. Setting the EA bit to logic 0 disables all interrupt sources regardless of the individual interrupt-enable settings.
Some interrupt-pending flags are automatically cleared by the hardware when the CPU vectors to the ISR or by other hardware conditions. However, most are not cleared by the hardware and must be cleared by software before returning from the ISR. If an interruptpending flag remains set after the CPU completes the return-from-interrupt (RETI) instruction, a new interrupt request will be generated
immediately and the CPU will re-enter the ISR after the completion of the next instruction.
6.2 Interrupt Sources and Vectors
The CIP51 core supports interrupt sources for each peripheral on the device. Software can simulate an interrupt for many peripherals
by setting any interrupt-pending flag to logic 1. If interrupts are enabled for the flag, an interrupt request will be generated and the CPU
will vector to the ISR address associated with the interrupt-pending flag. Refer to the data sheet section associated with a particular onchip peripheral for information regarding valid interrupt conditions for the peripheral and the behavior of its interrupt-pending flag(s).
6.2.1 Interrupt Priorities
Each interrupt source can be individually programmed to one of four priority levels. This differs from the traditional two priority levels on
the 8051 core. However, the implementation of the extra levels is backwards- compatible with legacy 8051 code.
An interrupt service routine can be preempted by any interrupt of higher priority. Interrupts at the highest priority level cannot be preempted. Each interrupt has two associated priority bits which are used to configure the priority level. For backwards compatibility, the
bits are spread across two different registers. The LSBs of the priority setting are located in the IP and EIPn registers, while the MSBs
are located in the IPH and EIPnH registers. Priority levels according to the MSB and LSB are decoded in Table 6.1 Configurable Inter-
rupt Priority Decoding on page 47. The lowest priority setting is the default for all interrupts. If two or more interrupts are recognized
simultaneously, the interrupt with the highest priority is serviced first. If both interrupts have the same priority level, a fixed order is used
to arbitrate, based on the interrupt source's location in the interrupt vector table. Interrupts with a lower number in the vector table have
priority. If legacy 8051 operation is desired, the bits of the “high” priority registers (IPH and EIPnH) should all be configured to 0.
silabs.com | Building a more connected world.Rev. 0.2 | 47
Page 48
EFM8UB3 Reference Manual
Interrupts
6.2.2 Interrupt Latency
Interrupt response time depends on the state of the CPU when the interrupt occurs. Pending interrupts are sampled and priority decoded on every system clock cycle. Therefore, the fastest possible response time is 5 system clock cycles: 1 clock cycle to detect the
interrupt and 4 clock cycles to complete the LCALL to the ISR. If an interrupt is pending when a RETI is executed, a single instruction is
executed before an LCALL is made to service the pending interrupt. Therefore, the maximum response time for an interrupt (when no
other interrupt is currently being serviced or the new interrupt is of greater priority) occurs when the CPU is performing an RETI instruction followed by a DIV as the next instruction. In this case, the response time is 18 system clock cycles: 1 clock cycle to detect the
interrupt, 5 clock cycles to execute the RETI, 8 clock cycles to complete the DIV instruction and 4 clock cycles to execute the LCALL to
the ISR. If the CPU is executing an ISR for an interrupt with equal or higher priority, the new interrupt will not be serviced until the
current ISR completes, including the RETI and following instruction. If more than one interrupt is pending when the CPU exits an ISR,
the CPU will service the next highest priority interrupt that is pending.
silabs.com | Building a more connected world.Rev. 0.2 | 48
1ENABLEDEnable interrupt requests generated by CL0.
5:4ReservedMust write reset value.
3ET50RWTimer 5 Interrupt Enable.
This bit sets the masking of the Timer 5 interrupt.
ValueNameDescription
0DISABLEDDisable Timer 5 interrupts.
1ENABLEDEnable interrupt requests generated by the TF5L or TF5H flags.
2ET40RWTimer 4 Interrupt Enable.
This bit sets the masking of the Timer 4 interrupt.
ValueNameDescription
0DISABLEDDisable Timer 4 interrupts.
1ENABLEDEnable interrupt requests generated by the TF4L or TF4H flags.
1EVBUS0RWVBUS and USB Charger Detect Interrupt.
This bit sets the masking of the VBUS and VBUS and USB Charger Detect interrupts.
ValueNameDescription
0DISABLEDDisable all VBUS and VBUS and USB Charger Detect interrupts.
1ENABLEDEnable interrupt requests generated by VBUS and VBUS and USB
Charger Detect.
0EUSB00RWUSB (USB0) Interrupt Enable.
This bit sets the masking of the USB0 interrupt.
ValueNameDescription
0DISABLEDDisable all USB0 interrupts.
1ENABLEDEnable interrupt requests generated by USB0.
silabs.com | Building a more connected world.Rev. 0.2 | 59
Page 60
EFM8UB3 Reference Manual
Interrupts
6.3.8 EIP2: Extended Interrupt Priority 2
Bit76543210
NameReservedPCL0ReservedPT5PT4PVBUSPUSB0
AccessRWRWRWRWRWRWRW
Reset000x00000
SFR Page = 0x10; SFR Address: 0xF4
BitNameResetAccess Description
7ReservedMust write reset value.
6PCL00RWConfigurable Logic (CL0) Interrupt Priority Control LSB.
This bit sets the LSB of the priority field for the CL0 interrupt.
5:4ReservedMust write reset value.
3PT50RWTimer 5 Interrupt Priority Control LSB.
This bit sets the LSB of the priority field for the Timer 5 interrupt.
2PT40RWTimer 4 Interrupt Priority Control LSB.
This bit sets the LSB of the priority field for the Timer 4 interrupt.
1PVBUS0RWVBUS and USB Charger Detect Interrupt Priority Control LSB.
This bit sets the LSB of the priority field for the VBUS and USB Charger Detect interrupt.
0PUSB00RWUSB (USB0) Interrupt Priority Control LSB.
This bit sets the LSB of the priority field for USB0 interrupts.
silabs.com | Building a more connected world.Rev. 0.2 | 60
Page 61
EFM8UB3 Reference Manual
Interrupts
6.3.9 EIP2H: Extended Interrupt Priority 2 High
Bit76543210
NameReservedPHCL0ReservedPHT5PHT4PHVBUSPHUSB0
AccessRWRWRWRWRWRWRW
Reset000x00000
SFR Page = 0x10; SFR Address: 0xF6
BitNameResetAccess Description
7ReservedMust write reset value.
6PHCL00RWConfigurable Logic (CL0) Interrupt Priority Control MSB.
This bit sets the MSB of the priority field for the CL0 interrupt.
5:4ReservedMust write reset value.
3PHT50RWTimer 5 Interrupt Priority Control MSB.
This bit sets the MSB of the priority field for the Timer 5 interrupt.
2PHT40RWTimer 4 Interrupt Priority Control MSB.
This bit sets the MSB of the priority field for the Timer 4 interrupt.
1PHVBUS0RWVBUS and USB Charger Detect Interrupt Priority Control MSB.
This bit sets the MSB of the priority field for the VBUS and USB Charger Detect interrupt.
0PHUSB00RWUSB (USB0) Interrupt Priority Control MSB.
This bit sets the MSB of the priority field for USB0 interrupts.
silabs.com | Building a more connected world.Rev. 0.2 | 61
Page 62
EFM8UB3 Reference Manual
Power Management and Internal Regulators
7. Power Management and Internal Regulators
7.1 Introduction
Control over the device power consumption can be achieved by enabling/disabling individual peripherals as needed. Each analog peripheral can be disabled when not in use and placed in low power mode. Digital peripherals, such as timers and serial buses, have their
clocks gated off and draw little power when they are not in use.
Power Distribution
VREGIN
VDD
GND
5V LDO
3.3V
USB PHY
Core LDO
Figure 7.1. Power System Block Diagram
1.8V
CPU Core
Oscillators
Peripheral
RAM
Flash
Logic
Digital I/O
Interface
Analog
Muxes
D+
D-
VIO
Port I/O Pins
Table 7.1. Power Modes
Power ModeDetailsMode EntryWake-Up Sources
NormalCore and all peripherals clocked and fully operational——
Idle• Core halted
Set IDLE bit in PCON0Any interrupt
• All peripherals clocked and fully operational
• Code resumes execution on wake event
Suspend• Core and peripheral clocks halted
• HFOSC0 and HFOSC1 oscillators stopped
• Regulators in normal bias mode for fast wake
• Timer 3 and 4 may clock from LFOSC0
• Code resumes execution on wake event
1. Switch SYSCLK to
HFOSC0
2. Set SUSPEND bit in
PCON1
• USB0 Bus Activity
• Timer 4 Event
• SPI0 Activity
• Port Match Event
• Comparator 0 Falling
Edge
• CLUn Interrupt-Enabled
Event
silabs.com | Building a more connected world.Rev. 0.2 | 62
Page 63
EFM8UB3 Reference Manual
Power Management and Internal Regulators
Power ModeDetailsMode EntryWake-Up Sources
Stop• All internal power nets shut down
• 5V regulator remains active (if enabled)
• Internal 1.8 V LDO on
• Pins retain state
1. Clear STOPCF bit in
REG0CN
2. Set STOP bit in
PCON0
Any reset source
• Exit on any reset source
Snooze• Core and peripheral clocks halted
• HFOSC0 and HFOSC1 oscillators stopped
• Regulators in low bias current mode for energy savings
• Timer 3 and 4 may clock from LFOSC0
• Code resumes execution on wake event
1. Switch SYSCLK to
HFOSC0
2. Set SNOOZE bit in
PCON1
• USB0 Bus Activity
• Timer 4 Event
• SPI0 Activity
• Port Match Event
• Comparator 0 Falling
Edge
• CLUn Interrupt-Enabled
Event
Shutdown• All internal power nets shut down
• 5V regulator remains active (if enabled)
• Internal 1.8 V LDO off to save energy
• Pins retain state
1. Set STOPCF bit in
REG0CN
2. Set STOP bit in
PCON0
• RSTb pin reset
• Power-on reset
• Exit on pin or power-on reset
7.2 Features
The power management features of these devices include:
• Supports five power modes:
1. Normal mode: Core and all peripherals fully operational.
2. Idle mode: Core halted, peripherals fully operational, core waiting for interrupt to continue.
3. Suspend mode: High-frequency internal clocks halted, select peripherals active, waiting for wake signal to continue.
4. Snooze mode: High-frequency internal clocks halted, select peripherals active, regulators in low-power mode, waiting for wake
signal to continue.
5. Shutdown mode: All clocks stopped and internal LDO shut off, device waiting for POR or pin reset.
Note: Legacy 8051 Stop mode is also supported, but Suspend and Snooze offer more functionality with better power consumption.
• Internal Core LDO:
• Supplies power to majority of blocks.
• Low power consumption in Snooze mode, can be shut down completely in Shutdown mode.
• 5V-to-3.3V Regulator:
• Allows direct connection to USB supply net.
• Provides up to 100 mA for system-level use.
• Low power consumption in Snooze mode.
silabs.com | Building a more connected world.Rev. 0.2 | 63
Page 64
EFM8UB3 Reference Manual
Power Management and Internal Regulators
7.3 Idle Mode
In idle mode, CPU core execution is halted while any enabled peripherals and clocks remain active. Power consumption in idle mode is
dependent upon the system clock frequency and any active peripherals.
Setting the IDLE bit in the PCON0 register causes the hardware to halt the CPU and enter idle mode as soon as the instruction that
sets the bit completes execution. All internal registers and memory maintain their original data. All analog and digital peripherals can
remain active during idle mode.
Idle mode is terminated when an enabled interrupt is asserted or a reset occurs. The assertion of an enabled interrupt will cause the
IDLE bit to be cleared and the CPU to resume operation. The pending interrupt will be serviced and the next instruction to be executed
after the return from interrupt (RETI) will be the instruction immediately following the one that set the IDLE bit. If idle mode is terminated
by an internal or external reset, the CIP-51 performs a normal reset sequence and begins program execution at address 0x0000.
Note: If the instruction following the write of the IDLE bit is a single-byte instruction and an interrupt occurs during the execution phase
of the instruction that sets the IDLE bit, the CPU may not wake from idle mode when a future interrupt occurs. Therefore, instructions
that set the IDLE bit should be followed by an instruction that has two or more opcode bytes. For example:
// in ‘C’:
PCON0 |= 0x01; // set IDLE bit
PCON0 = PCON0; // ... followed by a 3-cycle dummy instruction
; in assembly:
ORL PCON0, #01h ; set IDLE bit
MOV PCON0, PCON0 ; ... followed by a 3-cycle dummy instruction
If enabled, the Watchdog Timer (WDT) will eventually cause an internal watchdog reset and thereby terminate the Idle mode. This feature protects the system from an unintended permanent shutdown in the event of an inadvertent write to the PCON0 register. If this
behavior is not desired, the WDT may be disabled by software prior to entering the idle mode if the WDT was initially configured to
allow this operation. This provides the opportunity for additional power savings, allowing the system to remain in the idle mode indefinitely, waiting for an external stimulus to wake up the system.
7.4 Stop Mode
In stop mode, the CPU is halted and peripheral clocks are stopped. Analog peripherals remain in their selected states.
Setting the STOP bit in the PCON0 register causes the controller core to enter stop mode as soon as the instruction that sets the bit
completes execution. Before entering stop mode, the system clock must be sourced by HFOSC0. In stop mode, the CPU and internal
clocks are stopped. Analog peripherals may remain enabled, but will not be provided a clock. Each analog peripheral may be shut down
individually by firmware prior to entering stop mode. Stop mode can only be terminated by an internal or external reset. On reset, the
device performs the normal reset sequence and begins program execution at address 0x0000.
If enabled as a reset source, the missing clock detector will cause an internal reset and thereby terminate the stop mode. If this reset is
undesirable in the system, and the CPU is to be placed in stop mode for longer than the missing clock detector timeout, the missing
clock detector should be disabled in firmware prior to setting the STOP bit.
7.5 Suspend Mode
Suspend mode is entered by setting the SUSPEND bit while operating from the internal 24.5 MHz oscillator (HFOSC0). Upon entry into
suspend mode, the hardware halts both of the high-frequency internal oscillators and goes into a low power state as soon as the instruction that sets the bit completes execution. All internal registers and memory maintain their original data.
Suspend mode is terminated by any enabled wake or reset source. When suspend mode is terminated, the device will continue execution on the instruction following the one that set the SUSPEND bit. If the wake event was configured to generate an interrupt, the interrupt will be serviced upon waking the device. If suspend mode is terminated by an internal or external reset, the CIP-51 performs a
normal reset sequence and begins program execution at address 0x0000.
silabs.com | Building a more connected world.Rev. 0.2 | 64
Page 65
EFM8UB3 Reference Manual
Power Management and Internal Regulators
7.6 Snooze Mode
Snooze mode is entered by setting the SNOOZE bit while operating from the internal 24.5 MHz oscillator (HFOSC0). Upon entry into
snooze mode, the hardware halts both of the high-frequency internal oscillators and goes into a low power state as soon as the instruction that sets the bit completes execution. The internal LDO is then placed into a low-current standby mode. All internal registers and
memory maintain their original data.
Snooze mode is terminated by any enabled wake or reset source. When snooze mode is terminated, the LDO is returned to normal
operating conditions and the device will continue execution on the instruction following the one that set the SNOOZE bit. If the wake
event was configured to generate an interrupt, the interrupt will be serviced upon waking the device. If snooze mode is terminated by an
internal or external reset, the CIP-51 performs a normal reset sequence and begins program execution at address 0x0000.
7.7 Shutdown Mode
In shutdown mode, the CPU is halted and the internal LDO is powered down. External I/O will retain their configured states.
To enter Shutdown mode, firmware should set the STOPCF bit in the regulator control register to 1, and then set the STOP bit in
PCON0. In Shutdown, the RSTb pin and a full power cycle of the device are the only methods of generating a reset and waking the
device.
Note: In Shutdown mode, all internal device circuitry is powered down, and no RAM nor registers are retained. The debug circuitry will
not be able to connect to a device while it is in Shutdown. Coming out of Shutdown mode, whether by POR or pin reset, will appear as
a power-on reset of the device.
7.8 5V-to-3.3V Regulator
The 5-to-3.3 V regulator is powered from the VREGIN pin on the device. When active, it regulates the input voltage to 3.3 V at the VDD
pin, providing up to 100 mA for the device and system. In addition to the normal mode of operation, the regulator has two low power
modes which may be used to reduce the supply current, and may be disabled when not in use.
Table 7.2. Voltage Regulator Operational Modes
Regulator ConditionSUSEN BitBIASENB BitREG1ENB BitRelative Power Consumption
Normal000highest
Suspend100low
Bias Disabledx10extremely low
Disabledx11off
The voltage regulator is enabled in normal mode by default. Normal mode offers the fastest response times, for systems with dynamically-changing loads.
For applications which can tolerate a lower regulator bandwidth but still require a tightly regulated output voltage, the regulator may be
placed in suspend mode. Suspend mode is activated when firmware sets the SUSEN bit. Suspend mode reduces the regulator bias
current at the expense of bandwidth.
For low power applications that can tolerate reduced output voltage accuracy and load regulation, the internal bias current may be disabled completely using the BIASENB bit. If firmware sets the BIASENB bit, the regulator will regulate the voltage using a method that is
more susceptible to process and temperature variations. In addition, the actual output voltage may drop substantially under heavy
loads. The bias should only be disabled for light loads (5 mA or less) or when the voltage regulator is disabled.
If the regulator is not used in a system, the VREGIN and VDD pins should be connected together. Firmware may disable the regulator
by writing both the REG1ENB and BIASENB bits in REG1CN to turn off the regulator and all associated bias currents.
silabs.com | Building a more connected world.Rev. 0.2 | 65
Page 66
EFM8UB3 Reference Manual
Power Management and Internal Regulators
7.9 Power Management Control Registers
7.9.1 PCON0: Power Control
Bit76543210
NameGF5GF4GF3GF2GF1GF0STOPIDLE
AccessRWRWRWRWRWRWRWRW
Reset00000000
SFR Page = ALL; SFR Address: 0x87
BitNameResetAccess Description
7GF50RWGeneral Purpose Flag 5.
This flag is a general purpose flag for use under firmware control.
6GF40RWGeneral Purpose Flag 4.
This flag is a general purpose flag for use under firmware control.
5GF30RWGeneral Purpose Flag 3.
This flag is a general purpose flag for use under firmware control.
4GF20RWGeneral Purpose Flag 2.
This flag is a general purpose flag for use under firmware control.
3GF10RWGeneral Purpose Flag 1.
This flag is a general purpose flag for use under firmware control.
2GF00RWGeneral Purpose Flag 0.
This flag is a general purpose flag for use under firmware control.
1STOP0RWStop Mode Select.
Setting this bit will place the CIP-51 in Stop mode. This bit will always be read as 0.
0IDLE0RWIdle Mode Select.
Setting this bit will place the CIP-51 in Idle mode. This bit will always be read as 0.
silabs.com | Building a more connected world.Rev. 0.2 | 66
Page 67
EFM8UB3 Reference Manual
Power Management and Internal Regulators
7.9.2 PCON1: Power Control 1
Bit76543210
NameSNOOZESUSPENDReserved
AccessRWRWR
Reset000x00
SFR Page = ALL; SFR Address: 0xE4
BitNameResetAccess Description
7SNOOZE0RWSnooze Mode Select.
Setting this bit will place the device in snooze mode. High speed oscillators will be halted the SYSCLK signal will be gated
off, and the internal regulator will be placed in a low power state.
6SUSPEND0RWSuspend Mode Select.
Setting this bit will place the device in suspend mode. High speed oscillators will be halted and the SYSCLK signal will be
gated off.
5:0ReservedMust write reset value.
silabs.com | Building a more connected world.Rev. 0.2 | 67
Page 68
EFM8UB3 Reference Manual
Power Management and Internal Regulators
7.9.3 PSTAT0: Power Status
Bit76543210
NameReservedCL0WKUSB0RWKSPI0WKTMR4WKPMATWKCPT0WK
AccessRWRWRWRWRWRWRW
Reset0x0000000
SFR Page = 0x10; SFR Address: 0xAD
BitNameResetAccess Description
7:6ReservedMust write reset value.
5CL0WK0RWCL0 Wake-up Event.
ValueNameDescription
0NOT_SETA CL0 interrupt-enabled event did not occur.
1SETA CL0 interrupt-enabled event occurred.
4USB0RWK0RWUSB0 Resume Wake-up Event.
ValueNameDescription
0NOT_SETA USB Resume wake up event did not occur.
1SETA USB Resume wake up event occurred.
3SPI0WK0RWSPI0 Slave Wake-up Event.
ValueNameDescription
0NOT_SETThe SPI0 Slave did not receive a byte.
1SETThe SPI0 Slave received a byte.
2TMR4WK0RWTimer 4 Wake-up Event.
ValueNameDescription
0NOT_SETA Timer 4 overflow event did not occur.
1SETA Timer 4 overflow event occurred.
1PMATWK0RWPort Match Wake-up Event.
ValueNameDescription
0NOT_SETA Port Match event did not occur.
1SETA Port Match event occurred.
0CPT0WK0RWComparator 0 Wake-up Event.
ValueNameDescription
0NOT_SETA comparator 0 output falling edge event did not occur.
silabs.com | Building a more connected world.Rev. 0.2 | 68
Page 69
EFM8UB3 Reference Manual
Power Management and Internal Regulators
7.9.4 REG0CN: Voltage Regulator 0 Control
Bit76543210
NameReservedSTOPCFReserved
AccessRRWR
Reset0x000x0
SFR Page = 0x0, 0x20; SFR Address: 0xC9
BitNameResetAccess Description
7:4ReservedMust write reset value.
3STOPCF0RWStop and Shutdown Mode Configuration.
This bit configures the regulator's behavior when the device enters stop mode.
ValueNameDescription
0ACTIVERegulator is still active in stop mode. Any enabled reset source will re-
set the device.
1SHUTDOWNRegulator is shut down in stop mode (device enters Shutdown mode).
Only the RSTb pin or power cycle can reset the device.
2:0ReservedMust write reset value.
silabs.com | Building a more connected world.Rev. 0.2 | 69
Page 70
EFM8UB3 Reference Manual
Power Management and Internal Regulators
7.9.5 REG1CN: Voltage Regulator 1 Control
Bit76543210
NameREG1ENBReservedBIASENBSUSENReserved
AccessRWRRWRWR
Reset00x0000
SFR Page = 0x20; SFR Address: 0xC6
BitNameResetAccess Description
7REG1ENB0RWVoltage Regulator 1 Disable.
This bit may be used to disable the 5V regulator if an external regulator is used to power VDD. VREGIN should be tied to
VDD in any system that disables this regulator.
6:3ReservedMust write reset value.
2BIASENB0RWRegulator Bias Disable.
The BIASENB bit disables the regulator bias voltage when set to 1.
ValueNameDescription
0ENABLEDRegulator bias is enabled.
1DISABLEDRegulator bias is disabled.
1SUSEN0RWVoltage Regulator 1 Suspend Enable.
When set to 1, this bit places the 5V regulator into suspend mode.
ValueNameDescription
0NORMALThe 5V regulator is in normal power mode. Normal mode is the highest
performance mode for the regulator.
1SUSPENDThe 5V regulator is in suspend power mode. Suspend mode reduces
the regulator bias current, but increases the response times.
0ReservedMust write reset value.
silabs.com | Building a more connected world.Rev. 0.2 | 70
Page 71
EFM8UB3 Reference Manual
Clocking and Oscillators
8. Clocking and Oscillators
8.1 Introduction
The CPU core and peripheral subsystem may be clocked by both internal and external oscillator resources. By default, the system
clock comes up running from the 24.5 MHz oscillator divided by 8.
Clock Control
48 MHz Oscillator
(HFOSC1)
24.5 MHz
Oscillator
(HFOSC0)
External Clock
Input (EXTCLK)
80 kHz Oscillator
(LFOSC0)
/1.5
/1.5
Divider:
1, 2, 4, 8
Programmable
Divider:
1, 2, 4...128
To core and peripherals
Figure 8.1. Clock Control Block Diagram
8.2 Features
The clock control system offers the following features:
• Provides clock to core and peripherals.
• 24.5 MHz internal oscillator (HFOSC0), accurate to ±2% over supply and temperature corners.
• 48 MHz internal oscillator (HFOSC1), accurate to ±1.5% over supply and temperature corners.
• 80 kHz low-frequency oscillator (LFOSC0).
• External CMOS clock input (EXTCLK).
• Clock divider with eight settings for flexible clock scaling:
• Divide the selected clock source by 1, 2, 4, 8, 16, 32, 64, or 128.
• HFOSC0 and HFOSC1 include 1.5x pre-scalers for further flexibility.
SYSCLK
To WDT
8.3 Functional Description
8.3.1 Clock Selection
The CLKSEL register is used to select the clock source for the system (SYSCLK). The CLKSL field selects which oscillator source is
used as the system clock, while CLKDIV controls the programmable divider. When an internal oscillator source is selected as the
SYSCLK, the external oscillator may still clock certain peripherals. In these cases, the external oscillator source is synchronized to the
SYSCLK source. The system clock may be switched on-the-fly between any of the oscillator sources so long as the selected clock
source is enabled and has settled, and CLKDIV may be changed at any time.
Note: Some device families do place restrictions on the difference in operating frequency when switching clock sources. Please see the
CLKSEL register description for details.
silabs.com | Building a more connected world.Rev. 0.2 | 71
Page 72
EFM8UB3 Reference Manual
Clocking and Oscillators
8.3.2 HFOSC0 24.5 MHz Internal Oscillator
HFOSC0 is a programmable internal high-frequency oscillator that is factory-calibrated to 24.5 MHz. The oscillator is automatically enabled when it is requested. The oscillator period can be adjusted via the HFO0CAL register to obtain other frequencies.
Note: Changing the HFO0CAL register value from its default value may degrade the frequency stability of the oscillator across temperature and supply voltage.
8.3.3 HFOSC1 48 MHz Internal Oscillator
HFOSC1 is a programmable internal high-frequency oscillator that is factory-calibrated to 48 MHz. The oscillator is automatically enabled when it is requested. The oscillator period can be adjusted via the HFO1CAL register to obtain other frequencies.
Note: Changing the HFO1CAL register value from its default value may degrade the frequency stability of the oscillator across temperature and supply voltage.
Note: HFOSC0 consumes less current when enabled than HFOSC1.
8.3.4 LFOSC0 80 kHz Internal Oscillator
LFOSC0 is a progammable low-frequency oscillator, factory calibrated to a nominal frequency of 80 kHz. A dedicated divider at the
oscillator output is capable of dividing the output clock by 1, 2, 4, or 8, using the OSCLD bits in the LFO0CN register. The OSCLF bits
can be used to coarsely adjust the oscillator’s output frequency.
The LFOSC0 circuit requires very little start-up time and may be selected as the system clock immediately following the register write
which enables the oscillator.
Calibrating LFOSC0
On-chip calibration of the LFOSC0 can be performed using a timer to capture the oscillator period, when running from a known time
base. When a timer is configured for L-F Oscillator capture mode, a falling edge of the low-frequency oscillator’s output will cause a
capture event on the corresponding timer. As a capture event occurs, the current timer value is copied into the timer reload registers.
By recording the difference between two successive timer capture values, the low-frequency oscillator’s period can be calculated. The
OSCLF bits can then be adjusted to produce the desired oscillator frequency.
8.3.5 External Clock
An external CMOS clock source is also supported as a core clock source. The EXTCLK pin on the device serves as the external clock
input when running in this mode. The EXTCLK input may also be used to clock certain digital peripherals (e.g., Timers, PCA, etc.) while
SYSCLK runs from one of the internal oscillator sources. When not selected as the SYSCLK source, the EXTCLK input is always resynchronized to SYSCLK.
Note: When selecting the EXTCLK pin as a clock input source, the pin should be skipped in the crossbar and configured as a digital
input. Firmware should ensure that the external clock source is present or enable the missing clock detector before switching the
CLKSL field.
silabs.com | Building a more connected world.Rev. 0.2 | 72
Page 73
EFM8UB3 Reference Manual
Clocking and Oscillators
8.4 Clocking and Oscillator Control Registers
8.4.1 CLKSEL: Clock Select
Bit76543210
NameDIVRDYCLKDIVReservedCLKSL
AccessRRWRRW
Reset10x300x0
SFR Page = ALL; SFR Address: 0xA9
BitNameResetAccess Description
7DIVRDY1RClock Divider Ready.
Indicates when the clock has propagated through the divider with the current CLKDIV setting.
ValueNameDescription
0NOT_READYClock has not propagated through divider yet.
1READYClock has propagated through divider.
6:4CLKDIV0x3RWClock Source Divider.
This field controls the divider applied to the clock source selected by CLKSL. The output of this divider is the system clock
(SYSCLK).
ValueNameDescription
0x0SYSCLK_DIV_1SYSCLK is equal to selected clock source divided by 1.
0x1SYSCLK_DIV_2SYSCLK is equal to selected clock source divided by 2.
0x2SYSCLK_DIV_4SYSCLK is equal to selected clock source divided by 4.
0x3SYSCLK_DIV_8SYSCLK is equal to selected clock source divided by 8.
0x4SYSCLK_DIV_16SYSCLK is equal to selected clock source divided by 16.
0x5SYSCLK_DIV_32SYSCLK is equal to selected clock source divided by 32.
0x6SYSCLK_DIV_64SYSCLK is equal to selected clock source divided by 64.
0x7SYSCLK_DIV_128SYSCLK is equal to selected clock source divided by 128.
3ReservedMust write reset value.
2:0CLKSL0x0RWClock Source Select.
Selects the system clock source.
ValueNameDescription
0x0HFOSC0Clock derived from the Internal High Frequency Oscillator 0.
0x1EXTOSCClock derived from the External Oscillator circuit.
0x2LFOSCClock derived from the Internal Low-Frequency Oscillator.
0x3HFOSC1Clock derived from the Internal High Frequency Oscillator 1.
0x4HFOSC0_DIV_1P5Clock derived from the Internal High Frequency Oscillator 0, pre-scaled
by 1.5.
silabs.com | Building a more connected world.Rev. 0.2 | 73
Page 74
EFM8UB3 Reference Manual
Clocking and Oscillators
BitNameResetAccess Description
0x7HFOSC1_DIV_1P5Clock derived from the Internal High Frequency Oscillator 1, pre-scaled
by 1.5.
This device family has restrictions when switching to clock sources that are greater than 25 MHz. SYSCLK must be running at a frequency of 24 MHz or greater before switching the CLKSL field to HFOSC1. When transitioning from slower clock frequencies, firmware should make two writes to CLKSEL.
8.4.2 HFO0CAL: High Frequency Oscillator 0 Calibration
Bit76543210
NameHFO0CAL
AccessRW
ResetVaries
SFR Page = 0x0, 0x10; SFR Address: 0xC7
BitNameResetAccess Description
7:0HFO0CALVariesRWOscillator Calibration.
These bits determine the period for high frequency oscillator 0. When set to 0x00, the oscillator operates at its fastest setting. When set to 0xFF, the oscillator operates at its slowest setting. The reset value is factory calibrated, and the oscillator
will revert to the calibrated frequency upon reset.
8.4.3 HFO1CAL: High Frequency Oscillator 1 Calibration
Bit76543210
NameReservedHFO1CAL
AccessRRW
Reset0Varies
SFR Page = 0x10; SFR Address: 0xD6
BitNameResetAccess Description
7ReservedMust write reset value.
6:0HFO1CALVariesRWOscillator Calibration.
These bits determine the period for high frequency oscillator 1. When set to 0x00, the oscillator operates at its fastest setting. When set to 0x7F, the oscillator operates at its slowest setting. The reset value is factory calibrated, and the oscillator
will revert to the calibrated frequency upon reset.
silabs.com | Building a more connected world.Rev. 0.2 | 74
Page 75
EFM8UB3 Reference Manual
Clocking and Oscillators
8.4.4 HFOCN: High Frequency Oscillator Control
Bit76543210
NameHFO1ENReservedHFO0ENReserved
AccessRWRRWR
Reset00x000x0
SFR Page = 0x10; SFR Address: 0xEF
BitNameResetAccess Description
7HFO1EN0RWHFOSC1 Oscillator Enable.
ValueNameDescription
0DISABLEDDisable High Frequency Oscillator 1 (HFOSC1 will still turn on if re-
quested by any block in the device or selected as the SYSCLK source).
1ENABLEDForce High Frequency Oscillator 1 to run.
6:4ReservedMust write reset value.
3HFO0EN0RWHFOSC0 Oscillator Enable.
ValueNameDescription
0DISABLEDDisable High Frequency Oscillator 0 (HFOSC0 will still turn on if re-
quested by any block in the device or selected as the SYSCLK source).
1ENABLEDForce High Frequency Oscillator 0 to run.
2:0ReservedMust write reset value.
silabs.com | Building a more connected world.Rev. 0.2 | 75
Page 76
EFM8UB3 Reference Manual
Clocking and Oscillators
8.4.5 LFO0CN: Low Frequency Oscillator Control
Bit76543210
NameOSCLENOSCLRDYOSCLFOSCLD
AccessRWRRWRW
Reset01Varies0x3
SFR Page = 0x0, 0x10; SFR Address: 0xB1
BitNameResetAccess Description
7OSCLEN0RWInternal L-F Oscillator Enable.
This bit enables the internal low-frequency oscillator. Note that the low-frequency oscillator is automatically enabled when
the watchdog timer is active.
ValueNameDescription
0DISABLEDInternal L-F Oscillator Disabled.
1ENABLEDInternal L-F Oscillator Enabled.
6OSCLRDY1RInternal L-F Oscillator Ready.
ValueNameDescription
0NOT_SETInternal L-F Oscillator frequency not stabilized.
1SETInternal L-F Oscillator frequency stabilized.
5:2OSCLFVariesRWInternal L-F Oscillator Frequency Control.
Fine-tune control bits for the Internal L-F oscillator frequency. When set to 0000b, the L-F oscillator operates at its fastest
setting. When set to 1111b, the L-F oscillator operates at its slowest setting. The OSCLF bits should only be changed by
firmware when the L-F oscillator is disabled (OSCLEN = 0).
OSCLRDY is only set back to 0 in the event of a device reset or a change to the OSCLD bits.
silabs.com | Building a more connected world.Rev. 0.2 | 76
Page 77
EFM8UB3 Reference Manual
Reset Sources and Power Supply Monitor
9. Reset Sources and Power Supply Monitor
9.1 Introduction
Reset circuitry allows the controller to be easily placed in a predefined default condition. On entry to this reset state, the following occur:
• The core halts program execution.
• Module registers are initialized to their defined reset values unless the bits reset only with a power-on reset.
• External port pins are forced to a known state.
• Interrupts and timers are disabled.
All registers are reset to the predefined values noted in the register descriptions unless the bits only reset with a power-on reset. The
contents of RAM are unaffected during a reset; any previously stored data is preserved as long as power is not lost. The Port I/O latches are reset to 1 in open-drain mode. Weak pullups are enabled during and after the reset. For Supply Monitor and power-on resets,
the RSTb pin is driven low until the device exits the reset state. On exit from the reset state, the program counter (PC) is reset, and the
system clock defaults to an internal oscillator. The Watchdog Timer is enabled, and program execution begins at location 0x0000.
Reset Sources
RSTb
Supply Monitor or
Power-up
Missing Clock Detector
Watchdog Timer
Software Reset
Comparator 0
Flash Error
USB Reset
9.2 Features
Reset sources on the device include:
• Power-on reset
• External reset pin
• Comparator reset
• Software-triggered reset
• Supply monitor reset (monitors VDD supply)
• Watchdog timer reset
• Missing clock detector reset
• Flash error reset
• USB reset
system reset
Figure 9.1. Reset Sources Block Diagram
silabs.com | Building a more connected world.Rev. 0.2 | 77
Page 78
EFM8UB3 Reference Manual
Reset Sources and Power Supply Monitor
9.3 Functional Description
9.3.1 Device Reset
Upon entering a reset state from any source, the following events occur:
• The processor core halts program execution.
• Special Function Registers (SFRs) are initialized to their defined reset values.
• External port pins are placed in a known state.
• Interrupts and timers are disabled.
SFRs are reset to the predefined reset values noted in the detailed register descriptions. The contents of internal data memory are
unaffected during a reset; any previously stored data is preserved. However, since the stack pointer SFR is reset, the stack is effectively lost, even though the data on the stack is not altered.
The port I/O latches are reset to 0xFF (all logic ones) in open-drain mode. Weak pullups are enabled during and after the reset. For
Supply Monitor and power-on resets, the RSTb pin is driven low until the device exits the reset state.
Note: During a power-on event, there may be a short delay before the POR circuitry fires and the RSTb pin is driven low. During that
time, the RSTb pin will be weakly pulled to the supply pin.
On exit from the reset state, the program counter (PC) is reset, the watchdog timer is enabled, and the system clock defaults to an
internal oscillator. Program execution begins at location 0x0000.
silabs.com | Building a more connected world.Rev. 0.2 | 78
Page 79
EFM8UB3 Reference Manual
Reset Sources and Power Supply Monitor
9.3.2 Power-On Reset
During power-up, the POR circuit fires. When POR fires, the device is held in a reset state and the RSTb pin is driven low until the
supply voltage settles above V
. Two delays are present during the supply ramp time. First, a delay occurs before the POR circuitry
RST
fires and pulls the RSTb pin low. A second delay occurs before the device is released from reset; the delay decreases as the supply
ramp time (T
supply must reach V
) increases (supply ramp time is defined as how fast the supply pin ramps from 0 V to V
RMP
before the POR circuit releases the device from reset.
RST
). Additionally, the power
RST
On exit from a power-on reset, the PORSF flag is set by hardware to logic 1. When PORSF is set, all of the other reset flags in the
RSTSRC register are indeterminate. (PORSF is cleared by all other resets.) Since all resets cause program execution to begin at the
same location (0x0000), software can read the PORSF flag to determine if a power-up was the cause of reset. The content of internal
data memory should be assumed to be undefined after a power-on reset. The supply monitor is enabled following a power-on reset.
volts
Logic HIGH
Logic LOW
RSTb
Supply Voltage
T
POR
Power-On Reset
t
Figure 9.2. Power-On Reset Timing
silabs.com | Building a more connected world.Rev. 0.2 | 79
Page 80
EFM8UB3 Reference Manual
Reset Sources and Power Supply Monitor
9.3.3 Supply Monitor Reset
The supply monitor senses the voltage on the device's supply pin and can generate a reset if the supply drops below the corresponding
threshold. This monitor is enabled and enabled as a reset source after initial power-on to protect the device until the supply is an adequate and stable voltage. When enabled and selected as a reset source, any power down transition or power irregularity that causes
the supply to drop below the reset threshold will drive the RSTb pin low and hold the core in a reset state. When the supply returns to a
level above the reset threshold, the monitor will release the core from the reset state. The reset status can then be read using the device reset sources module. After a power-fail reset, the PORF flag reads 1 and all of the other reset flags in the RSTSRC register are
indeterminate. The power-on reset delay (t
invalid after a supply monitor reset. The enable state of the supply monitor and its selection as a reset source is not altered by device
resets. For example, if the supply monitor is de-selected as a reset source and disabled by software using the VDMEN bit in the
VDM0CN register, and then firmware performs a software reset, the supply monitor will remain disabled and de-selected after the reset.
To protect the integrity of flash contents, the supply monitor must be enabled and selected as a reset source if software contains routines that erase or write flash memory. If the supply monitor is not enabled, any erase or write performed on flash memory will be ignored.
) is not incurred after a supply monitor reset. The contents of RAM should be presumed
POR
Reset Threshold
(V
RST
RSTb
volts
)
Supply Monitor
Reset
Supply Voltage
t
Figure 9.3. Reset Sources
9.3.4 External Reset
The external RSTb pin provides a means for external circuitry to force the device into a reset state. Asserting an active-low signal on
the RSTb pin generates a reset; an external pullup and/or decoupling of the RSTb pin may be necessary to avoid erroneous noiseinduced resets. The PINRSF flag is set on exit from an external reset.
9.3.5 Missing Clock Detector Reset
The Missing Clock Detector (MCD) is a one-shot circuit that is triggered by the system clock. If the system clock remains high or low for
more than the MCD time window, the one-shot will time out and generate a reset. After a MCD reset, the MCDRSF flag will read 1,
signifying the MCD as the reset source; otherwise, this bit reads 0. Writing a 1 to the MCDRSF bit enables the Missing Clock Detector;
writing a 0 disables it. The state of the RSTb pin is unaffected by this reset.
silabs.com | Building a more connected world.Rev. 0.2 | 80
Page 81
EFM8UB3 Reference Manual
Reset Sources and Power Supply Monitor
9.3.6 Comparator (CMP0) Reset
Comparator0 can be configured as a reset source by writing a 1 to the C0RSEF flag. Comparator0 should be enabled and allowed to
settle prior to writing to C0RSEF to prevent any turn-on chatter on the output from generating an unwanted reset. The Comparator0
reset is active-low: if the non-inverting input voltage (on CP0+) is less than the inverting input voltage (on CP0–), the device is put into
the reset state. After a Comparator0 reset, the C0RSEF flag will read 1 signifying Comparator0 as the reset source; otherwise, this bit
reads 0. The state of the RSTb pin is unaffected by this reset.
9.3.7 Watchdog Timer Reset
The programmable Watchdog Timer (WDT) can be used to prevent software from running out of control during a system malfunction.
The WDT function can be enabled or disabled by software as described in the watchdog timer section. If a system malfunction prevents
user software from updating the WDT, a reset is generated and the WDTRSF bit is set to 1. The state of the RSTb pin is unaffected by
this reset.
9.3.8 Flash Error Reset
If a flash read/write/erase or program read targets an illegal address, a system reset is generated. This may occur due to any of the
following:
• A flash write or erase is attempted above user code space.
• A flash read is attempted above user code space.
• A program read is attempted above user code space (i.e., a branch instruction to the reserved area).
• A flash read, write or erase attempt is restricted due to a flash security setting.
The FERROR bit is set following a flash error reset. The state of the RSTb pin is unaffected by this reset.
9.3.9 Software Reset
Software may force a reset by writing a 1 to the SWRSF bit. The SWRSF bit will read 1 following a software forced reset. The state of
the RSTb pin is unaffected by this reset.
9.3.10 USB Reset
Writing 1 to the USBRSF bit selects USB0 as a reset source. With USB0 selected as a reset source, a system reset will be generated
when either of the following occur:
• RESET signaling is detected on the USB network. The USB Function Controller (USB0) must be enabled for RESET signaling to be
detected.
• A falling or rising voltage on the VBUS pin.
The USBRSF bit will read 1 following a USB reset. The state of the RSTb pin is unaffected by this reset.
silabs.com | Building a more connected world.Rev. 0.2 | 81
Page 82
EFM8UB3 Reference Manual
Reset Sources and Power Supply Monitor
9.4 Reset Sources and Supply Monitor Control Registers
Read: This bit reads 1 if USB caused the last reset.
Write: Writing a 1 to this bit enables the USB0 module as a reset source.
6FERRORVariesRFlash Error Reset Flag.
This read-only bit is set to '1' if a flash read/write/erase error caused the last reset.
5C0RSEFVariesRWComparator0 Reset Enable and Flag.
Read: This bit reads 1 if Comparator 0 caused the last reset.
Write: Writing a 1 to this bit enables Comparator 0 (active-low) as a reset source.
4SWRSFVariesRWSoftware Reset Force and Flag.
Read: This bit reads 1 if last reset was caused by a write to SWRSF.
Write: Writing a 1 to this bit forces a system reset.
3WDTRSFVariesRWatchdog Timer Reset Flag.
This read-only bit is set to '1' if a watchdog timer overflow caused the last reset.
2MCDRSFVariesRWMissing Clock Detector Enable and Flag.
Read: This bit reads 1 if a missing clock detector timeout caused the last reset.
Write: Writing a 1 to this bit enables the missing clock detector. The MCD triggers a reset if a missing clock condition is
detected.
1PORSFVariesRWPower-On / Supply Monitor Reset Flag, and Supply Monitor Reset
Enable.
Read: This bit reads 1 anytime a power-on or supply monitor reset has occurred.
Write: Writing a 1 to this bit enables the supply monitor as a reset source.
0PINRSFVariesRHW Pin Reset Flag.
This read-only bit is set to '1' if the RSTb pin caused the last reset.
Reads and writes of the RSTSRC register access different logic in the device. Reading the register always returns status information
to indicate the source of the most recent reset. Writing to the register activates certain options as reset sources. It is recommended to
not use any kind of read-modify-write operation on this register.
When the PORSF bit reads back '1' all other RSTSRC flags are indeterminate.
Writing '1' to the PORSF bit when the supply monitor is not enabled and stabilized may cause a system reset.
silabs.com | Building a more connected world.Rev. 0.2 | 82
Page 83
EFM8UB3 Reference Manual
Reset Sources and Power Supply Monitor
9.4.2 VDM0CN: Supply Monitor Control
Bit76543210
NameVDMENVDDSTATReserved
AccessRWRR
ResetVariesVariesVaries
SFR Page = 0x0; SFR Address: 0xFF
BitNameResetAccess Description
7VDMENVariesRWSupply Monitor Enable.
This bit turns the supply monitor circuit on/off. The supply monitor cannot generate system resets until it is also selected as
a reset source in register RSTSRC. Selecting the supply monitor as a reset source before it has stabilized may generate a
system reset. In systems where this reset would be undesirable, a delay should be introduced between enabling the supply
monitor and selecting it as a reset source.
ValueNameDescription
0DISABLEDSupply Monitor Disabled.
1ENABLEDSupply Monitor Enabled.
6VDDSTATVariesRSupply Status.
This bit indicates the current power supply status (supply monitor output).
ValueNameDescription
0BELOWVDD is at or below the supply monitor threshold.
1ABOVEVDD is above the supply monitor threshold.
5:0ReservedMust write reset value.
silabs.com | Building a more connected world.Rev. 0.2 | 83
Page 84
DATA BUS
TMP1TMP2
PRGM. ADDRESS REG.
PC INCREMENTER
ALU
PSW
DATA BUS
DATA BUS
MEMORY
INTERFACE
MEM_ADDRESS
D8
PIPELINE
BUFFER
DATA POINTER
INTERRUPT
INTERFACE
SYSTEM_IRQs
EMULATION_IRQ
MEM_CONTROL
CONTROL
LOGIC
A16
PROGRAM COUNTER (PC)
STOP
CLOCK
RESET
IDLE
POWER CONTROL
REGISTER
DATA BUS
SFR
BUS
INTERFACE
SFR_ADDRESS
SFR_CONTROL
SFR_WRITE_DATA
SFR_READ_DATA
D8
D8
B REGISTER
D8
D8
ACCUMULATOR
D8
D8
D8
D8
D8
D8
D8
D8
MEM_WRITE_DATA
MEM_READ_DATA
D8
SRAM
ADDRESS
REGISTER
SRAM
(256 X 8)
D8
STACK POINTER
D8
EFM8UB3 Reference Manual
CIP-51 Microcontroller Core
10. CIP-51 Microcontroller Core
10.1 Introduction
The CIP-51 microcontroller core is a high-speed, pipelined, 8-bit core utilizing the standard MCS-51™ instruction set. Any standard
803x/805x assemblers and compilers can be used to develop software. The MCU family has a superset of all the peripherals included
with a standard 8051. The CIP-51 includes on-chip debug hardware and interfaces directly with the analog and digital subsystems providing a complete data acquisition or control system solution.
Figure 10.1. CIP-51 Block Diagram
silabs.com | Building a more connected world.Rev. 0.2 | 84
Page 85
EFM8UB3 Reference Manual
CIP-51 Microcontroller Core
Performance
The CIP-51 employs a pipelined architecture that greatly increases its instruction throughput over the standard 8051 architecture. The
CIP-51 core executes 76 of its 109 instructions in one or two clock cycles, with no instructions taking more than eight clock cycles. The
table below shows the distribution of instructions vs. the number of clock cycles required for execution.
Table 10.1. Instruction Execution Timing
Clocks to
122 or 3*33 or 4*44 or 5*58
Execute
Number of
265051473121
Instructions
Notes:
1. Conditional branch instructions (indicated by "2 or 3*", "3 or 4*" and "4 or 5*") require extra clock cycles if the branch is taken. See
the instruction table for more information.
10.2 Features
The CIP-51 Microcontroller core implements the standard 8051 organization and peripherals as well as additional custom peripherals
and functions to extend its capability. The CIP-51 includes the following features:
• Fast, efficient, pipelined architecture.
• Fully compatible with MCS-51 instruction set.
• 0 to 50 MHz operating clock frequency.
• 50 MIPS peak throughput with 50 MHz clock.
• Extended interrupt handler.
• Power management modes.
• On-chip debug logic.
• Program and data memory security.
10.3 Functional Description
10.3.1 Programming and Debugging Support
In-system programming of the flash program memory and communication with on-chip debug support logic is accomplished via the Silicon Labs 2-Wire development interface (C2).
The on-chip debug support logic facilitates full speed in-circuit debugging, allowing the setting of hardware breakpoints, starting, stopping and single stepping through program execution (including interrupt service routines), examination of the program's call stack, and
reading/writing the contents of registers and memory. This method of on-chip debugging is completely non-intrusive, requiring no RAM,
stack, timers, or other on-chip resources.
The CIP-51 is supported by development tools from Silicon Labs and third party vendors. Silicon Labs provides an integrated development environment (IDE) including editor, debugger and programmer. The IDE's debugger and programmer interface to the CIP-51 via
the C2 interface to provide fast and efficient in-system device programming and debugging. Third party macro assemblers and C compilers are also available.
10.3.2 Prefetch Engine
The CIP-51 core incorporates a multi-byte prefetch engine to enable faster core clock speeds. Because the access time of the flash
memory is 40 ns, and the minimum instruction time is 13.6 ns, the prefetch engine is necessary for full-speed code execution. Multiple
instruction bytes are read from flash memory by the prefetch engine and given to the CIP-51 processor core to execute. When running
linear code (code without any jumps or branches), the prefetch engine allows instructions to be executed at full speed. When a code
branch occurs, the processor may be stalled for up to five clock cycles (FLRT = 2) or three clock cycles (FLRT = 1) while the next set of
code bytes is retrieved from flash memory.
When operating at speeds greater than 25 MHz, the prefetch engine must be used. To enable the prefetch engine, the FLRT bit field
should be configured to the desired speed setting. For example, if running between 25 and 48 MHz, FLRT should be set to 1. When
changing clocks, the FLRT field should be set to the higher number during the clock change, to ensure that flash is never read too
quickly.
silabs.com | Building a more connected world.Rev. 0.2 | 85
Page 86
EFM8UB3 Reference Manual
CIP-51 Microcontroller Core
10.3.3 Instruction Set
The instruction set of the CIP-51 System Controller is fully compatible with the standard MCS-51™ instruction set. Standard 8051 development tools can be used to develop software for the CIP-51. All CIP-51 instructions are the binary and functional equivalent of their
MCS-51™ counterparts, including opcodes, addressing modes and effect on PSW flags. However, instruction timing is much faster
than that of the standard 8051.
All instruction timing on the CIP-51 controller is based directly on the core clock timing. This is in contrast to many other 8-bit architectures, where a distinction is made between machine cycles and clock cycles, with machine cycles taking multiple core clock cycles.
Due to the pipelined architecture of the CIP-51, most instructions execute in the same number of clock cycles as there are program
bytes in the instruction. Conditional branch instructions take one less clock cycle to complete when the branch is not taken as opposed
to when the branch is taken. The following table summarizes the instruction set, including the mnemonic, number of bytes, and number
of clock cycles for each instruction.
Table 10.2. CIP-51 Instruction Set Summary
MnemonicDescriptionBytesClock Cycles
prefetch offprefetch on
Arithmetic Operations
ADD A, RnAdd register to A111
ADD A, directAdd direct byte to A222
ADD A, @RiAdd indirect RAM to A122
ADD A, #dataAdd immediate to A222
ADDC A, RnAdd register to A with carry111
ADDC A, directAdd direct byte to A with carry222
ADDC A, @RiAdd indirect RAM to A with carry122
ADDC A, #dataAdd immediate to A with carry222
SUBB A, RnSubtract register from A with borrow111
SUBB A, directSubtract direct byte from A with borrow222
SUBB A, @RiSubtract indirect RAM from A with borrow122
SUBB A, #dataSubtract immediate from A with borrow222
INC AIncrement A111
INC RnIncrement register111
INC directIncrement direct byte222
INC @RiIncrement indirect RAM122
DEC ADecrement A111
DEC RnDecrement register111
DEC directDecrement direct byte222
DEC @RiDecrement indirect RAM122
INC DPTRIncrement Data Pointer111
MUL ABMultiply A and B144
DIV ABDivide A by B188
DA ADecimal adjust A111
Logical Operations
silabs.com | Building a more connected world.Rev. 0.2 | 86
Page 87
EFM8UB3 Reference Manual
CIP-51 Microcontroller Core
MnemonicDescriptionBytesClock Cycles
prefetch offprefetch on
ANL A, RnAND Register to A111
ANL A, directAND direct byte to A222
ANL A, @RiAND indirect RAM to A122
ANL A, #dataAND immediate to A222
ANL direct, AAND A to direct byte222
ANL direct, #dataAND immediate to direct byte333
ORL A, RnOR Register to A111
ORL A, directOR direct byte to A222
ORL A, @RiOR indirect RAM to A122
ORL A, #dataOR immediate to A222
ORL direct, AOR A to direct byte222
ORL direct, #dataOR immediate to direct byte333
XRL A, RnExclusive-OR Register to A111
XRL A, directExclusive-OR direct byte to A222
XRL A, @RiExclusive-OR indirect RAM to A122
XRL A, #dataExclusive-OR immediate to A222
XRL direct, AExclusive-OR A to direct byte222
XRL direct, #dataExclusive-OR immediate to direct byte333
CLR AClear A111
CPL AComplement A111
RL ARotate A left111
RLC ARotate A left through Carry111
RR ARotate A right111
RRC ARotate A right through Carry111
SWAP ASwap nibbles of A111
Data Transfer
MOV A, RnMove Register to A111
MOV A, directMove direct byte to A222
MOV A, @RiMove indirect RAM to A122
MOV A, #dataMove immediate to A222
MOV Rn, AMove A to Register111
MOV Rn, directMove direct byte to Register222
MOV Rn, #dataMove immediate to Register222
MOV direct, AMove A to direct byte222
MOV direct, RnMove Register to direct byte222
MOV direct, directMove direct byte to direct byte333
silabs.com | Building a more connected world.Rev. 0.2 | 87
Page 88
EFM8UB3 Reference Manual
CIP-51 Microcontroller Core
MnemonicDescriptionBytesClock Cycles
prefetch offprefetch on
MOV direct, @RiMove indirect RAM to direct byte222
MOV direct, #dataMove immediate to direct byte333
MOV @Ri, AMove A to indirect RAM122
MOV @Ri, directMove direct byte to indirect RAM222
MOV @Ri, #dataMove immediate to indirect RAM222
MOV DPTR, #data16Load DPTR with 16-bit constant333
MOVC A, @A+DPTRMove code byte relative DPTR to A137
MOVC A, @A+PCMove code byte relative PC to A137
MOVX A, @RiMove external data (8-bit address) to A133
MOVX @Ri, AMove A to external data (8-bit address)133
MOVX A, @DPTRMove external data (16-bit address) to A133
MOVX @DPTR, AMove A to external data (16-bit address)133
PUSH directPush direct byte onto stack222
POP directPop direct byte from stack222
XCH A, RnExchange Register with A111
XCH A, directExchange direct byte with A222
XCH A, @RiExchange indirect RAM with A122
XCHD A, @RiExchange low nibble of indirect RAM with A122
Boolean Manipulation
CLR CClear Carry111
CLR bitClear direct bit222
SETB CSet Carry112
SETB bitSet direct bit222
CPL CComplement Carry111
CPL bitComplement direct bit222
ANL C, bitAND direct bit to Carry222
ANL C, /bitAND complement of direct bit to Carry222
ORL C, bitOR direct bit to carry222
ORL C, /bitOR complement of direct bit to Carry222
MOV C, bitMove direct bit to Carry222
MOV bit, CMove Carry to direct bit222
JC relJump if Carry is set22 or 32 or 6
JNC relJump if Carry is not set22 or 32 or 6
JB bit, relJump if direct bit is set33 or 43 or 7
JNB bit, relJump if direct bit is not set33 or 43 or 7
JBC bit, relJump if direct bit is set and clear bit33 or 43 or 7
silabs.com | Building a more connected world.Rev. 0.2 | 88
Page 89
EFM8UB3 Reference Manual
CIP-51 Microcontroller Core
MnemonicDescriptionBytesClock Cycles
prefetch offprefetch on
Program Branching
ACALL addr11Absolute subroutine call236
LCALL addr16Long subroutine call347
RETReturn from subroutine158
RETIReturn from interrupt158
AJMP addr11Absolute jump236
LJMP addr16Long jump347
SJMP relShort jump (relative address)236
JMP @A+DPTRJump indirect relative to DPTR136
JZ relJump if A equals zero22 or 32 or 6
JNZ relJump if A does not equal zero22 or 32 or 6
CJNE A, direct, relCompare direct byte to A and jump if not equal34 or 54 or 8
CJNE A, #data, relCompare immediate to A and jump if not equal33 or 43 or 7
CJNE Rn, #data, relCompare immediate to Register and jump if not
33 or 43 or 7
equal
CJNE @Ri, #data, relCompare immediate to indirect and jump if not
34 or 54 or 8
equal
DJNZ Rn, relDecrement Register and jump if not zero22 or 32 or 6
DJNZ direct, relDecrement direct byte and jump if not zero33 or 43 or 7
NOPNo operation111
Notes:
• Rn: Register R0–R7 of the currently selected register bank.
• @Ri: Data RAM location addressed indirectly through R0 or R1.
• rel: 8-bit, signed (twos complement) offset relative to the first byte of the following instruction. Used by SJMP and all conditional
jumps.
• direct: 8-bit internal data location’s address. This could be a direct-access Data RAM location (0x00–0x7F) or an SFR (0x80–
0xFF).
• #data: 8-bit constant.
• #data16: 16-bit constant.
• bit: Direct-accessed bit in Data RAM or SFR.
• addr11: 11-bit destination address used by ACALL and AJMP. The destination must be within the same 2 KB page of program
memory as the first byte of the following instruction.
• addr16: 16-bit destination address used by LCALL and LJMP. The destination may be anywhere within the 8 KB program memory
space.
silabs.com | Building a more connected world.Rev. 0.2 | 89
Page 90
EFM8UB3 Reference Manual
CIP-51 Microcontroller Core
10.4 CPU Core Registers
10.4.1 DPL: Data Pointer Low
Bit76543210
NameDPL
AccessRW
Reset0x00
SFR Page = ALL; SFR Address: 0x82
BitNameResetAccess Description
7:0DPL0x00RWData Pointer Low.
The DPL register is the low byte of the 16-bit DPTR. DPTR is used to access indirectly addressed flash memory or XRAM.
10.4.2 DPH: Data Pointer High
Bit76543210
NameDPH
AccessRW
Reset0x00
SFR Page = ALL; SFR Address: 0x83
BitNameResetAccess Description
7:0DPH0x00RWData Pointer High.
The DPH register is the high byte of the 16-bit DPTR. DPTR is used to access indirectly addressed flash memory or XRAM.
10.4.3 SP: Stack Pointer
Bit76543210
NameSP
AccessRW
Reset0x07
SFR Page = ALL; SFR Address: 0x81
BitNameResetAccess Description
7:0SP0x07RWStack Pointer.
The Stack Pointer holds the location of the top of the stack. The stack pointer is incremented before every PUSH operation.
The SP register defaults to 0x07 after reset.
silabs.com | Building a more connected world.Rev. 0.2 | 90
This bit is set when the last arithmetic operation resulted in a carry (addition) or a borrow (subtraction). It is cleared to logic
0 by all other arithmetic operations.
6AC0RWAuxiliary Carry Flag.
This bit is set when the last arithmetic operation resulted in a carry into (addition) or a borrow from (subtraction) the high
order nibble. It is cleared to logic 0 by all other arithmetic operations.
5F00RWUser Flag 0.
This is a bit-addressable, general purpose flag for use under firmware control.
4:3RS0x0RWRegister Bank Select.
These bits select which register bank is used during register accesses.
ValueNameDescription
0x0BANK0Bank 0, Addresses 0x00-0x07
0x1BANK1Bank 1, Addresses 0x08-0x0F
0x2BANK2Bank 2, Addresses 0x10-0x17
0x3BANK3Bank 3, Addresses 0x18-0x1F
2OV0RWOverflow Flag.
This bit is set to 1 under the following circumstances:
1. An ADD, ADDC, or SUBB instruction causes a sign-change overflow.
2. A MUL instruction results in an overflow (result is greater than 255).
3. A DIV instruction causes a divide-by-zero condition.
The OV bit is cleared to 0 by the ADD, ADDC, SUBB, MUL, and DIV instructions in all other cases.
1F10RWUser Flag 1.
This is a bit-addressable, general purpose flag for use under firmware control.
0PARITY0RParity Flag.
This bit is set to logic 1 if the sum of the eight bits in the accumulator is odd and cleared if the sum is even.
silabs.com | Building a more connected world.Rev. 0.2 | 92
Page 93
EFM8UB3 Reference Manual
CIP-51 Microcontroller Core
10.4.7 PFE0CN: Prefetch Engine Control
Bit76543210
NameReservedFLRTReserved
AccessRRWR
Reset0x000x0
SFR Page = 0x10; SFR Address: 0xC1
BitNameResetAccess Description
7:5ReservedMust write reset value.
4FLRT0RWFlash Read Timing.
This field should be programmed to the smallest allowed value, according to the system clock speed. When transitioning to
a faster clock speed, program FLRT before changing the clock. When changing to a slower clock speed, change the clock
before changing FLRT.
ValueNameDescription
0SYSCLK_BE-
LOW_25_MHZ
1SYSCLK_BE-
LOW_50_MHZ
3:0ReservedMust write reset value.
SYSCLK < 25 MHz.
SYSCLK < 50 MHz.
silabs.com | Building a more connected world.Rev. 0.2 | 93
Page 94
EFM8UB3 Reference Manual
Port I/O, Crossbar, External Interrupts, and Port Match
11. Port I/O, Crossbar, External Interrupts, and Port Match
11.1 Introduction
Digital and analog resources are externally available on the device’s multi-purpose I/O pins. Port pins P0.0-P1.6 can be defined as general-purpose I/O (GPIO), assigned to one of the internal digital resources through the crossbar or dedicated channels, or assigned to an
analog function. Port pins P2.0 and P2.1 can be used as GPIO. Additionally, the C2 Interface Data signal (C2D) is shared with P2.0.
The port control block offers the following features:
• Up to 17 multi-functions I/O pins, supporting digital and analog functions.
• Flexible priority crossbar decoder for digital peripheral assignment.
• Two drive strength settings for each port.
• Two direct-pin interrupt sources with dedicated interrupt vectors (INT0 and INT1).
• Up to 17 direct-pin interrupt sources with shared interrupt vector (Port Match).
silabs.com | Building a more connected world.Rev. 0.2 | 94
Page 95
EFM8UB3 Reference Manual
Port I/O, Crossbar, External Interrupts, and Port Match
11.3 Functional Description
11.3.1 Port I/O Modes of Operation
Port pins are configured by firmware as digital or analog I/O using the special function registers. Port I/O initialization consists of the
following general steps:
1. Select the input mode (analog or digital) for all port pins, using the Port Input Mode register (PnMDIN).
2. Select the output mode (open-drain or push-pull) for all port pins, using the Port Output Mode register (PnMDOUT).
3. Select any pins to be skipped by the I/O crossbar using the Port Skip registers (PnSKIP).
4. Assign port pins to desired peripherals.
5. Enable the crossbar (XBARE = 1).
A diagram of the port I/O cell is shown in the following figure.
WEAKPUD
(Weak Pull-Up Disable)
PxMDOUT.x
(1 for push-pull)
(0 for open-drain)
XBARE
(Crossbar
Enable)
Px.x – Output
Logic Value
(Port Latch or
Crossbar)
PxMDIN.x
(1 for digital)
To/From Analog
Peripheral
Px.x – Input Logic Value
(Reads 0 when pin is configured as an analog I/O)
(0 for analog)
VDD
GND
VDD
(WEAK)
PORT
PAD
Figure 11.2. Port I/O Cell Block Diagram
Configuring Port Pins For Analog Modes
Any pins to be used for analog functions should be configured for analog mode. When a pin is configured for analog I/O, its weak pullup, digital driver, and digital receiver are disabled. This saves power by eliminating crowbar current, and reduces noise on the analog
input. Pins configured as digital inputs may still be used by analog peripherals; however this practice is not recommended. Port pins
configured for analog functions will always read back a value of 0 in the corresponding Pn Port Latch register. To configure a pin as
analog, the following steps should be taken:
1. Clear the bit associated with the pin in the PnMDIN register to 0. This selects analog mode for the pin.
2. Set the bit associated with the pin in the Pn register to 1.
3. Skip the bit associated with the pin in the PnSKIP register to ensure the crossbar does not attempt to assign a function to the pin.
silabs.com | Building a more connected world.Rev. 0.2 | 95
Page 96
EFM8UB3 Reference Manual
Port I/O, Crossbar, External Interrupts, and Port Match
Configuring Port Pins For Digital Modes
Any pins to be used by digital peripherals or as GPIO should be configured as digital I/O (PnMDIN.n = 1). For digital I/O pins, one of
two output modes (push-pull or open-drain) must be selected using the PnMDOUT registers.
Push-pull outputs (PnMDOUT.n = 1) drive the port pad to the supply rails based on the output logic value of the port pin. Open-drain
outputs have the high side driver disabled; therefore, they only drive the port pad to the lowside rail when the output logic value is 0 and
become high impedance inputs (both high low drivers turned off) when the output logic value is 1.
When a digital I/O cell is placed in the high impedance state, a weak pull-up transistor pulls the port pad to the high side rail to ensure
the digital input is at a defined logic state. Weak pull-ups are disabled when the I/O cell is driven low to minimize power consumption,
and they may be globally disabled by setting WEAKPUD to 1. The user should ensure that digital I/O are always internally or externally
pulled or driven to a valid logic state to minimize power consumption. Port pins configured for digital I/O always read back the logic
state of the port pad, regardless of the output logic value of the port pin.
To configure a pin as a digital input:
1. Set the bit associated with the pin in the PnMDIN register to 1. This selects digital mode for the pin.
2. lear the bit associated with the pin in the PnMDOUT register to 0. This configures the pin as open-drain.
3. Set the bit associated with the pin in the Pn register to 1. This tells the output driver to “drive” logic high. Because the pin is configured as open-drain, the high-side driver is disabled, and the pin may be used as an input.
Open-drain outputs are configured exactly as digital inputs. The pin may be driven low by an assigned peripheral, or by writing 0 to the
associated bit in the Pn register if the signal is a GPIO.
To configure a pin as a digital, push-pull output:
1. Set the bit associated with the pin in the PnMDIN register to 1. This selects digital mode for the pin.
2. Set the bit associated with the pin in the PnMDOUT register to 1. This configures the pin as push-pull.
If a digital pin is to be used as a general-purpose I/O, or with a digital function that is not part of the crossbar, the bit associated with the
pin in the PnSKIP register can be set to 1 to ensure the crossbar does not attempt to assign a function to the pin. The crossbar must be
enabled to use port pins as standard port I/O in output mode. Port output drivers of all I/O pins are disabled whenever the crossbar is
disabled.
11.3.1.1 Port Drive Strength
Port drive strength can be controlled on a port-by-port basis using the PRTDRV register. Each port has a bit in PRTDRV to select the
high or low drive strength setting for all pins on that port. By default, all ports are configured for high drive strength.
11.3.2 Analog and Digital Functions
11.3.2.1 Port I/O Analog Assignments
The following table displays the potential mapping of port I/O to each analog function.
Table 11.1. Port I/O Assignment for Analog Functions
Analog FunctionPotentially Assignable Port PinsSFR(s) Used For Assignment
Port MatchP0.0 – P1.6, P2.1P0MASK, P0MAT, P1MASK, P1MAT,
P2MASK, P2MAT
VBUSP2.1USB0CF
Configurable Logic Inputs A and B
P0.0 – P1.6CLUnMX
(Assignable pins vary across CLUs)
Configurable Logic Unit 0 Output
P0.2CLU0CF
(CLU0OUT)
Configurable Logic Unit 1 Output
P0.4CLU1CF
(CLU1OUT)
Configurable Logic Unit 2 Output
P0.6CLU2CF
(CLU2OUT)
Configurable Logic Unit 3 Output
P1.0CLU3CF
(CLU3OUT)
Any pin used for GPIOP0.0 – P1.6, P2.1P0SKIP, P1SKIP
silabs.com | Building a more connected world.Rev. 0.2 | 97
Page 98
EFM8UB3 Reference Manual
Port I/O, Crossbar, External Interrupts, and Port Match
11.3.3 Priority Crossbar Decoder
The priority crossbar decoder assigns a priority to each I/O function, starting at the top with UART0. The XBRn registers are used to
control which crossbar resources are assigned to physical I/O port pins.
When a digital resource is selected, the least-significant unassigned port pin is assigned to that resource (excluding UART0, which is
always assigned to dedicated pins). If a port pin is assigned, the crossbar skips that pin when assigning the next selected resource.
Additionally, the the PnSKIP registers allow software to skip port pins that are to be used for analog functions, dedicated digital functions, or GPIO. If a port pin is to be used by a function which is not assigned through the crossbar, its corresponding PnSKIP bit should
be set to 1 in most cases. The crossbar skips these pins as if they were already assigned, and moves to the next unassigned pin.
It is possible for crossbar-assigned peripherals and dedicated functions to coexist on the same pin. For example, the port match function could be configured to watch for a falling edge on a UART RX line and generate an interrupt or wake up the device from a lowpower state. However, if two functions share the same pin, the crossbar will have control over the output characteristics of that pin and
the dedicated function will only have input access. Likewise, it is possible for firmware to read the logic state of any digital I/O pin assigned to a crossbar peripheral, but the output state cannot be directly modified.
Figure 11.3 Crossbar Priority Decoder Example Assignments on page 98 shows an example of the resulting pin assignments of the
device with UART1 and SPI0 enabled and P0.3 skipped (P0SKIP = 0x08). UART1 is the highest priority when URT1EL in XBR0 is set
to 1 and it will be assigned first. When URT1EL is set to 1, the UART1 pins can only appear at fixed locations (P0.4 and P0.5), so it
occupies those pins. The next-highest enabled peripheral is SPI0. P0.0, P0.1 and P0.2 are free, so SPI0 takes these three pins. The
fourth pin, NSS, is routed to P0.6 because P0.3 is skipped and P0.4 and P0.5 are already occupied by the UART. Any other pins on the
device are available for use as general-purpose digital I/O or analog functions.
P0Port
Pin Number
01234567
UART1-TX
UART1-RX
SPI0-SCK
SPI0-MISO
SPI0-MOSI
SPI0-NSS
0000000
1
Pin Skip Settings
P0SKIP
UART1 is assigned to fixed pins and has priority over SPI0.
SPI0 is assigned to available, un-skipped pins.
Port pins assigned to the associated peripheral.
P0.3 is skipped by setting P0SKIP.3 to 1.
Figure 11.3. Crossbar Priority Decoder Example Assignments
Note: UART1 pins appear in P0.4 and P0.5 when URT1EL is set in the XBR0 register for backwards compatibility with UART0 place-
ment on other devices. When URT1E in the XBR2 register is set, UART1 is available on any crossbar pin in standard priority order.
silabs.com | Building a more connected world.Rev. 0.2 | 98
Page 99
EFM8UB3 Reference Manual
Port I/O, Crossbar, External Interrupts, and Port Match
11.3.3.1 Crossbar Functional Map
The figure below shows all of the potential peripheral-to-pin assignments available to the crossbar. Note that this does not mean any
peripheral can always be assigned to the highlighted pins. The actual pin assignments are determined by the priority of the enabled
peripherals.
Pin Number
QFN-20 Package
QSOP-24 Package
QFN-24 Package
UART1-TX
UART1-RX
P0Port
0 1 2 3 4 5 6 7
VREF
AGND
EXTCLK
CLU1OUT
CLU0OUT
1
1
0 1 2 3 4 5 6
CLU3OUT
CNVSTR / CLU2OUT
P1
N/A
SPI0-SCK
SPI0-MISO
SPI0-MOSI
SPI0-NSS
2
SMB0-SDA
SMB0-SCL
CMP0-CP0
CMP0-CP0A
CMP1-CP1
CMP1-CP1A
SYSCLK
PCA0-CEX0
PCA0-CEX1
PCA0-CEX2
PCA0-ECI
Timer0-T0
Timer1-T1
Timer2-T2
UART1-TX
UART1-RX
UART1-RTS
UART1-CTS
Pin Skip Settings
0 0 0 0 0 0 0 0
P0SKIP
0 0 0 0 0 0 0
P1SKIP
The crossbar peripherals are assigned in priority order from top to bottom.
N/A
N/A
0 1
N/A
P2
C2D
VBUS
C2D
Pins Not Available on Crossbar
These boxes represent Port pins which can potentially be assigned to a peripheral.
Special Function Signals are not assigned by the crossbar. When these signals are
enabled, the Crossbar should be manually configured to skip the corresponding port pins.
Pins can be “skipped” by setting the corresponding bit in PnSKIP to 1.
Notes:
1. UART1 pins are available in these locations to be backwards compatible with UART0 on
other devices. UART1 is available either in the fixed P0.4 and P0.5 locations or the
standard UART1 crossbar locations. The pins should not be enabled in both locations at the
same time.
2. NSS is only pinned out when the SPI is in 4-wire mode.
Figure 11.4. Full Crossbar Map
silabs.com | Building a more connected world.Rev. 0.2 | 99
Page 100
EFM8UB3 Reference Manual
Port I/O, Crossbar, External Interrupts, and Port Match
11.3.4 INT0 and INT1
Two direct-pin digital interrupt sources (INT0 and INT1) are included, which can be routed to port 0 pins. Additional I/O interrupts are
available through the port match function. As is the case on a standard 8051 architecture, certain controls for these two interrupt sources are available in the Timer0/1 registers. Extensions to these controls which provide additional functionality are available in the
IT01CF register. INT0 and INT1 are configurable as active high or low, edge- or level-sensitive. The IN0PL and IN1PL bits in the
IT01CF register select active high or active low; the IT0 and IT1 bits in TCON select level- or edge-sensitive. The table below lists the
possible configurations.
Table 11.3. INT0/INT1 configuration
IT0 or IT1IN0PL or IN1PLINT0 or INT1 Interrupt
10Interrupt on falling edge
11Interrupt on rising edge
00Interrupt on low level
01Interrupt on high level
INT0 and INT1 are assigned to port pins as defined in the IT01CF register. INT0 and INT1 port pin assignments are independent of any
crossbar assignments, and may be assigned to pins used by crossbar peripherals. INT0 and INT1 will monitor their assigned port pins
without disturbing the peripheral that was assigned the port pin via the crossbar. To assign a port pin only to INT0 and/or INT1, configure the crossbar to skip the selected pin(s).
IE0 and IE1 in the TCON register serve as the interrupt-pending flags for the INT0 and INT1 external interrupts, respectively. If an INT0
or INT1 external interrupt is configured as edge-sensitive, the corresponding interrupt pending flag is automatically cleared by the hardware when the CPU vectors to the ISR. When configured as level sensitive, the interrupt-pending flag remains logic 1 while the input is
active as defined by the corresponding polarity bit (IN0PL or IN1PL); the flag remains logic 0 while the input is inactive. The external
interrupt source must hold the input active until the interrupt request is recognized. It must then deactivate the interrupt request before
execution of the ISR completes or another interrupt request will be generated.
11.3.5 Port Match
Port match functionality allows system events to be triggered by a logic value change on one or more port I/O pins. A software controlled value stored in the PnMATCH registers specifies the expected or normal logic values of the associated port pins (for example,
P0MATCH.0 would correspond to P0.0). A port mismatch event occurs if the logic levels of the port’s input pins no longer match the
software controlled value. This allows software to be notified if a certain change or pattern occurs on the input pins regardless of the
XBRn settings.
The PnMASK registers can be used to individually select which pins should be compared against the PnMATCH registers. A port mismatch event is generated if (Pn & PnMASK) does not equal (PnMATCH & PnMASK) for all ports with a PnMAT and PnMASK register.
A port mismatch event may be used to generate an interrupt or wake the device from low power modes. See the interrupts and power
options chapters for more details on interrupt and wake-up sources.
11.3.6 Direct Port I/O Access (Read/Write)
All port I/O are accessed through corresponding special function registers. When writing to a port, the value written to the SFR is latched to maintain the output data value at each pin. When reading, the logic levels of the port's input pins are returned regardless of the
XBRn settings (i.e., even when the pin is assigned to another signal by the crossbar, the port register can always read its corresponding
port I/O pin). The exception to this is the execution of the read-modify-write instructions that target a Port Latch register as the destination. The read-modify-write instructions when operating on a port SFR are the following: ANL, ORL, XRL, JBC, CPL, INC, DEC, DJNZ
and MOV, CLR or SETB, when the destination is an individual bit in a port SFR. For these instructions, the value of the latch register
(not the pin) is read, modified, and written back to the SFR.
silabs.com | Building a more connected world.Rev. 0.2 | 100
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.