Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

When to use CPLD and when to use microcontroller

Status
Not open for further replies.

andy257

Member
Hi All,

Have began to get taught CPLD this term and i am struggling to see any benefits from using them instead of microcontrollers. All the examples i see i think to myself a microcontroller would do that.

I know you can reduce the logic compnent count by alot using cplds etc but when would you use a cpld and not a microcontroller and what are the advantages a cpld has over a microcontroller. i cant seem to see any???????

cheers

Andy
 
A microcontroller does everything one instruction cycle at a time. If you need to do a lot of things in parallel (particularly if exact timings are very important), a microcontroller is probably not going to be the best solution. For relatively low-speed applications you can probably get away with using a microcontroller in a lot of situations. But, for higher-speed signals, having to keep the microcontroller clocked significantly faster than the signals it deals with (so it can keep up) can be quite prohibitive. In short, within reason, a microcontroller can pretty much do anything a CPLD can do, it just can't do it as fast.

Microcontrollers are a much more general tool - for hobbyists they're an acceptable solution nearly all the time, because the types of high-speed, tons-of-parallel-IO applications where CPLDs/FPGAs/etc are necessary are not very common in hobby projects.
 
evandude said:
A microcontroller does everything one instruction cycle at a time. If you need to do a lot of things in parallel (particularly if exact timings are very important), a microcontroller is probably not going to be the best solution. For relatively low-speed applications you can probably get away with using a microcontroller in a lot of situations. But, for higher-speed signals, having to keep the microcontroller clocked significantly faster than the signals it deals with (so it can keep up) can be quite prohibitive. In short, within reason, a microcontroller can pretty much do anything a CPLD can do, it just can't do it as fast.

Microcontrollers are a much more general tool - for hobbyists they're an acceptable solution nearly all the time, because the types of high-speed, tons-of-parallel-IO applications where CPLDs/FPGAs/etc are necessary are not very common in hobby projects.

One FPGA design I did was a 100MHz scope and a 100MHz counter with and external delay to measure 20pS.

That was a fun one. Not to mention the 20MHz amp that was in it... In general I would not recommend programable logic unless you need a lot of specialized stuff. Generic I/O can be handled by shift registers.

D.
 
evandude said:
Microcontrollers are a much more general tool - for hobbyists they're an acceptable solution nearly all the time, because the types of high-speed, tons-of-parallel-IO applications where CPLDs/FPGAs/etc are necessary are not very common in hobby projects.

Couldn't have put it better myself. I knocked up a CPLD (2x lattice mach4's 64 MC's) dev board before I started with microcontrollers, and now it hardly ever gets used. Microcontrollers have memory, they can do mathematical operations and are just easier to configure for 99% of hobby projects. As evandude pointed out, CPLD's/FPGA's are really for highspeed parallel logic. Also, CPLD's are more expensive than micro's, which I tend to use for almost anything nowdays.

An example of an app where I couldn't find a micro that could do the job was a little digital RF link I did for uni. It required hamming encoding, and decoding....at 5MB/s. A microcontroller, aside from the 16-bit ones with single cycle multipiers couldn't not do this at anywhere near that speed. The CPLD did it brilliantly, and I also had 'room' for a ultra reliable manchester decoder, CRC error check, and error counter....all in pure hardware.

Interestingly though, I still find that CPLD's do have their place for the hobbyist. Because they are so damn configurable, you're not limited by data bus width, so you can use them to 'simulate' the interface of a device (say an SPI DAC or something) and test microcontroller circuits. And some projects I've done have shown that a combination of micro and CPLD's can be extremely powerful. With the memory, mathematical functions, look up tables, and peripherals of a cheap microcontrollers, but with the added benefit of very fast, and rather complicated logic. Things like the PHY layer of a comms protocol (PIC + CPLD = USB/can/spi/I2S). Dedicated hardware has its place. Another benefit is the sheer number of I/O's on a CPLD. Its easy to add a small, addressable serial interface in logic, giving the 'ol PIC 32 extra I/O's, or...extra custom peripherals (VERY handy).

Sorry to just 'reinforce' evandudes post, but thats my experience with them. Expensive for what they are, but if you need lots and lots of CMOS/TTL logic IC's on your design, then they can replace all of those with one chip, and allow modification of the design 'in system'.

Blueteeth
 
excellent answers guys, thanks for the information. I am quite happy expanding my knowledge with microcontrolelrs atm but like i said, in my previous post, i am studying CPLD at uni so will no doubt have to get my hands dirty with them.

thanks

Andy
 
andy257 said:
excellent answers guys, thanks for the information. I am quite happy expanding my knowledge with microcontrolelrs atm but like i said, in my previous post, i am studying CPLD at uni so will no doubt have to get my hands dirty with them.

As suggested, they have their uses - but for most purposes a micro-controller is far more useful - but when you really need a CPLD, you'll be wanting to do something way beyond the capabilities of a micro-controller.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top