FPGA
Basics
An FPGA is a device that contains a matrix of reconfigurable gate array logic circuitry. When an FPGA is configured, the internal circuitry is connected in a way that creates a hardware implementation of the software application. Unlike processors, FPGAs use dedicated hardware for processing logic and do not have an operating system. FPGAs are truly parallel in nature so different processing operations do not have to compete for the same resources. As a result, the performance of one part of the application is not affected when additional processing is added. Also, multiple control loops can run on a single FPGA device at different rates.
FPGAs are not open source friendly. The chips themselves are only made by a couple companies and each one has their proprietary tool-chain. Implementing an FPGA-based controller, in the time available, would require buying into one or more (probably one) commercial solution.
Pros
- Components can be eliminated and their functions absorbed into the FPGA code.
- The designer can implement counters, pulse-width modulation (PWM) generators, signal generators, filters and math directly in the FPGA.
- For example, you can implement a complete closed-loop hydraulic actuator control with LDVT feedback with only two active external conditioning components—a voltage buffer for driving the LVDT excitation coil and a voltage-to-current driver for the hydraulic servo valve. The FPGA would provide the excitation waveform for the LVDT, demodulate the LDVT feedback to produce position, use position to compute velocity, implement the closed-loop model and output the command value to the servo valve. Add an analog pressure input and you can create a force controller with velocity-limiting or shutdown protection.
- The user can mix and match displacement sensors, LVDTs, RVDTs, resolvers, encoders, absolute encoders, SSI encoders, differential encoders and acoustic as required. It’s also possible to acquire temperature, resistance, voltage, current, force, pressure, flow, frequency and acceleration measurements and process them into other measurements such as RMS voltage, Watt meters, three-phase power and inductance.
- Imagine if a single-board design could fulfill the needs of every project. What if you could configure an entire board, or several boards in the same platform, to meet the needs of any part of a system or all needs of a complete system? What if you could rapidly fashion system hardware components like microprocessors; peripherals; filters; control loops; (add your desired functionality here); and UART, SPI and I2C controllers in the right mix to specifically and exactly meet the needs of your application?
- Field-programmable gate array (FPGA) technology provides the reliability of dedicated hardware circuitry, true parallel execution, and lightning-fast closed-loop control performance.
- In addition to offering high reliability, FPGA devices can perform deterministic closed-loop control at extremely fast loop rates. In most FPGA-based control applications, speed is limited by the sensors, actuators, and I/O modules rather than the processing performance of the FPGA. For example, the proportional integral derivative (PID) control algorithm that is included with the LabVIEW FPGA Module executes in just 300 nanoseconds (0.000000300 seconds).
- FPGA-based control systems offer deterministic closed control performance at rates exceeding 1 MHz. In fact, many algorithms can be executed in a single cycle of the FPGA clock (40 MHz).
- Algorithms running 10 MHz and higher are not unusual. Reaction times are measured in nanoseconds
- Based on processing speeds, with more than 200 MHz for soft processor implementations and hard block implementations exceeding twice that amount, nearly 80 percent of all embedded 32-bit application needs are addressable inside an FPGA.
- An FPGA-based hardware solution has the unique advantage of true hardware parallelism; independent control loops can run at different rates without relying on shared resources that might slow down their responsiveness
- The need for the 3-kHz rate made the FPGA the only viable option. The 44-MHz loop rate of the FPGA let developers create an effective resolution beyond that of the raw encoder signal using a technique similar to a sigma-delta A/D converter. Specifically, the system oversamples the encoder and timing bit transitions to boost feedback resolution from 4.2 to 1.05°. At the top motor speed of 30,000 rpm, the 9-bit encoder changes from one step to the next every 3.9 µsec. A single-cycle loop running at 44 MHz on the FPGA iterates 171 times in 3.9 µsec. By counting the cycles between encoder steps, the software interpolates the angular position of the motor during the next step of the encoder.
- Processing is done in parallel so multirate control systems are easy to implement.
- Because control logic runs in dedicated hardware subsystems on the FPGA, applications do not slow down when additional processing is added.
- In many cases, a software-defined gate array in FPGA hardware can be used to replace a costly and time-consuming custom printed circuit board (PCB) layout.
- FPGAs can digitally process signals at very high speeds and are often used to reconfigure the I/O module functionality.
- digital input module can be used to simply read the true/false state of each digital line. Alternately, the same FPGA can be reconfigured to perform processing on the digital signals and measure pulse-width, perform digital filtering, or even measure position and velocity from a Quadrature encoder sensor.
- FPGAs are flexible. They can span the analog and digital world...if you add analog to digital and digital to analog converters, then you have a deterministic, high-performance mixed computing platform.
- In general-purpose operating systems such as Windows, the jitter is unbounded so closed-loop control system stability cannot be guaranteed. Processor-based control systems with real-time operating systems are commonly able to guarantee control loop jitter of less than 100 microseconds.
- The jitter for FPGA-based control loops depends on the accuracy of the FPGA clock source. In the case of the NI cRIO-910x reconfigurable chassis, the FPGA clock jitter is only 250 picoseconds (0.000000000250 seconds) when using a 40 MHz FPGA clock rate.
- If you don’t want to use the FPGA as the primary controller, but need it to act as a specialized co-processor, using the FPGA as slave device with a digital interface such as serial peripheral interface (SPI) bus would be completely normal. You could use the entire system described above as a slave to at PIC chip if required.
- Creation of specialized relationships between devices is one of the most important benefits of using FPGAs. When off-the-shelf components don’t have the functionality that your application requires, you can accomplish the goal often with improved results over the conventional approach.
- As system requirements become more complex, FPGAs also provide the scalability to add functionality without having an impact on the rest of the system.
- A machine control application, for example, might require the addition of sensors for monitoring the system temperature and mechanical vibrations, with the goal of detecting the early stages of machine failures. An FPGA-based system could add that functionality without affecting the machine control and even help integrate an emergency shut-down sequence to ramp down the machine safely and reliably.
- An FPGA-based approach provides hardware reconfigurability to evolve with application needs. With reprogrammable hardware, you can recompile the FPGA to accommodate new and improved algorithms, different types of I/O and bug fixes, all of which can be accomplished in the field.
- FPGAs can be reprogrammed in the field to fix bugs.
“Also, our safety rules do not permit a regulated switch down that is driven by software when an emergency brake is triggered. I will always ride the safety procedures in the FPGA. Because an FPGA is hardware, and not software, it gives you a lot of flexibility according to safety matters. You can program a sequence-driven shutdown even when an emergency stop is triggered. Without FPGA, you would have a complex electronics device that still would have to communicate with the software, which would decrease the flexibility level.” - Danny Hendrikx, process development engineer in R&D for Havells Sylvania’s Belgian lamp-making factory (www.havells-sylvania.com)
“No other solution exists that can allow non-specialized engineers to develop fast-computational solutions. There’s no other solution allowing for a deterministic, 16-bit resolution to compute the angular position of our system 1 million times per second. Analog electronics would have suffered from calibrations and resolution, and software-based calculations would have missed the speed of processing by a factor of 1000x.” - Zucchelli
Cons
- Why aren’t more engineers using FPGAs for controls applications? They’re not easy to program and currently require specialized skills and time to achieve the desired performance. While the programming tools are improving, there are still vast opportunities for improvement.
- One of the biggest challenges to coding applications that are more than simple logic and integer math is dealing with engineering units.
- You have to compile the program. This can take a while depending on the program size. You cannot debug it with breakpoints and markers because it is a compiled program, and you have to respect the 32-bit compilation when using numbers. This can give you some problems with calculations...For the programmer, the difficulties stem mainly in the constraints of fixed-point math; floating point arithmetic is not available. So the implementation of complex algorithms can require very significant design effort to ensure accuracy
- FPGAs are generally slower than ASICs of about the same complexity and aren't practical for supercomplicated designs. They also draw more power than ASICs.
Compared to a PLC
- The thing to note about PLCs is that they repeatedly scan I/O points and take actions based on what they see. Historically, these devices have mimicked the ladder logic that once defined the interconnections of electromechanical relays that PLCs originally were designed to replace.
- The scanning architecture found in PLCs is excellent for controlling such sequential processes as turning on a conveyor if a proximity sensor goes high, then turning it off after the proximity sensor goes low.
- engineers use FPGAs either where it is cost-prohibitive to develop and fabricate an ASIC, or where the hardware must be reconfigured after going into service.
- PACs such as NI CompactRIO generally have a floating-point processor running a real-time operating system. One reason is because FPGAs have no way of executing floating-point operations. So the floating-point processor may communicate with the FPGA while taking on tasks that don't lend themselves to an FPGA fabric. These tasks might include data logging, networking, e-mail, transfers via File Transfer Protocol (FTP), and remote Web control.
Examples
- NetFPGA is an open source PCI card for testing networking systems.
- Linux on FPGAs
- OpenCores does a lot of work with open source IP on FPGAs.
- open source FPGA tools
- Papilio is (was?) and FPGA shield for Arduino.
- Comparison of Arduino to FPGA.
See Also