37

I've experience in doing desktop and web programming for a few years. I would like to move onto doing some embed system programming. After asking the initial question, I wonder which hardware / software IDE should I start on...

Or... doesn't matter?

Which development platform is the easiest to learn and program in (take in consideration of IDE usability)?

Which one is the easiest to debug if something goes wrong?

My goal is to learn about "how IO ports work, memory limitations/requirements incl. possibly paging, interrupt service routines." Is it better to learn one that I'll use later on, or the high level concept should carry over to most micro-controllers?

Thanks!

update: how is this dev kit for a start? Comment? suggestion?

Community
  • 1
  • 1
Henry
  • 31,972
  • 19
  • 112
  • 214
  • 1
    suggest "embedded" rather than programming -- almost all Qs on this site are about programming – Jason S Jan 26 '10 at 04:43
  • 7
    Arduino is not a Microcontroller, it is a brand of development board carrying an Atmel AVR microcontroller. Atmel is not a microcontroller it is a company who's products include a number of microcontroller architectures including AVR, AVR32, and ARM. Likewise Freescale is a company with a number of distinct architectures, including ARM, PowerPC and ColdFire. So two of your suggestions don't specify an architecture, and one is a duplicate. – Clifford Jan 26 '10 at 21:04
  • @Clifford, thx, I just modified my Q. Arduino is not a microcontroller per se but from my understanding, it has some abstraction that makes programming the mcu easier than straight to Atmel AVR mcu? due to.. the bootloader? – Henry Jan 26 '10 at 21:29
  • 1
    @Henry I don't see anything wrong with the EKI-LM3S3748. It uses FTDI drivers to simulate JTAG over USB. So, you won't have to buy a programmer. $109 seems like a reasonable price for what you get. Also, be sure to read "Selection Guide of Low Cost Tools for Cortex-M3" (see my answer for the link). – Judge Maygarden Jan 27 '10 at 21:13
  • 2
    Thank you very much Judge, where's your amazon wishlist? :) – Henry Jan 27 '10 at 21:41
  • My amazon wishlist is right here: http://amzn.com/w/2453UELU5UG4N ;) – Judge Maygarden Jan 28 '10 at 02:07
  • Well, thanks Henry! I had a pleasant surprise in an amazon box this past weekend. – Judge Maygarden Feb 08 '10 at 16:39
  • Don't use Arduino to try to learn low level details, it is not designed for that. Use any well documented evaluation board, CodeFire is a good choice according to my experience. – W.Sun Dec 30 '13 at 04:46

14 Answers14

19

Personally, I'd recommend an ARM Cortex-M3 based microcontroller. The higher-power ARM cores are extremely popular, and these low-power versions could very well take off in a space that is still littered with proprietary 8/16-bit cores. Here is a recent article on the subject: The ARM Cortex-M3 and the convergence of the MCU market.

The Arduino is very popular for hobbyist. Atmel's peripheral library is fairly common across processor types. So, it would smooth a later transition from an AVR to an ARM.

I don't mean to claim that an ARM is better than an AVR or any other core. Choosing an MCU for a commercial product usually comes down to peripherals and price, followed by existing code base and development tools. Besides, microcontrollers are general much much simpler than a desktop PC. So, it's really not that hard to move form one to another after you get the hang of it.

Also, look into FreeRTOS if you are interested in real-time operating system (RTOS) development. It's open source and contains a nice walk through of what an RTOS is and how they have implemented one. In fact, their walk-through example even targets an AVR.


Development tools for embedded systems can be very expensive. However, there are often open source alternatives for the more open cores like ARM and AVR. For example, see the WinARM and WinAVR projects.

Those tool-chains are based on GCC and are thus also available (and easier to use IMHO) on non-Windows platforms. If you are familiar with using GCC, then you know that there are an abundance of "IDE's" to suit your taste from EMACS and vi (my favorite) to Eclipse.

The commercial offerings can save you a lot of headaches getting setup. However, the choice of one will very much depend on your target hardware and budget. Also, Some hardware support direct USB debugging while others may require a pricey JTAG adapter.


Other Links:


