Hello everyone,Can someone pointed out to me what are the pros and cons using fpga compare to microcontroller? What I know is fpga execute our program in paralel order and uc execute the program sequentially. Because of that reason, I think fpga tends to make less delay compare to uc. It is needed for example when I would like to operate multiple motor which I need accuracy. FPGA convert our hdl later into some sort of gate array but the uc use only bunch of instruction. (please someone correct me if I'm wrong) What are other pro& con using fpga compared to uc? Thank you everyone.
What the pros and cons are, really depends on the application you have in mind. Talking about motor control, you may be able to use some microcontroller's PWM features. If you need reaction times less than a microsecond, depending on algorithms you need to implement, you might need to use a FPGA. On the other hand, complex algorithms tend to be implemented more quickly and easily in software, especially if they involve dynamic amounts of memory and high-level descision-making. Writing software is easier to learn than coding HDL.Also keep in mind that FPGAs need some infrastructure like non-volatile memory to be configured when they're not connected to a PC, maybe a configuration controller for updatability in the field, an oscillator. There are microcontrollers out there with built-in flash/EEPROMs and built-in oscillators. Of course, if you know that the logic you need is small enough to fit into a CPLD, you can reduce device count. If you are not yet sure about how fast the reaction times will need to be, the safer option would probably be a FPGA big enough to contain a microcontroller, like Nios. Then you could start by implementing your algorithms in software and later, if you realise it is not fast enough, you could extend that on-chip system with custom modules. Depending on code size, you might need to add an external RAM for that Nios. Expect some learning how Nios works, how to build the system, how to interface it to the rest of the FPGA and the outside world, how to debug and write efficient code. But that might be similar to what you have to do for off-the-shelf microcontrollers anyway. Well, you see there are a couple of options. It really depends what your project is about, how it should evolve, what timeframe, budget and skills you have. Hope that helps :-)
Actually, there are µCs with dedicated PWM hardware which can achieve timings not achievable with an FPGA.Anyway, FPGAs are re-configurable logic devices. They contain thousands of basic digital blocks. These blocks, and the way they are connected, can be configured to behave as any digital chip you can think off. Then can be.. whatever you can build blocks within a FPGA. Which is a lot. An FPGA can be configured to be a CPU, a µC, a USB controller, a UART, the chip you'd like to have but doesn't exist, etc. However, compared to dedicated chips, FPGAS are expensive, slow, have high power consumption, tend to require more components and other stuff. So, good reasons to use a FPGA: - There's no decent chip in the market that fits your needs and you can't afford to design your own. - There's no decent chip in the market that fits your needs and you don't have the time to design your own. - You could use some existing chips but it's cumbersome or poor performing. - You need the flexibility to reconfigure your system. So, a more practical example. Once upon a time, we needed to control a bunch of I2C ADCs and DACs, Since we were running out of address space, we decided to use multiple I2C buses. Since we couldn't find any µC with enough I2C masters, we used an FPGA and implemented a design with a 8051 µC and several I2C masters to fit our needs. Problem solved.
--- Quote Start --- - There's no decent chip in the market that fits your needs and you don't have the time to design your own. - You could use some existing chips but it's cumbersome or poor performing. - You need the flexibility to reconfigure your system. --- Quote End --- Thank you for both of your replies. How poor performing is it? In which application should we use fpga or uc? What do you mean when you said "reconfigurable"? I think uc is also reconfigurable. In my case, I use 3 sensors and later with the data I got, I need to perform calculation (in which I also need trigonometric calculation) for my control. After that the result of the control is gonna actuate a actuator. Given a choice of uc and fpga, which should I use? What critical here is time respond until the system become stable. Sorry for the basic questions. I already know what is fpga and its architecture. Thank you.
Oh yah I also forgot to mention I also need to perform communication from pc to uc or fpga(depends on which I use). If fpga, I am trying to use virtual jtag. If uc, I am trying to use usb to serial communication.
--- Quote Start --- I use 3 sensors and later with the data I got, I need to perform calculation (in which I also need trigonometric calculation) for my control. After that the result of the control is gonna actuate a actuator. Given a choice of uc and fpga, which should I use? What critical here is time respond until the system become stable. --- Quote End --- This sounds like a microcontroller task. If sensors are analog voltages, they will need to be analog-to-digital converted; which for an FPGA requires an external component, but exists on a microcontroller. If you are using actuators, then I would imaging your 'speeds' are quite slow. Well within the capabilities of microcontrollers . For example, the STM32F4-Discovery kit is available from ST for free. Its got a 168MHz ARM Cortex-M4 core, with floating-point unit, fast I/O, USB, etc. That may even be overkill. Cheers, Dave
Yeah actually I know in my case, i could just use uc. But at the time I decided to use fpga for this project, i have in mind that I would like to learn fpga which is why I choose it. But now that I have use fpga, I don't know what the advantage of using it.
--- Quote Start --- It would be appreciated if someone can tell me in which application fpga perform better than uc and vice versa. --- Quote End --- You'll get a lot of different opinions on this question. The answer depends heavily on your application. If your problem involves lots of parallel data processing and can be visualized as a 'stream' of processing steps, then this works quite nicely in an FPGA. But it also works quite nicely on a bank of parallel DSP processors. If you were a DSP programmer, then the DSPs would be your perfect solution. However, if you were an FPGA programmer, the FPGAs would be the obvious solution. If your problem involves lots of control and monitoring applications, then a microcontroller might be the solution. But what if the microcontroller doesn't have 'just the right mix' of peripherals? Well, you add a CPLD or an FPGA to its local bus (or SPI port, or I2C port) and use each where they perform the best. Look at the Cypress PSoC and the MicroSemi Fusion devices - they are microcontrollers with programmable analog or digital blocks. I use PowerPC processors and FPGAs. Why? Well, it allows the partitioning of the real-time tasks in the FPGA, and the non-real-time (or less real-time) tasks to a processor. You can then partition the system design across multiple people, with multiple skill sets. In my current project, I'm looking at using the ARM STM32F4 as a power controller for my more expensive FPGAs; it'll turn the power on, monitor temperatures, currents etc, and can be used as the device programmer. Why use a microcontroller? Its one chip, its cheap, and after programming it to do its job, its just a chip on the board (no software maintenance required). Cheers, Dave
--- Quote Start --- What do you mean when you said "reconfigurable"? I think uc is also reconfigurable. --- Quote End --- Not the same thing, not even close. Programming an FPGA is much like designing a digital integrated circuit: You draw* the circuit using logic gates (AND, OR, etc) and flip-flops and some other bits and pieces. Then you use the FPGA software to synthetize and map the circuit you draw into a FPGA configuration and when you load the configuration into the FPGA, it will behave as the circuit you draw. * Or you describe the behavior of the circuit in Verilog/VHDL