Types of ICs That Require Programming
Several categories of ICs commonly used in PCB Designs require some form of programming:
Microcontrollers (MCUs)
Microcontrollers are essentially small computers on a chip. They contain a processor, memory, and I/O all in one package. MCUs are used extensively in embedded systems and IoT devices to run the main application software. Popular MCU architectures include:
- 8-bit (ex. Microchip PIC, Atmel AVR)
- 16-bit (ex. TI MSP430)
- 32-bit (ex. ARM Cortex-M)
The MCU’s flash memory needs to be programmed with the compiled application code. This is typically done after the MCU is soldered to the PCB.
Field-Programmable Gate Arrays (FPGAs)
FPGAs contain a grid of programmable logic blocks and routing channels that can be configured to create custom digital circuits. Rather than running software, FPGAs are programmed with a hardware description language (HDL) like Verilog or VHDL. The HDL code is synthesized into a bitstream that is used to configure the FPGA fabric. Common FPGA families include:
- Xilinx (Virtex, Kintex, Artix, Spartan)
- Intel/Altera (Stratix, Arria, Cyclone, MAX)
- Microchip/Microsemi (PolarFire, IGLOO, SmartFusion)
- Lattice (ECP, CrossLink, iCE40)
Complex Programmable Logic Devices (CPLDs)
CPLDs are similar to FPGAs but at a smaller scale in terms of logic capacity and complexity. They are often used for simpler glue logic, interface bridging, and I/O expansion. Popular CPLDs include:
- Xilinx CoolRunner
- Altera MAX
- Lattice MachXO
Like FPGAs, CPLDs are programmed using an HDL to create the desired combinatorial and sequential logic as well as I/O behavior.
Flash Memory
Dedicated flash memory ICs are used to store larger amounts of non-volatile data than is practical in an MCU’s on-chip flash. Common packages are:
- NOR flash – Faster, Code execution
- NAND flash – Higher density, Cheaper
- eMMC – Managed NAND flash
Flash memory ICs have their own internal controller and require a device-specifIC programming algorithm to write data. This is often done by an MCU on the PCB itself. Secure flash ICs may also include authentication steps.
Power Management ICs
Some power management ICs like DC/DC converters, Voltage Regulators, and battery chargers support a degree of programmability. Common parameters to customize include:
- Output voltage set point
- Soft-start slew rate
- Switching frequency
- Sleep/standby modes
- Protection thresholds
This allows a single IC to be used in different designs with varying power requirements. The IC is typically programmed via an I2C interface.
IC Programming Methods
The way an IC is programmed depends on the particular device and where in the manufacturing process the programming is done. Common programming methods include:
In-System Programming (ISP)
With ISP, the IC is programmed after it is already soldered onto the PCB. A header or test points on the PCB provide access to the IC’s programming interface. This allows the PCB to be assembled with blank ICs and then programmed at a later stage.
Advantages of ISP include:
- Simpler logistics (no pre-programming)
- More flexibility to make code changes
- Potential to re-program if needed
Disadvantages include:
- Requires extra connections on PCB
- Takes more time in production
- Risk of damaging PCB during programming
In-Circuit Serial Programming (ICSP)
ICSP is a vendor-specific protocol used by Microchip for ISP of their PIC MCUs. It uses a 5- or 6-wire interface for bidirectional serial communication. The signals are:
- MCLR (Master Clear Reset)
- VDD
- GND
- PGC (Programming Clock)
- PGD (Programming Data)
- Aux pin (for LVP)
Other MCU vendors have similar ISP protocols but under different names and with minor differences in the pinout and command set.
JTAG
JTAG (Joint Test Action Group) is a standard interface used for ISP that is especially common for FPGAs and CPLDs. JTAG was originally developed for boundary scan testing but is also widely used for device programming and debugging.
The JTAG interface uses 4 signals:
- TDI (Test Data In)
- TDO (Test Data Out)
- TCK (Test Clock)
- TMS (Test Mode Select)
Devices are connected in a daisy chain between TDI and TDO. During programming, the bitstream is serially shifted in through TDI.
SWD
SWD (Serial Wire Debug) is a 2-wire interface used for programming and debugging ARM Cortex-M MCUs. It is a newer alternative to the original 5-wire JTAG interface. The signals are:
- SWDIO (bidirectional data)
- SWCLK (clock)
SWD is a much simpler interface compared to JTAG but only works for a single device (no daisy chaining). It is usually preferred for systems using a single Cortex-M MCU.
SPI
SPI (Serial Peripheral Interface) is a commonly used 4-wire interface for connecting ICs to an MCU. Some ICs also support using SPI for ISP.
The standard SPI signals are:
- MOSI (Master Out Slave In)
- MISO (Master In Slave Out)
- SCK (Serial Clock)
- CS (Chip Select)
During programming, the programming device acts as the SPI master and shifts out the bitstream through MOSI.
Pre-programming
For large production volumes, it is more efficient to program the ICs prior to PCB Assembly. This is called pre-programming or off-board programming. The advantage is a faster assembly process since the PCB does not need to go through ISP.
However, pre-programming does add some challenges:
- Requires a socket adapter for the IC
- Blanket ESD handling before soldering
- Difficult to make changes later
- Risk of mixing up programmed/blank ICs
Pre-programming is typically done either by the IC supplier or a programming service provider.
IC Programming Hardware
Special programming hardware, often called a programmer or more generically a debug probe, is used to transfer the code/configuration data to the target IC. The programmer interfaces with the IC using one of the previously described programming interfaces (ISP, JTAG, SWD, SPI, etc).
Typical features to look for in a programmer include:
- Supported devices (MCUs, FPGAs, etc)
- Host interface (USB, Ethernet, etc)
- Voltage range
- Speed
- Connector options
- Software compatibility
For pre-programming, an IC socket adapter is used to connect the loose IC to the programmer. There are many types of adapters depending on the IC package (DIP, SOIC, QFP, BGA, etc).
Some example programmers are:
MCU Programmers
- Segger J-Link (SWD/JTAG)
- PEmicro Multilink (ARM/NXP)
- Microchip PICkit (ICSP)
- STMicro ST-LINK (SWD/JTAG)
FPGA Programmers
- Xilinx Platform Cable USB II (JTAG)
- Intel USB Blaster (JTAG)
- Lattice Diamond Programmer (JTAG)
Universal Programmers
- Xeltek SuperPro (DIP/PLCC/QFP/SOP/TSOP)
- HiLo Systems All-100 (DIP/PLCC/SOIC/QFP)
When selecting a programmer, the key considerations are the ICs used in the design, the programming method (ISP/pre-programming), and the production volume.
IC Programming Software
The actual IC programming is controlled from software running on a PC or dedicated machine. The software communicates with the programmer hardware to transfer data and issue commands.
Most IC vendors provide their own programming software that is designed to work with their devices and programmers. Some examples are:
- Microchip MPLAB IPE
- TI Code Composer Studio
- NXP MCUXpresso
- STMicro STM32CubeProgrammer
- Xilinx Vivado
- Intel Quartus Prime
- Lattice Programmer
These software tools provide a graphical interface for:
- Selecting the target device
- Configuring programming options
- Loading code/bitstream
- Erasing, programming, verifying
- Setting security bits
Third-party programmers may have their own software or integrate with the chip vendor’s software. Segger J-Link and PEmicro Multilink are notable for their compatibility with many different MCUs.
For pre-programming, it is common to use an automated system that combines a universal programmer with custom software for managing the programming flow, data files, and production batches.
IC Programming Workflow
The general workflow for IC programming during PCB assembly looks like this:
- Software development
- Write code/HDL
- Compile/synthesize
- Debug and test
- Generate programming files
- Binary (bin, hex)
- JEDEC (jed, svf)
- POF
- SRecord (s19, s28, s37)
- Set up programming hardware
- Select programmer
- Install programming software
- Connect to target PCB or socket adapter
- Configure programming options
- Device selection
- Interface protocol and wiring
- Voltages
- Bitstream encryption
- Readback verification
- Security/lock bits
- Load programming files into software
- Execute programming operations
- Erase
- Blank check
- Program
- Verify
- Secure/encrypt
- Validate programmed ICs
- Functional test
- Boundary scan
- Sample QC
When the chips are programmed and verified, the PCBs can proceed to the next stage of the assembly process.
Challenges and Debugging
IC programming is a complex process and it’s not uncommon to run into challenges, especially for new designs. Some issues to watch out for include:
-
Connection problems: Wiring mistakes, poor cable connections, and incorrect pinouts can all cause communication failures between the programmer and target IC. Double check all connections and review datasheets.
-
Wrong device or package: It’s a simple but surprisingly common mistake to select the wrong chip in the programming software. Pay close attention when picking the device and package to avoid mismatches.
-
Incorrect programming files: Using the wrong code or bitstream version can lead to unexpected behavior. Implement clear revision control for software/firmware and make sure the correct files are being loaded.
-
Signal integrity: Long wires, improper termination, inadequate grounding, and excessive loading can degrade the digital signals and cause intermittent programming failures. Keep programming wires as short as possible and follow high-speed design practices.
-
ESD damage: ICs can be damaged by electrostatic discharge if not handled properly. Make sure the programming setup and ICs use proper ESD precautions.
-
Security locks: If a secure MCU is accidentally locked with an unknown key, it may become impossible to reprogram. Be careful when setting security bits and keep track of all keys/passwords.
When encountering a programming error, the first step is to check the basics – connections, power, software setup. From there, use an oscilloscope or logic analyzer to verify the programming signals and refer to the datasheets for expected behavior. Most vendors provide detailed application notes and tutorials for using their chips and programmers.
IC Programming Services
For companies without the necessary equipment or expertise, IC programming can be outsourced to a service provider. Most electronics manufacturing services (EMS) providers offer IC programming as part of their assembly capabilities. There are also dedicated programming houses that specialize in high-volume off-board programming.
Advantages of using a programming service include:
- No need to invest in programming equipment
- Access to experienced programming technicians
- Established processes for data handling and revision control
- High throughput for large batches
- Flexibility to support different ICs and packaging
When selecting a programming service, consider:
- Supported devices and packages
- Data formats and revision control
- Programming methods (on-board/off-board)
- Throughput and turnaround time
- Pricing structure (per chip, per hour, setup fees)
- Quality certifications (ISO-9001, IPC, etc)
- Intellectual property (IP) protection
Expect to provide the service with the following:
- Bill of Materials (BOM)
- PCB assembly drawing
- Schematics
- Device datasheets
- Programming files
- Special instructions
Working closely with the programming service can help ensure a smooth process and minimize the risk of errors.
FAQ
What is the difference between flashing and programming?
Flashing and programming are often used interchangeably, but flashing specifically refers to programming flash memory (like in an MCU), while programming is a more general term that encompasses configuring any type of IC, not just flash-based ones.
Can I program an IC more than once?
This depends on the particular IC. Most flash-based ICs (MCUs, flash memory, CPLDs) can be erased and reprogrammed many times. Mask ROM and antifuse FPGAs can only be programmed once. Always refer to the datasheet for the IC’s programming specifications and limits.
How long does IC programming take?
Programming time varies widely depending on the IC density, programming interface, and method. A small 8-bit MCU might only take a second to program via ISP, while a large FPGA could take several minutes. Off-board programming is generally faster than on-board. The programming software usually provides an estimated time.
What happens if there is a power failure during programming?
If power is interrupted while an IC is being programmed, the programming will fail and the chip may be left in an indeterminate state. Most ICs have a reset or power-on state that is entered if programming is not completed. In some cases, the IC may be “bricked” and not recoverable, though this is rare. It is important to have a stable power supply during programming.
How do I protect my code from being copied?
Most MCUs and FPGAs support some form of code protection or encryption to prevent unauthorized reading or copying of the programmed code. The exact method varies by manufacturer but usually involves setting security bits to lock the chip and/or encrypt the firmware. The protected code cannot be read out externally, only executed by the IC itself.
Conclusion
IC programming is an essential part of the electronics manufacturing process that brings designs to life by customizing off-the-shelf chips. Choosing the right programming method, equipment, and software is critical for an efficient and reliable production flow. Whether programming in-house or outsourcing to a service, taking the time to develop robust IC programming processes can help ensure a successful product.
No responses yet