Low-Cost Cortex-M3 Boards:


New Arduino to utilize an ARM Cortex-M3 instead of an AVR microcontroller.

Judge Maygarden
  • 25,264
  • 8
  • 76
  • 98
  • Thank you for the link, that's indeed interesting, but I'm concern about the cost of the ARM based microcontroller. http://beagleboard.org/ seems like a good idea, but are all ARM based microcontroller/processor compatible with the same code ARM code? thx. – Henry Jan 26 '10 at 04:33
  • 7
    The beagle board uses an ARM Cortex-A8, which is *entirely* different than an ARM Cortex-M3. An A8 is 500+ MHz, has an MMU, FPU, and the beagle board has a couple hundred meg of RAM and an SD card slot for GBs of flash, and is designed to run an OS like linux. An M3 only goes to 72MHz, has tens of kB of RAM and 100s of kB of flash, and is a 'real' embedded system, with performance constraints that you need to learn about. – KeyserSoze Jan 26 '10 at 05:40
  • @Henry If you stick to portable C code and don't count vendor specific peripherals, then ARM based code is compatible. However, there are 3 variants of ARM assembly language. There is the original 32-bit version and the often optional 16-bit "Thumb" variant. The Cortex-M0/3 only have the new Thumb2 which is supposed to meet in the middle as far as execution speed versus code size. – Judge Maygarden Jan 26 '10 at 06:43
  • Is there a dev kit for ARM Cortex-M3? how much is ARM Cortex-M3 compare to a similar performance Atmel chip? thx. – Henry Jan 26 '10 at 09:28
  • @Henry Why don't you specify your desired budget and features (USB, LCD display, NAND flash, etc.) and then people can make detailed suggestions? I have Atmel and ST Cortex-M3 development boards that were in the $200-$300 range if I recall correctly. There are a lot of other providers as well (e.g. NXP, Toshiba, TI, etc.). – Judge Maygarden Jan 26 '10 at 15:05
  • @Henry I want to reiterated that I've heard nothing but good things about AVR microcontrollers as in the Arduino. It's just that I haven't personally used them. So, I can't expound on them as fully. – Judge Maygarden Jan 26 '10 at 15:07
  • I'm not sure about what feature I need yet, budget =< $200 is fine. I just want to get my feet wet on doing some embed programming in C/C++, and work with sensors, motor, and LCD display. Thanks! – Henry Jan 26 '10 at 18:28
  • Have you heard of Cortex Microcontroller Software Interface Standard http://www.onarm.com/ ? What is it and what does it bring to the table? Does it mean if my C code is using CMSIS, then it should work across all ARM based microcontroller? cool... abstraction is good.. – Henry Jan 26 '10 at 18:54
  • Yes, I've worked with CMSIS recently with STM32 and SAM3U variants. It unifies the startup code and access to the built-in/core features of the Cortex-M3 like the lower-power modes and interrupt controller. All the other peripherals (SPI, ADC, UART, etc.) will still be vendor specific. – Judge Maygarden Jan 26 '10 at 20:23
  • with budget ~ $200, which dev kit should I get? Thx. – Henry Jan 26 '10 at 21:32
  • and.. under what situation do I need to use a RTOS? Thx. – Henry Jan 26 '10 at 21:43
  • @Henry An RTOS makes it much easier to respond to multiple, prioritized, asynchronous events. Even if that is the case, you have to weigh the extra memory and processing cost before deciding to use an RTOS over rolling your own scheduling solution. – Judge Maygarden Jan 29 '10 at 19:00
  • Re: Budget - Developer boards are expensive, since they sell in low qualities (one per developer). The chips themselves are surprisingly cheap if you buy them by the thousands. – doppelfish Feb 03 '10 at 19:58
  • Re: RTOS - Choose a board that runs linux. Use an RTOS only if you *must* meet realtime requirements. RTOSs tend to be somewhat bland and beasty, and it's hard to get them to run at all and to program against them without the support of the manufacturer can be time consuming. – doppelfish Feb 03 '10 at 20:03
  • 1
    @dopplefish I've had an excellent experience using FreeRTOS on both STM32 and SAM3U targets, but I'm used to running without an OS. Suggesting Linux for an AVR or an Cortex-M3 is not very practical. – Judge Maygarden Feb 04 '10 at 14:33
