Device Programming: 8.5.1 Erasure and Reprogramming
Device Programming: 8.5.1 Erasure and Reprogramming
com
Device Programming
8.5 Introduction
The SX device has a program memory consisting of 2,048 or 4,096 words of 12 bits per word, plus
some additional 12-bit words that specify the device configuration. This memory is a non-volatile,
electrically erasable (EEPROM) flash memory, rated for 10,000 rewrite cycles.
Before you can use the SX device, you must write the application code into the program memory. You
do this by placing the device into a programming mode and following the protocol for accessing the
program memory. You can write to the program memory only in the programming mode, not when the
device is executing the application software.
SX Family Design Specification Rev. B.0 162 © 1999 Scenix Semiconductor, Inc. All rights reserved.
Device Programming www.scenix.com
In the product development cycle, a separate “emulation” type device is not required. The controller
device used for development is the same as the one used for final production, including the package
type and pinout. The SX device can be soldered into the target system, and then programmed and
reprogrammed any number of times, without removing and reinstalling it. No special socket or support
circuitry is required, so the system can be debugged accurately, even in timing-sensitive and noise-
sensitive applications.
For manufacturing, circuit boards can be pre-built with the controller installed and soldered on the
board, even before the software has been finalized, to meet short time-to-market requirements.
Additional information such as vendor numbers and serial numbers can be programmed into the device
just prior to shipment. There is no risk of stocking out-dated, pre-programmed units because the
software can be corrected or updated at any time.
Even after the product is received by the customer, it can be quickly and easily revised or patched by
field service personnel. Customers can even reprogram their products themselves if they have the
necessary programming equipment. This equipment is relatively inexpensive and easy to use.
SX Family Design Specification Rev. B.0 163 © 1999 Scenix Semiconductor, Inc. All rights reserved.
www.scenix.com Device Programming
OSC1/Vpp2
OSC2
Internal RC clock
128 kHz
Figure 8-2 ISP Mode Entry and Exit with External Clocking
External Clocking
When the device is clocked by external components or an external clock signal, the programmer unit
should use the following procedure to place the SX device in the ISP programming mode:
1. Drive the OSC1 pin low to stop the clock.
2. Drive the OSC2 pin low and toggle the OSC1 pin at least nine times. This is the signal to enter
the ISP mode.
© 1999 Scenix Semiconductor, Inc. All rights reserved. 164 SX Family Design Specification Rev. B.0
Device Programming www.scenix.com
Vpp2
OSC1/Vpp2
OSC2
release OSC2
drive OSC2 long enough
Internal RC clock
Internal RC Oscillator
When the device is clocked by the internal RC oscillator, the programmer unit should use the following
procedure to place the SX device in the ISP programming mode:
1. Drive the OSC2 pin low for at least nine internal clock cycles. The internal clock frequency can
be any one of eight values ranging from 31.25 kHz to 4 MHz, depending on the divide-by rate
programmed into the FUSE word.
2. Release the OSC2 pin.
3. Apply the VPP programming voltage to the OSC1 pin. The SX internal RC oscillator starts op-
erating at 128 kHz. This clock drives the SX device during ISP mode programming.
SX Family Design Specification Rev. B.0 165 © 1999 Scenix Semiconductor, Inc. All rights reserved.
www.scenix.com Device Programming
1 cycle
© 1999 Scenix Semiconductor, Inc. All rights reserved. 166 SX Family Design Specification Rev. B.0
Device Programming www.scenix.com
In the four command cycles (C3-C0), the programmer writes a four-bit command to the ISP logic,
which tells the ISP logic what to do during the data cycles. In the 12 data cycles (D11-D0), for a “write”
operation, the programmer writes the 12 bits that are to be written to a memory location. For a “read”
operation, the programmer reads 12 bits supplied by the SX device from a memory location.
Internal Hardware
Figure 8-5 is a simplified block diagram of the chip-internal ISP hardware.
COMMAND EEPROM
DECODE CONTROL
OSC2 ~
~
DATA SHIFT REG
clk
To EEPROM IN
Serial data written to the OSC2 pin is shifted into the command shift register or data shift register,
depending on whether command bits or data bits are being processed within a frame. Command bits
are decoded and used to control the flash EEPROM block, while data bits are written to the flash
EEPROM.
When the command is to read data from the program memory, the data bits are read from the EEPROM
block and shifted out on the OSC2 pin during the data cycles. An open-drain transistor and a pullup
resistor pull the OSC2 pin low or high for each bit. This same transistor is used to pull the OSC2 pin
low during the second clock within each cycle (except in the sync cycle).
ISP Commands
The programmer unit writes a 4-bit command during the four command cycles at the beginning of each
frame, just after the sync cycle. This 4-bit command tells the ISP logic what to do during the remaining
12 cycles of the frame. Table 8-6 lists and describes the programming commands. Codes not listed in
the table are reserved for future expansion.
The commands that erase or program the EEPROM registers must be repeated consecutively for a
certain frames in order to work reliably. To determine the minimum required number of repetitions of
a command, look in the Electrical Characterization section of the device data sheet and find the
SX Family Design Specification Rev. B.0 167 © 1999 Scenix Semiconductor, Inc. All rights reserved.
www.scenix.com Device Programming
minimum time requirement for the operation. Divide this value by the frame period, 0.53 milliseconds,
and round up to the nearest whole number.
For example, if you find that the minimum time requirement for an “Erase” operation is 100 msec,
divide 100 by 0.53 and round up, and the result is 189. This means that you must repeat the “Erase”
command for at least 189 commands in order to complete the “Erase” operation reliably. “NOPs” can
be used in-between these 189 erase commands.
No repetition is necessary to read a register or to increment the memory address pointer. You can
complete one of these operations in just a single frame.
© 1999 Scenix Semiconductor, Inc. All rights reserved. 168 SX Family Design Specification Rev. B.0
Device Programming www.scenix.com
NOP Command
The NOP (no-operation) command causes the ISP logic to do nothing and wait for the next command.
The NOP command has a code of 1111 binary. Whenever the programmer unit is not driving to the
OSC2 pin, the internal pullup resistor pulls the pin high, which produces 1111 as the command string
and invokes the NOP command by default.
This is an important feature because the programmer unit needs some time to synchronize itself to the
pulses generated by the ISP logic, and cannot begin driving the OSC2 until synchronization is
achieved. In the meantime, the NOP command is executed by default, causing the ISP logic to wait for
the first active command.
SX Family Design Specification Rev. B.0 169 © 1999 Scenix Semiconductor, Inc. All rights reserved.
www.scenix.com Device Programming
Upon entry into the ISP mode, the ISP logic is set to access the FFFh or 1FFFh, which is the address
of the FUSE word. The FUSE word controls many of the device configuration options such as the
clocking, stack size, and Watchdog options. To read this initial memory location, the programmer unit
issues the “Read Data” command and reads the 12 bits of data in the data cycle portion of the frame.
To read the word at the next address, the programmer unit issues the “Increment Address” command.
This increments an internal pointer to the program memory, allowing access to address 000h. It does
not matter what the programmer unit does during the 12 data cycles of the “Increment Address” frame.
Following this frame, the programmer issues another “Read Data” command and reads the 12 bits of
data in the data cycle portion of the frame.
This sequence is repeated to read consecutive memory locations. The first memory location is FFFh
(2K device) or 1FFFh (4K device) (the FUSE word register), followed by 000h, 001h, 002h, and so on
up to the top memory address, 7FFh or FFFh. The programmer can skip over any number of memory
locations by repeating the “Increment Address” command consecutively, without using the “Read
Data” command. The “Increment Address” command must be used 2,048 or 4,096 times to traverse
the whole program memory.
© 1999 Scenix Semiconductor, Inc. All rights reserved. 170 SX Family Design Specification Rev. B.0
Device Programming www.scenix.com
2. On the next rising clock edge after the sync cycle, the SX device exits from the ISP mode and
generates an internal reset signal that resets the device. The programmer must observe the same
protocol until the end of this step.
3. The programmer releases the OSC1 pin, allowing the SX device to begin normal operation.
SX Family Design Specification Rev. B.0 171 © 1999 Scenix Semiconductor, Inc. All rights reserved.
www.scenix.com Device Programming
To protect the internal circuitry of the device, use a 100Ω resistor between the MCLR pin and the Vpp
power supply.
The RTCC pin is used to control the timing of programming operations. For each operation, the RTCC
signal must be asserted for at least a specific period of time in order to work reliably.
© 1999 Scenix Semiconductor, Inc. All rights reserved. 172 SX Family Design Specification Rev. B.0
Device Programming www.scenix.com
≥ 1 µs 12.5V
MCLR/Vpp 0V ≥ 1 µs
≥ 1 µs ≥ 1 µs
RB[7:0],
Command
RA[3:0]
RTCC
≥ 100 ns ≥ 100 ns
≥ 1 µs ≥ 20 ms
OSC1 Power on Reset ≥ 100 ms
RST (internal)
Erase(internal)
100 ms
SX Family Design Specification Rev. B.0 173 © 1999 Scenix Semiconductor, Inc. All rights reserved.
www.scenix.com Device Programming
4. Apply the programming voltage to the MCLR pin. This latches the “Erase” command and starts
the erase operation.
5. After the erase time has elapsed, apply a logic low signal to the RTCC pin.
6. Bring the MCLR pin back down to zero.
Vdd
0 ns hold time
≥ 1 µs 12.5V
MCLR/Vpp 0V
≥ 100 ns
50 ns
≥ 1 µs ≥ 1 µs
RTCC
100 ns
≥ 1 µs ≥ 20 ms
OSC1 Power on Reset ≥ 100 ms
RST (internal)
Address
(internal) FUSE word address FFFh 0 1 2
© 1999 Scenix Semiconductor, Inc. All rights reserved. 174 SX Family Design Specification Rev. B.0
Device Programming www.scenix.com
4. Apply the programming voltage to the MCLR pin. This latches the “Read Data” command.
5. After the required time has elapsed (100 msec from power-up or 20 msec from latching the com-
mand), generate two pulses on the OSC1 pin. The second pulse takes the device out of the reset
mode and generates the first device address, FFFh or 1FFFh (the address of the FUSE word). The
device reads the data from that address and places the 12-bit result on the Port A and Port B pins,
allowing the programmer unit to read the data.
6. Generate a single pulse on the OSC1 pin. This advances the address to the next memory location
(000h comes after the FUSE word address) and reads the data from that memory location.
7. Repeat step 6 to read successive memory locations. Do this step 2,048 or 4,096 times to read all
memory-mapped program locations from 000h through 7FFh or FFFh.
8. Bring the MCLR pin back down to zero.
Vdd
≥ 1 µs 12.5V
MCLR/Vpp 0V ≥ 1 µs
≥ 1 µs 50 ns
0 ns setup
time
≥ 1 µs ≥ 1 µs
≥ 1 µs
RB[7:0], Read
Command Write data
RA[3:0] data
0 ns hold
time
Prog. time
(100 ms)
RTCC
≥ 100 ns ≥ 100 ns
≥ 1 µs
OSC1 Power on Reset ≥ 100 ms
RST (internal)
Address
(internal) FUSE word address FFFh 0 1 2
SX Family Design Specification Rev. B.0 175 © 1999 Scenix Semiconductor, Inc. All rights reserved.
www.scenix.com Device Programming
© 1999 Scenix Semiconductor, Inc. All rights reserved. 176 SX Family Design Specification Rev. B.0
Device Programming www.scenix.com
SX Family Design Specification Rev. B.0 177 © 1999 Scenix Semiconductor, Inc. All rights reserved.