samtheengineer

Joined Oct 9, 2011
1
Hello

I am a newbie to the world of microcontrollers and would be really grateful for some advice about choosing one. Basically, Im doing a final year university engineering project that requires an MCU to take a number of analogue inputs, do some processing, and spit out an analogue output that will drive a loudspeaker. My supervisor has recommended looking at the Philips LPC2148 and associated development kits (http://www.olimex.com/dev/lpc-h2148.html) because it is cheap and looks able to fulfil the following requirements:

I/O  three analogue inputs (so 3 ADCs), 3 digital inputs (two servos and a bus for programming the controller), and one analogue output (requiring a DAC either built into the development board, or one I could connect on an add-on board)

Speed  a program size of about 500 floating pt operations, processing samples at a rate of up to 400/second, hence of the order 200,000 floating pt operations per second. I think the LPC2148 uses fixed pt arithmetic so would need to perform the equivalent of this in fixed pt.

Support  in place debugging support would be desirable; ability to be run on Windows; overall hardware and software cost of £100 or less.

Does this chip and its development tools look up to the job? If not, would you recommend an alternative? Are there any other major criteria Im neglecting in the process of selecting a MCU?

Many thanks,

Sam

ErnieM

Joined Apr 24, 2011
8,328
"Local support" is always a good thing, and if your supervisor can answer the questions you will have when getting this up the by all means pick a system he is familiar with.

I'm not familiar with these devices (I'm a Microchip guy) but it has a huge 512K program memory and 42K RAM, so it could do the processing you need. Doing a FP op in 5 uS (1/200k) may be pushing it, but I would first ask do you need that precision? You're getting A2D data which is always an integer, and integer only math may be a faster approach.

Also, I don't know if it can do in circuit debugging. That's going to be more important then you can imagine. If it can, Windows is kind of a given.

I do completely agree to start with an existing development board, at least you have something you know is tested good to begin with.

CraigHB

Joined Aug 12, 2011
127
I don't think you're going to be limited in selection by the task you want to do. Doesn't sound like anything too involved.

The priorities for me are the cost of a programmer/debugger, the quality and availability of development software, the quality of documentation, and cost of the chips themselves.

The ARM stuff is powerful, but you probably won't find a one stop shop for it since it's a licensed core design offered by several makers not a particular product from a single maker. However, you can cobble the stuff together cheaply I'd imagine (haven't used the ARM stuff myself), but it's probably not going to be a homogeneous solution.

Texas instruments sells the LaunchPad programmer/debugger for a mere $4.30. It's for their MSP430 series of micro-controllers. It's a socket programmer limited to 14 and 20 pin DIP parts. TI does have a free IDE for it. IDE stands for integrated development environment and is a commonly used acronym. An IDE is the computer software required to write and debug your code then load it into the micro-controller. The TI programmer/debugger has to be about the cheapest to go for entry level I've seen, but it's limited. However the LaunchPad can double as a development board so it might be a good fit for your project. The Microchip PICs have the best documentation I've come across. The data sheets and manuals are very well written and easy to understand, plus they have tons of application notes. The cheapest entry level for a PIC is going to be the PICkit2 at$35 or the PICkit3 at $45. Unfortunately, the cheaper PICKit2 is being phased out for the PICKit3. The PICKit2 & 3 program the chips using ICSP or in-circuit serial programming. They also do in-circuit debugging. Microchip's IDE is free and unlimited, called MPLab. I like it a lot myself. There's also the Atmel AVR chips. The AVR Dragon programmer/debugger is$50 and Atmel offers a free unlimited IDE, called AVR Studio 5. The AVR Dragon also supports in-circuit programming and debugging through a JTAG interface which is similar to Microchip's ICSP interface.

.

Last edited:

mcgyvr

Joined Oct 15, 2009
5,394

kubeek

Joined Sep 20, 2005
5,776
Not for 200,000 floating point operations per second, maybe 20,000 could be doable. It´s because atmegas don´t have native fpu instrctions and they have to by synthesiszed using integer operations.

MrChips

Joined Oct 2, 2009
26,797
For audio data processing you should be looking at a DSP.

ftsolutions

Joined Nov 21, 2009
48
You can certainly do ALOT with an ARM7 like the LPC2148. The olimex boards are pretty good. You can also check out some starter kits such as those offered by IAR.com for ARM. You can download/use their Kickstart edition development suite for free, but limited to a total of 32KB compiled code size (but you can do quite alot in 32K). The starter kits are relatively affordable and include JTAG programmer/debugger pod. The NXP family is licensed with the Segger or IAR JTAG devices to allow you unlimited flash breakpoints with the LPC21xx family of processors, which is a very useful feature, for FREE.

You could also use much of the same hardware, but obtain a low cost educational license or hobbyist license for Rowley Crossworks, which is another tool suite/IDE but is based on the GNU compiler chain, not like the IAR tool set is.

In either case, I'd try to do your math in fixed point format for much higher processing throughput if needed. I've finished a product design with a customer and we're using an LPC2134 processor, and are performing all the control loop processing and user interface functions, handling multiple ADC channels, a DAC channel and PWM channels, and many other I/O, while running PI loop control at over 11KHz.

Now, the native ADC channels and DAC on the LPC21xx family are only 10-bit, which may not be sufficient to your needs. If you need 12,14, or 16 bits of resolution, there are external A/D converter you can use which are I2C or SPI interface - however the I2C max bit rate on these LPC21xx devices is only 400 KHz, so that can become a bottlneck for retrieving the data from the external A/D.

Last edited:

eemaestro

Joined Dec 8, 2010
1
You have to look at the Nyquist frequency criterion. It specifies a minimum of two samples per period of the highest frequency component you want to sample. Then figure out how your high frequency you want - 1000 Hz? for medium fidelity music you'll need 16 kHZ for hi fidelity music you'll need 18 or 19 kHz

When you have identified the highest frequency component you want to process, then you can figure out whether to go DSP or analog microcontroller and how fast you'll need.

ftsolutions

Joined Nov 21, 2009
48
I am assuming - perhaps incorrectly - that the OP knows what his sampling rate needs to be, as he indicated in his post that he had to process 400 samples per second, which is really quite slow, and seemingly equivalent to some EKG type of machines