5

Given that you already have programming experience, you might want to consider getting an Arduino and wiping out the firmware to do your own stuff with AVR Studio + WinAVR. The Arduino gives you a good starting point in understanding the electronics side of it. Taking out the Arduino bootloader would give you better access to the Atmel's innards.

To get at the goals you're setting out, I would also recommend exploring desktop computers more deeply through x86 programming. You might build an x86 operating system kernel, for instance.

Brian
  • 2,351
  • 19
  • 24
  • wiping out firmware = de-Arduino? cool, never thought of that. Your advice of learning those concepts in x86 first is because.. the development cycle is much shorter and easier to debug? Please give me some more details on how to learn C kernel programming and how I can apply that knowledge to microcontroller programming later on. I thought they're complete different subjects.. Thanks. – Henry Jan 26 '10 at 02:51
  • Mostly because the x86 is extremely well documented. It's also easier to see what you're doing. Plus you already have one. Much of the conceptual stuff related to microcontrollers also applies to low-level stuff on a desktop computer. You can read some details here: http://www.osdever.net/bkerndev/index.php?the_id=90 and there's a cookbook-style tutorial here: http://www.jamesmolloy.co.uk/tutorial_html/index.html. – Brian Jan 26 '10 at 04:28
  • Thx for the advice, but I think I shall go straight to programming the mcu in C. Which AVR dev kit would u recommend? Would like to try AVR Studio / WinAVR controlling some LED / control, speaker, mortor, or whatever interesting. Thanks. – Henry Jan 27 '10 at 01:24
  • If you know some basic electronics you don't even need a dev kit for AVR, it is very easy to set up on a breadboard. It then suffices to get a programmer. – starblue Jan 27 '10 at 19:52
4

ARM is the most widely used embedded architecture and covers an enormous range of devices from multiple vendors and a wide range of costs. That said there are significant differences between ARM7, 9, 11, and Cortex devices - especially Cortex. However if getting into embedded systems professionally is your aim, ARM experience will serve you well.

8 bit architectures are generally easier to use, but often very limited in both memory capacity and core speeds. Also because they are simple to use, 8-bit skills are relatively easy to acquire, so it is a less attractive skill for a potential employer because it is easy to fulfil internally or with less experienced (and therefore less expensive) staff.

However if this is a hobby rather than a career, the low cost of parts, boards, and tools, and ease of use may make 8 bit attractive. I would suggest AVR simply because it is supported by the free avr-gcc toolchain. Some 8 bit targets are supported by SDCC, another open source C compiler. I believe Zilog make their Z8 compiler available for free, but you may need to pay for the debug hardware (although this is relatively inexpensive). Many commercial tool vendors provide code-size-limited versions of their tools for evaluation and non-commercial use, but beware most debuggers require specialist hardware which may be expensive, although in some cases you can build it yourself if you only need basic functionality and low speeds.

Whatever you do do take a look at www.embedded.com. If you choose ARM, I have used WinARM successfully on commercial projects, although it is not built-for-comfort! A good list of ARM resources is available here. For AVR definitely check out www.avrfreaks.net

I would only recommend Microchip PIC parts (at least the low-end ones) for highly cost sensitive projects where the peripheral mix is a good fit to the application; not for learning embedded systems. PIC is more of a branding than an architecture, the various ranges PIC12, 16, 18, 24, and PIC32 are very different from each other, so learning on one does not necessarily stand you in good stead for using another - often you even need to purchase new tools! That said, the dsPIC which is based on the PIC24 architecture may be a good choice if you wanted to get some simple DSP experience at the same time.

In all cases check out compiler availability (especially if C++ support is a requirement) and cost, and debugger hardware requirements, since often these will be the most expensive parts of your dev-kit, the boards and parts are often the least expensive part.

