We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello!
I've worked before with Cortex-M3 on a STM32 Primer during college. Now I'm trying to develop a system and I can't decide what would be the best MCU for it...
The tasks I would need for it to perform are:
-Operate a TFT LCD screen
-Read and write to an SD card (KBytes of info)
-Control a PWM output
-Read 3 sensors (some digital and some analogic)
-Controll a dimmable light (triacs, zero-cross detection...)
-Actuate on relays and transistor switches
-Send info to a webpage via ethernet board
-PID controller (needs to do some divisions, multiplications and sums...)
All this tasks are to be preformed inside a infinte loop, but there is no need to have them working in Real Time.
Do you think that a Cortex-M0 would be good for this or do I need a more powerful microprocessor?
Also, if I start with a M0, how hard will it be to take the same code and make it work on an Cortex-M3?
Thanks!
Hi zakali, welcome to the Community and thank you for your question. I have moved your post to the ARM Processors Group as this is where your question will be seen by the appropriate expert.
Very interesting question. The M0 might be able to do it, but I think I'd pick a M3.
High speed:
Low speed:
You do not mention any size requirements, so I assume a LQFP144 or LQFP208 package would be OK.
Summing it up: If you needed 3 or fewer of these functions, the M0 would probably be an excellent choice.
But since you're going to stuff all the different functions into the same chip, it might be difficult to fit it all in there at the same time, while keeping the code maintainable. I'm not saying it can't be done, just that it might be a little difficult.
On the other hand, if you choose a M3, your job gets easier and the operations can be done faster as well.
If you are coding in assembly language, you'd get the mla and mls instructions, which could be useful for PID.
Many M3 implementations have support for both SD/MMC and LCD/TFT. As I've been using the LPC series, those are the ones I know the best.
I recommend you to take a look at the LPC1788. They have support for Ethernet, LCD, SD/MMC, 4 timers (could be used for PWM), motor control (could be used for PWM). The cost is low and the microcontrollers support speeds up to 120MHz (and single-cycle I/O access).
They come in different packages, including a LQFP144, which can be hand-soldered on a low-cost eBay adapter for prototyping, if you have a good soldering station.
NXP also makes a LPC4088, which you may find interesting; it features a M4 instead of M3.
Be sure you choose a package, where you can use all the required features simultaneously.
A few examples on development boards that you might find interesting: Olimex MOD-LCD4.3 and Open1788.
Please know that although I'm suggesting this particular microcontroller, it doesn't mean that it's the best possible choice; it does mean that it would be able to do the job at a reasonable cost and that it's fairly easy to work with as well.
Hello jensbauer, first of all thanks for your reply! Very informative.
I gave a little more though on the Internet thing and I think I'll have an indepentent board to put data online, so there is one less thing to worry about.
The PWM control is just to dim some LEDs, so no problem here, the PID might consume some time with all the calculations needed.
I intend to program in C or C++.
I'm aiming for a low price as this project might end up as a comercial product.
My biggest issue here I think it's the TFT screen control... I fear that M0 would not be capable of executing all functions and on top of that print stuff on the display without lag. Do you agree with me?
I was thinking about starting out with M0 and if I wasn't able to do something I'd upgrade to M3 (codes should be compatible right?).
Yes, the TFT could probably be the one peripheral that controls which implementation you need.
But there are more to TFT than just the letters.
Which resolution do you want ?
If you use 320x240 or less, you might be able to do with one of the smaller M3s.
To be honest, the M0 can handle TFTs, but it's just difficult, compared to using the hardware based solution.
(It's also time-consuming to fine-tune your code to make a flicker-free picture, unless your TFT display has on-board controller/RAM)
I know of two "special" M0 implementations; they use the M0+ core. These are Freescale Kinetis L and NXP LPC812.
Apart from those, I just made a search for "Cortex-M0 TFT", and found this interesting board. It features a LPC1114, a Cortex-M0.
The LPC1114 is a low-cost M0; so is the LPC812 (which runs 30MHz and has a M0+).
But try having a look at the LPC1342 Datasheet, -it's a Cortex-M3 that keeps a low price, and it should be able to do everything that the LPC1114 can do.
So the solution could perhaps be LPC1342 + TFT + ENC28J60 + HanRun HR911105A + SD/MMC socket + sensors.
The LPC series can be programmed via the UART, so you do not have to buy a JTAG adapter. If you decide to buy a JTAG adapter, it might be a good idea to buy a 'general purpose' JTAG adapter, which can program any JTAG device, rather than a specific brand.
Here are two interesting low-cost TFT modules, which could be used with both M0 and M3 via SPI:
2.2" TFTModule and 1.8" TFT Module.
I almost forgot: Yes, the M3 can run binary M0 code, but the M0 cannot run binary M3 code.
-If you're writing your code in C, you can just re-compile it, so it'll be optimized for the M3.
I think I'm going to stick with the M3... My only experience with a TFT was with the one that comes on the STM32 Primer board, so I might have an hard time programming the LCD.
This might become a commercial product so I need to make sure that I'm not paying for functions that I don't need
Those TFTs look very interesting! I'll need to study them a bit to see what I need to do to put them to work before buying them though!
Thanks so much for all the advices
By the way, what's the software you use to program the LPC1342?
If you can use ARM's software, I will recommend that. This is because it's highly optimized for the ARM architecture and they're easier to work with. In addition, the example code that the vendors provide, are usually written for these tools, so they would work right out-of-the-box.
A team from ARM is also working on optimizing GCC. You should get the official Linaro ARM GCC toolchain and the latest possible OpenOCD from the git repository, if you are (like I am) working on a platform the above mentioned tools do not run on (or if you just want to use the open-source tools).
To get the latest OpenOCD:
git clone git://git.code.sf.net/p/openocd/code openocd
cd openocd && ./bootstrap
./configure (see the documentation for options)
make && sudo make install