Freelance Electronics Components Distributor
Closed Dec 25th-26th
800-300-1968
We Stock Hard to Find Parts

C8051F041-GQ

Part # C8051F041-GQ
Description MCU 8BIT CISC 64KB FLASH 3V 64TQFP - Trays
Category IC
Availability In Stock
Qty 2
Qty Price
1 + $20.05559
Manufacturer Available Qty
SILICON LABORATORIES
Date Code: 0903
  • Shipping Freelance Stock: 2
    Ships Immediately



Technical Document


DISCLAIMER: The information provided herein is solely for informational purposes. Customers must be aware of the suitability of this product for their application, and consider that variable factors such as Manufacturer, Product Category, Date Codes, Pictures and Descriptions may differ from available inventory.

C8051F040/1/2/3/4/5/6/7
178 Rev. 1.5
14.5. External RC Example
If an RC network is used as an external oscillator source for the MCU, the circuit should be configured as
shown in Figure 14.1, Option 2. The capacitor should be no greater than 100 pF; however, for very small
capacitors, the total capacitance may be dominated by parasitic capacitance in the PCB layout. To deter-
mine the required External Oscillator Frequency Control value (XFCN) in the OSCXCN Register, first
select the RC network value to produce the desired frequency of oscillation. If the frequency desired is
100 kHz, let R = 246 k and C = 50 pF:
f = 1.23( 10
3
) / RC = 1.23 ( 10
3
) / [ 246 x 50 ] = 0.1 MHz = 100 kHz
Referring to the table in SFR Definition 14.4, the required XFCN setting is 010b.
14.6. External Capacitor Example
If a capacitor is used as an external oscillator for the MCU, the circuit should be configured as shown in
Figure 14.1, Option 3. The capacitor should be no greater than 100 pF; however, for very small capacitors,
the total capacitance may be dominated by parasitic capacitance in the PCB layout. To determine the
required External Oscillator Frequency Control value (XFCN) in the OSCXCN Register, select the desired
frequency of oscillation and find the capacitor to be used from the equations below. Assume
V
DD
= 3.0 V
and f = 50 kHz:
f = KF / ( C x
V
DD
) = KF / ( C x 3 ) = 0.050 MHz
If a frequency of roughly 50 kHz is desired, select the K Factor from the table in SFR Definition 14.4 as
KF
= 7.7:
0.050 MHz = 7.7 / (C x 3)
C x 3 = 7.7 / 0.050 = 154, so C = 154 / 3 pF = 51.3 pF
Therefore, the XFCN value to use in this example is 010b.
C8051F040/1/2/3/4/5/6/7
Rev. 1.5 179
15. Flash Memory
The C8051F04x family includes 64 kB + 128 (C8051F040/1/2/3/4/5) or 32 kB + 128 (C8051F046/7) of on-
chip, reprogrammable Flash memory for program code and non-volatile data storage. The Flash memory
can be programmed in-system, a single byte at a time, through the JTAG interface or by software using the
MOVX write instructions. Once cleared to logic 0, a Flash bit must be erased to set it back to logic 1. The
bytes would typically be erased (set to 0xFF) before being reprogrammed. Flash write and erase opera-
tions are automatically timed by hardware for proper execution; data polling to determine the end of the
write/erase operation is not required. The CPU is stalled during write/erase operations while the device
peripherals remain active. Interrupts that occur during Flash write/erase operations are held, and are then
serviced in their priority order once the Flash operation has completed. Refer to Table 15.1 for the electri-
cal characteristics of the Flash memory.
15.1. Programming The Flash Memory
The simplest means of programming the Flash memory is through the JTAG interface using programming
tools provided by Silicon Labs or a third party vendor. This is the only means for programming a non-initial-
ized device. For details on the JTAG commands to program Flash memory, see Section “25.2. Flash Pro-
gramming Commands” on page 321.
The Flash memory can be programmed by software using the MOVX write instruction with the address and
data byte to be programmed provided as normal operands. Before writing to Flash memory using MOVX,
Flash write operations must be enabled by setting the PSWE Program Store Write Enable bit (PSCTL.0) to
logic 1. This directs the MOVX writes to Flash memory instead of to XRAM, which is the default target. The
PSWE bit remains set until cleared by software. To avoid errant Flash writes, it is recommended that inter-
rupts be disabled while the PSWE bit is logic 1.
Flash memory is read using the MOVC instruction. MOVX reads are always directed to XRAM, regardless
of the state of PSWE.
Note: To ensure the integrity of Flash memory contents, it is strongly recommended that the on-chip V
DD
monitor be enabled by connecting the V
DD
monitor enable pin (MONEN) to V
DD
in any system that exe-
cutes code that writes and/or erases Flash memory from software. See “Reset Sources” on page 165 for
more information.
A write to Flash memory can clear bits but cannot set them; only an erase operation can set bits in Flash.
A byte location to be programmed must be erased before a new value can be written. The Flash
memory is organized in 512-byte pages. The erase operation applies to an entire page (setting all bytes in
the page to 0xFF). The following steps illustrate the algorithm for programming Flash by user software.
Step 1. Disable interrupts.
Step 2. Set FLWE (FLSCL.0) to enable Flash writes/erases via user software.
Step 3. Set PSEE (PSCTL.1) to enable Flash erases.
Step 4. Set PSWE (PSCTL.0) to redirect MOVX commands to write to Flash.
Step 5. Use the MOVX command to write a data byte to any location within the 512-byte page to
be erased.
Step 6. Clear PSEE to disable Flash erases
Step 7. Use the MOVX command to write a data byte to the desired byte location within the
erased 512-byte page. Repeat this step until all desired bytes are written (within the target
page).
Step 8. Clear the PSWE bit to redirect MOVX commands to the XRAM data space.
Step 9. Re-enable interrupts.
Write/Erase timing is automatically controlled by hardware. Note that code execution in the 8051 is stalled
while the Flash is being programmed or erased. Note that 512 bytes at locations 0xFE00 (C8051F040/1/2/
C8051F040/1/2/3/4/5/6/7
180 Rev. 1.5
3/4/5) and all locations above 0x8000 (C8051F046/7) are reserved. Flash writes and erases targeting the
reserved area should be avoided.
15.2. Non-volatile Data Storage
The Flash memory can be used for non-volatile data storage as well as program code. This allows data
such as calibration coefficients to be calculated and stored at run time. Data is written using the MOVX
write instruction (as described in the previous section) and read using the MOVC instruction.
An additional 128-byte sector of Flash memory is included for non-volatile data storage. Its smaller sector
size makes it particularly well suited as general purpose, non-volatile scratchpad memory. Even though
Flash memory can be written a single byte at a time, an entire sector must be erased first. In order to
change a single byte of a multi-byte data set, the data must be moved to temporary storage. The 128-byte
sector-size facilitates updating data without wasting program memory or RAM space. The 128-byte sector
is double-mapped over the 64k byte Flash memory; its address ranges from 0x00 to 0x7F (see
Figure 15.1). To access this 128-byte sector, the SFLE bit in PSCTL must be set to logic 1. Code execution
from this 128-byte scratchpad sector is not permitted.
15.3. Security Options
The CIP-51 provides security options to protect the Flash memory from inadvertent modification by soft-
ware as well as prevent the viewing of proprietary program code and constants. The Program Store Write
Enable (PSCTL.0) and the Program Store Erase Enable (PSCTL.1) bits protect the Flash memory from
accidental modification by software. These bits must be explicitly set to logic 1 before software can write or
erase the Flash memory. Additional security features prevent proprietary program code and data constants
from being read or altered across the JTAG interface or by software running on the system controller.
A set of security lock bytes stored at 0xFDFE and 0xFDFF (C8051F040/1/2/3/4/5) and at 0x7FFE and
0x7FFF (C8051F046/7) protect the Flash program memory from being read or altered across the JTAG
interface. Each bit in a security lock-byte protects one 8k-byte block of memory. Clearing a bit to logic 0 in
a Read Lock Byte prevents the corresponding block of Flash memory from being read across the JTAG
interface. Clearing a bit in the Write/Erase Lock Byte protects the block from JTAG erasures and/or writes.
The Read Lock Byte is at locations 0xFDFF (C8051F040/1/2/3/4/5) and 0x7FFF (C8051F046/7). The
Write/Erase Lock Byte is located at 0xFDFE (C8051F040/1/2/3/4/5) and 0x7FFE (C8051F046/7).
Figure 15.1 shows the location and bit definitions of the security bytes. The 512-byte sector containing
the lock bytes can be written to, but not erased by software. An attempted read of a read-locked byte
returns undefined data. Debugging code in a read-locked sector is not possible through the JTAG inter-
face.
Table 15.1. Flash Electrical Characteristics
V
DD
= 2.7 to 3.6 V; T
a
= –40 to +85 °C
Parameter Conditions Min Typ Max Units
Flash Size
1
C8051F040/1/2/3/4/5
C8051F046/7
65664
2
32896
Bytes
Endurance
20 k 100 k Erase/Write
Erase Cycle Time
10 12 14 ms
Write Cycle Time
40 50 60 µs
Notes:
1. In
cludes 128-byte scratchpad.
2. 512 bytes at locations 0xFE00 to 0xFFFF are reserved.
PREVIOUS5354555657585960616263646566NEXT