Clifford
  • 76,825
  • 12
  • 79
  • 145
  • Is AVR used in commercial products at all? Or is it mostly used by the hobbyist? – Henry Jan 26 '10 at 23:04
  • What's a good ide/toolchain for ARM Cortex-M3? Do I need a hardware debugger to start? What do they do? Thank you. – Henry Jan 26 '10 at 23:05
  • 1
    No chip vendor would survive only serving the hobbyist market. AVR are used extensively in commercial products. – Clifford Jan 26 '10 at 23:26
  • 1
    AVR and PIC are generally fighting over top dog in market share of the 8bit uC market, so both are widely used commercially. Microchip did offer to buy Atmel back in 2008 although atmel said "no way man". – Mark Jan 29 '10 at 01:31
  • 1
    8 bit devices of all flavours including AVR are widely used in commercial products, but these tend to be simple, low-end, or deeply embedded devices, such as toys, heating controllers, domestic appliances etc. So you may not be aware of them, but they constitute probably the vast majority of applications. Atmel claim they have 30% of the "8-bit Flash Microcontroller" market. At various times Microchip and Atmel have claimed to be number one. But either way AVR is the better technical design compared to low-end PICs, and its instruction set is better suited to C code generation. – Clifford Jan 30 '10 at 08:57
2

This is kind of a hard question to answer as your ideal answer very much depends on what it is your interested in learning.

If your goal is just to dive a little deeper into the inner workings of computing systems i would almost recommend you forgo the embedded route and pick up a book on writing a linux kernel module. Write something simple that reads a temperature sensor off the SMbus or something like that.

If your looking at getting into high level (phones, etc) embedded application development, download the Android SDK, you can code in java under eclipse and even has a nice emulator.

If your looking at getting into the "real" microcontroller space and really taking a look at low level system programming, i would recommend you start on a very simple architecture such as an AVR or PIC, something without an MMU.

Diving into the middle ground, for example an ARM with MMU and some sort of OS be it linux or otherwise is going to be a bit of a shock as without a background is both system programming and hardware interfacing i think the transition will be very rough if you plan to do much other than write very simple apps, counting button presses or similar.

Mark
  • 2,892
  • 16
  • 15
  • side question, is complexity level of AVR similar to Freescale HC08/HC12? Thanks. – Henry Jan 28 '10 at 17:57
  • An AVR such as the ATmega328 (Arduino) is an 8bit MCU and would be similar to the HC08 in design/capabilities, both similar to low end PIC18 or PIC16 parts. The HC12 is a 16bit MCU, and would be most similar to a PIC24,dsPIC, or AVR XMEGA. I believe all these MCU's are RISC designs and use harvard architectures. For what its worth my first introduction to MCU programming was learning assembly on a 68HC11 core, which is the predecessor to the HC12. From there i moved on to PIC's and later to more complex cores. – Mark Jan 29 '10 at 01:08
2

Texas Instruments has released a very interesting development kit at a very low price: The eZ430-Chronos Development Tool contains an MSP430 with display and various sensors in a sports watch, including a usb debug programmer and a usb radio access point for 50$

There is also a wiki containing lots and lots of information.

I have already created a stackexchange proposal for the eZ430-Chronos Kit.

lImbus
  • 1,527
  • 3
  • 14
  • 25
2

No it doesn't matter if you want to learn how to program an embedded device. But you need to know the flow of where to start and where to go next. Cause there are many micro-controllers out there and you don't know which one to choose. So better have a road-map before starting.

In my view you should start with - Any AVR board (atmega 328P- arduino boards or AVR boards) then you should go to ARM micro-controller - first do ARM CORTEX TDMI then ARM cortex M3 board.Thus this will give you an overall view after which you can choose any board depending on what kind of project you are working and what are your requirements.

Bhargav Rao
  • 41,091
  • 27
  • 112
  • 129
Alchemy18
  • 11
  • 1
1

