Module 5(Lecture 6)
Module 5(Lecture 6)
SYSTEMS (17EC62)
DB-9 COM/USB
connector
RS-232/USB cable
• Some old embedded systems may be built around UVEPROM chips and
such chips should be erased using a separate 'UV Chip Eraser' before
programming.
Out-of-Circuit Programming
• Drawbacks
• The major drawback of out-of-circuit programming is the high development time.
• Whenever the firmware is changed, the chip should be taken out of the development
board for re-programming.
• This is tedious and prone to chip damages due to frequent insertion and removal.
• The programmer facilitates programming of only one chip at a time and it is not
suitable for batch production.
• Can be resolved using a 'Gang Programmer', which contains multiple ZIF sockets
(4 to 8) and capable of programming multiple devices at a time.
• But it is bit expensive compared to an ordinary programmer.
• Another big drawback of out-of-circuit programming is that once the product is deployed
in the market in a production environment, it is very difficult to upgrade the firmware .
Out-of-Circuit Programming
• Applications
• The out-of-system programming technique is used for firmware
integration for low end embedded products which runs without an
operating system.
• Out-of-circuit programming is commonly used for development of
low volume products and Proof of Concept (PoC) product
Development.
In System Programming (ISP)
• Here, the programming is done 'within the system', meaning the firmware is
embedded into the target device without removing it from the target board.
• It is the most flexible and easy way of firmware embedding.
• The only pre-requisite is that the target device must have an ISP support.
• Apart from the target board, PC, ISP cable and ISP utility, no other additional
hardware is required for ISP.
• The target board can be interfaced to the utility program running on PC through
Serial Port/Parallel Port/USB.
• The communication between the target device and ISP utility will be in a serial
format.
• The serial protocols used for ISP may be 'Joint Test Action Group (JTAG)' or
'Serial Peripheral Interface (SPI)' or any other proprietary protocol.
In System Programming (ISP)
• In order to perform ISP operations, the target device should be powered up in
a special 'ISP mode'.
• ISP mode allows the device to communicate with an external host, such as a
PC or terminal, through a serial interface.
• The device receives commands and data from the host, erases and reprograms
code memory according to the received command.
• Once the ISP operations are completed, the device is re-configured so that it
will operate normally by applying a reset or a re-power up.
In System Programming (ISP)
• Devices with SPI - In System Programming support contains a built-in SPI
interface (Serial Peripheral Interface) and the on-chip EEPROM or FLASH
memory is programmed through this interface.
• The primary I/O lines involved in SPI - In System Programming are:
• MOSI - Master Out Slave In
• MISO - Master In Slave Out
• SCK - System Clock
• RST - Reset of Target Device
• GND -Ground of Target Device
In System Programming (ISP)
• PC acts as the master and target device acts as the slave in ISP.
• The program data is sent to the MOSI pin of target device and the device
acknowledgement is originated from the MISO pin of the device.
• SCK pin acts as the clock for data transfer.
• Since the target device works under a supply voltage less than 5V (TTL/CMOS),
it is better to connect these lines of the target device with the parallel port of the
PC.
• Since parallel port operations are also at 5V logic, no need for any other
intermediate hardware for signal conversion.
• Standard SPI-ISP utilities are feely available on the internet and there is no need
for going for writing own program.
In System Programming (ISP)
• For ISP operations, target device needs to be powered up in a pre-defined sequence.
• The power up sequence for In System Programming for Atmel's AT89S series
microcontroller family is listed below:
1. Apply supply voltage between VCC and GND pins of target chip.
2. Set RST pin to "HIGH" state.
3. If a crystal is not connected across pins XTAL1 and XTAL2, apply a 3 MHz to 24
MHz clock to XTAL1 pin and wait for at least 10 milliseconds.
4. Enable serial programming by sending the Programming Enable serial instruction
to pin MOSI/P1.5. The frequency of the shift clock supplied at pin SCK/P1.7 needs
to be less than the CPU clock at XTAL1 divided by 40.
5. The Code or Data array is programmed one byte at a time by supplying the
address and data together with the appropriate Write instruction. The selected
memory location is first erased before the new data is written. The write cycle is
self-timed and typically takes less than 2.5 ms at 5V.
6. Any memory location can be verified by using the Read instruction, which returns
the content at the selected address at serial output MISO/P1 .6.
7. After successfully programming the device, set RST pin low or turn off the chip
power supply and turn it ON to commence the normal operation.
In System Programming (ISP)
• The key player behind ISP is a factory programmed memory (ROM) called
'Boot ROM'.
• The Boot ROM normally resides at the top end of code memory space and it
varies in the order of a few Kilo Bytes.
• It contains a set of Low-level Instruction APIs and these APIs allow the
processor/controller to perform the FLASH memory programming, erasing and
reading operations.
• By default the Reset vector starts the code memory execution at location 0000H.
• If the ISP mode is enabled through the special ISP Power up sequence, the
execution will start at the Boot ROM vector location.
In System Programming (ISP)
• When this status bit is set, accesses to the internal code memory in this
address range will be from the Boot ROM.
• When cleared, accesses will be from the user's code memory.
• Hence the user should set the status bit prior to calling the common entry
point for IAP operations.
Use of Factory Programmed Chip
• It is possible to embed the firmware into the target processor/controller memory
at the time of chip fabrication itself.
• Such chips are known as 'Factory programmed chips'.
• Once the firmware design is over and the firmware achieved operational stability,
the firmware files can be sent to the chip fabricator to embed it into the code
memory.
• Factory programmed chips are convenient for mass production applications and
it greatly reduces the product development time.
• It is not recommended to use factory programmed chips for development
purpose where the firmware undergoes frequent changes.
• Factory programmed ICs are bit expensive.
Firmware Loading for Operating
System Based Devices
• The OS based embedded systems are programmed using the In System
Programming (ISP) technique.
• OS based embedded systems contain a special piece of code called 'Boot loader'
program which takes control of the OS and application firmware embedding
and copying of the OS image to the RAM of the system for execution.
• The boot loader for such embedded systems comes as pre-loaded or it can be
loaded to the memory using the various interface supported like JTAG.
• The boot loader contains necessary driver initialisation implementation for
initialising the supported interfaces like UART, TCP/IP etc.
Firmware Loading for Operating System
Based Devices
• Boot loader implements menu options for selecting the source for OS image to
load.
• E.g. Load from FLASH ROM, Load from Network, Load through UART etc.
• In case of the network based loading, the boot loader broadcasts the target's
presence over the network and the host machine on which the OS image resides
can identify the target device by capturing this message.
• Once a communication link is established between the host and target
machine, the OS image can be directly downloaded to the FLASH memory of
the target device.
Thank You