Whatever you do, make sure you get a good development environment. I am not a fan of Microchip's development tools even though I like their microcontrollers (I have been burned too many times by MPLAB + ICD, too much hassle and dysfunction). TI's 2800 series DSPs are pretty good and have an Eclipse-based C++ development environment which you can get into for < US$100 (get one of the "controlCARD"-based experimenter's kits like the one for the 28335) -- the debugger communications link is really solid; the IDE is good although I do occasionally crash it.

Somewhere out there are ICs and boards that are better; I'm not that familiar with the embedded microcontroller landscape, but I don't have much patience for poor IDEs with yet another software tool chain that I have to figure out how to get around all the bugs.

Jason S
  • 171,795
  • 155
  • 551
  • 900
  • I'll second that. Good development tools make a world of difference and are arguably more important than the microcontroller selection. – semaj Jan 26 '10 at 16:18
  • Yes, that's why I ask this question with IDE next to the ICs... :) – Henry Jan 26 '10 at 18:31
  • A side note to the PIC ICD situation, if you plan to muck around with the circuit at all or even leave the electronics exposed, pick up a spare PIC programmer, i've burnt a bunch of em, they have very poor protection against high voltage/shorts. – Mark Jan 29 '10 at 01:13
1

Some recommend the ARM. I'd recommend it, not as a first platform to learn, but as a second platform. ARM is a bit complex as a platform to learn the low-level details of embedded, because its start-up code and initialisation requirements are more complicated than many other micros. But ARM is a big player in the embedded market, so well worth learning. So I'd recommend it as a second platform to learn.

The Atmel AVR would be good for learning many embedded essentials, for 3 main reasons:

  1. Architecture is reasonably straight-forward
  2. Good development kits available, with tutorials
  3. Fan forum with many resources

Other micros with development kits could also be good—such as MSP430—although they may not have such a fan forum. Using a development kit is a good way to go, since they are geared towards quickly getting up-and-running with the micro, and foster effective learning. They are likely to have tutorials oriented towards quickly getting started.

Well, I suppose the development kits and their tutorials are likely to gloss over such things as bootloaders and start-up code, in favour of getting your code to blink the LED as soon as possible. But that could be a good way to get started, and you can explore the chain of events from "power-on" to "code running" at your pace.

I'm no fan of the PICs, at least the PIC16s, due to their architecture. It's not very C-friendly. And memory banks are painful.

Craig McQueen
  • 37,399
  • 27
  • 113
  • 172
  • I don't want to use Arduino programming language though. Is it easy to use Arduino Mega with AVR Studio? Also, how can I learn how to control an electric motor, or use a DAC with Arduino Mega? Would a more feature-rich dev kit be more beneficial? thx – Henry Jan 27 '10 at 01:05
  • Sure, no need to use the Arduino software. Write your code using AVR studio, and upload to the board using programming software directly. As for motors or DACs, I'm sure there would be development boards that would suit. A Google search should find something. – Craig McQueen Jan 27 '10 at 01:57
1

It does matter, you need to gradually acquire experience starting with simpler systems. Note that by simpler I dont mean less powerful, I mean ease of use, ease of setup etc. In that vein I would recommend the following (I have no vested interest in a any of the products, I just found them the best):

I've started using one of these (MBED developer board). The big selling points for me were that I could code in C or C++, straightforward connection vis USB and a slick on-line development environment (no local tool installation required at all!).

http://mbed.org/

Five minutes afer opening box I had a sample blinky program (the 'hello world' of the emedded world) running the following:

#include "mbed.h"

DigitalOut myled(LED1);

int main()
{
    while(1)
    {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
    }
}

That's it! Above is the complete program!

It's based on ARM Cortex M3, fast and plenty of memory for embedded projects (100mhz, 256k flash & 32k ram). The online dev tools have a very good library and plenty of examples and theres a very active forum. Plenty of help on connecting devices to MBED etc

Even though I have plenty of experience with embedded systems (ARM 7/9, Renases M8/16/32, Coldfire, Zilog, PIC etc) I still found this a refreshingly easy system to get to grips with while having serious capability.

After initially playing with it on a basic breadboard I bought a base board from these guys: http://www.embeddedartists.com/products/lpcxpresso/xpr_base.php?PHPSESSID=lj20urpsh9isa0c8ddcfmmn207. This has a pile of I/O devices (including a miniture OLED and a 3axis accelerometer). From the same site I also bought one of the LCPExpresso processor boards which is cheap, less power/memory than the MBED but perfect for smaller jobs (still hammers the crap out of PIC/Atmega processors). The base board supports both the LCPExpresso and the MBED. Purchasing the LCPExpress processor board also got me me an attached JTAG debugger and an offline dev envoronment (Code Red's GCC/Eclipse based dev kit). This is much more complex than the online MBED dev environment but is a logical progression after you've gained expeience with the MBED.

With reference to my original point noite that the MBED controller is much more capable than the the LPCExpresso controller BUT is much simpler to use and learn with.

Tim Ring
  • 1,734
  • 1
  • 18
  • 26
1

I use microchips PIC's, its what I started on, I mainly got going on it due to the 123 microcontroller projects for the evil genius book. I took a Microprocessors class at school for my degree and learned a bit about interrupts and timing and things, this helped a ton with my microcontrollers. I suppose some of the other programmers etc may be better/easier, but for $36 for the PicKit1, I'm too cheap to go buy another one...and frankly without using them I don't know if they are easier/better, I like mine and recommend it every chance I get, and it took me forever to really actually look at it, but I was able to program another chip off board with ICSP finally. I don't know what other programmers do it, but for me that's the nicest thing 5 wire interface and you're programmed. Can't beat that with a stick...

onaclov2000
  • 5,055
  • 9
  • 38
  • 51
1

I've only used one of those.

The Freescale is a fine chip. I've used HC-something chips for years for little projects. The only caveat is that I wouldn't touch CodeWarrier embedded with a 10 foot pole. You can find little free C compilers and assemblers (I don't remember the name of the last one I used) that do the job just fine. Codewarrior was big and confusing and regardless of how much I knew about the chip architecture and C programming always seemed to only make things harder. If you've used Codewarrior on the Mac back in the old days and think CW is pretty neat, well, it's not at all like that. CW embedded looks vaguely similar, but it works very differently, and not very well.

A command-line compiler is generally fine. Professionals who can shell out the big bucks get expensive development environments, and I'm sure they make things better, but without that it's still far better than writing assembly code for a desktop PC in 1990, and somehow we managed to do that just fine. :-)

Ken
  • 2,684
  • 18
  • 11
  • In my experience, professionals are wishing they could throw away the big bucks IDE with its crap editor and file damagement and get some real tools to use with the "command-line compiler". :) – XTL Jan 09 '12 at 07:02
0

You might consider a RoBoard. Now, this board may not be what you are looking for in terms of a microcontroller, but it does have the advantage of being able to run Windows or DOS and thus you could use the Microsoft .NET or even C/C++ development tools to fiddle around with things like servos or sensors or even, what the heck, build a robot! It's actually kinda fun.

There's also the Axon II, which has the ATmega640 processor.

Either way, both boards should help you achieve your goal.

Sorry for the robotics focus, just something I'm interested in and thought it may help you too.

  • The RoBoard is just a small single-board computer. It won't him explore embedded system development per se. – Trent Jan 26 '10 at 22:18
  • @Trent - That's why I said it may not be what he's looking for, however, like I said he would still be able to control servos, sensors etc... Plus he could run Windows XP embedded... –  Jan 27 '10 at 01:59
0

I use PICs, but would consider Arduino if I chose today. But from your goals:

  • how IO ports work
  • memory limitations/requirements
  • interrupt service routines

I wonder if you best bet is just to hack in the Linux kernel?

kenny
  • 18,952
  • 7
  • 47
  • 82
0

BBC Micro Bit

https://en.wikipedia.org/wiki/Micro_Bit

This cheap little board (~20 pounds) was crated by ARM Holdings as an educational device, and 1M units were given out for free to UK students.

It contains an ARM Cortex-M0, the smallest ARM core of all.

I recommend it as a first micro-controller board due to its wide availability, low cost, simplicity, and the fact that it introduces you to the ARM architecture, which has many more advanced boards also available for more serious applications.

Ciro Santilli
  • 2,603
  • 1
  • 8
  • 31