views:

457

answers:

6

I'm a software developer. I've been programming in high level languages for a few years.

I would like to know, how to take my first step into programming hardware. Not something crazy complicated, but maybe some ordinary CE device? Assuming I don't need to put the PCB together with varies components, but just to program the tiny cpu?

How low-level do I have to go? ASM? C? manipulating registers? or are the dev kit quite high level now? Is Java even in the picture? OO coding in hardware, is that even a dream or a reality? Need a reality check.

I also tend to learn better with books or sites that are written in a tutorial format. Something that guides the way for me from something simple to something more complex. Any recommendations? Maybe something that will introduce me to the popular hardware (microprocessor/micro-controller) available today?

Much appreciated, thank you everyone.

+2  A: 

If you know C then it's only a matter of learnig the tool chain steps to download the code.

Easy place to start (cheap hardware/software) http://www.arduino.cc/en/Guide/HomePage

Martin Beckett
There's also learning about how IO ports work, memory limitations/requirements incl. possibly paging, interrupt service routines. It's quite a bit more than just knowing C and the toolchain.
Paul Nathan
Paul, do you have a book you recommend for learning those that you mentioned? thank you.
Henry
@Henry: I have not personally run into a nice textbook/walkthrough for those things. I should write one up. :-) You will find discussion of those(to some degree) in technical documentation for a given processor. Some of those areas are in 1 cpu, not in another.
Paul Nathan
I'm not sure if this is even the right Q to ask, but here it is.. what are some of the most popular processors for basic CE devices that are widely available? And generally, what are their capabilities?
Henry
@Henry: define CE. Window CE?
Paul Nathan
Consumer Electronics, like... something as simple as having some sensors, do some easy calculation in the processor, and control some hardware (e.g. display) real-time? Thanks.
Henry
@Paul - yes, but it's easy to get started. As long as you know C and have an idea what a bit is then you should be able to make a micro turn a pin on and off. It was suppsoed tobe a quick encouraging answer
Martin Beckett
Paul Nathan
is freescale (ex. motorola) popular? thx
Henry
I don't know that it's as popular in the hobbyist world as others, but it's definitely a major player overall. The Coldfire softcore(ie loadable onto a FPGA) CPU seems well thought-of.
Paul Nathan
just found this post, quite interesting , atmel-v-microchip-v-freescale: http://diydrones.com/profiles/blogs/atmel-v-microchip-v-freescale
Henry
Paul, it'd be nice if you can provide some resource on "learning about how IO ports work, memory limitations/requirements incl. possibly paging, interrupt service routines". Dev kits don't come with manual that go over those right?
Henry
Paul Nathan
So Arduino still the best choice for beginner? How about something that directly supports AVRStudio? Will that be better?
Henry
AVR studio isn't bad. It's not awesomesauce like visual studio, but it's decent!
Paul Nathan
+6  A: 

The actual programming isn't a big deal. The frustrating, annoying part is getting your development environment setup and getting the tools working. Once you've done that, you're half done.

I'd suggest buying a development kit ('dev kit') that has USB built in and works with your chosen OS. Get that working, and you're halfway done.

If you're missing the knowledge, it's also important to know the basics of how a processor works. You'll be programming at a much lower level than any other programming, so the fundamentals are a bit more important.

Peter
what kind of dev kit do you recommend specifically?
Henry
or.. are there any VM for uController/microprocessor on PC? Like.. doing J2ME development without J2ME phone? Just wondering...
Henry
@Henry: I'd recommend starting with an Atmel processor (they're quite popular and simple) or a Motorola MSP430 or similar (low power). Basically just any dev kit with usb will be good. As to a VM on a PC - I don't know if you can get them these days, but I'd recommend *not* getting one - half the challenge / practice / satisfaction is getting the toolchain working.
Peter
If I wanna go for Atmel processor, I can use Arduino, what if I wanna go for Motorola/Freescale processor? Which dev kit shall I get? and how different will it be programming Atmel vs Motorola/Freescale?
Henry
Seconding Peter here. Try hard to get *some* image - whatever it does - that you can download to the board and run. Maybe some linux, maybe a demo provided by the manufacturer. Thay way, you can make sure that *that* part of the proces works. Then, try to build your own program ("Hello World") and get it to download. Next thing you know, embedded fun.
doppelfish
I'd suggest staying away from Arduino for a while since it abstracts quite a lot of things that a programmer is exposed to when programming the processor directly. After some low-level work you can pick-up Arduino coder-friendly environment.
frgtn
A: 

Also something to look into is the Microsoft Robotics Studio. They support quite a lot of hardware boards (including CE), and with it is is fairly easy to get a small robot up and running. And what's more cool a project to learn embedded programming?

It all integrates nicely in Visual Studio (express) and their devkit also comes with a free express edition.

Toad
what are hardware boards they support? thx
Henry
irobot, fischertechnik, roombo, mindstorms, pioneer, etc... Best thing is you can just program in C#. And better yet, before buying a robot, you can simulate the whole thing and it's world in 3D. And when it starts to work, you buy the hardware and it should run with minimal tweaks
Toad
thx, but i'm not looking into building robots.
Henry
A: 

Get a beagleboard. Cheap, lots of users (community support will be key), many OS options. http://beagleboard.org/

ergosys
Beagleboard, how does it compare to Arduino? Seems like it is already a computer on Linux... am I right? Would programing this similar to writing a linux app?
Henry
Arduino is lower level, great for interfacing to hardware. That's why I think beagleboard is probably more approachable for someone not into hardware hacking. Example: http://letsmakerobots.com/node/11252
ergosys
I see... programming Beagleboard is like programming a high end LEGO MINDSTORMS?
Henry
A: 

Well, if you want to know what you're doing, you need to understand the assembly language of the processor and the processor's architecture.

You will need to learn C to be competent in microcontrollers. There is no way around that.

There are some VM-level languages on embedded systems. I see the Java out-of-memory exception from time to time on my cell phone(which also helps to give me a strong opinion on VM-level embedded languages).

The ARM has some support for hardware-level Java bytecodes.

Your best bet is to pick up something like the PIC or the Atmel chips and begin hacking with them.

If you want to do it with your existing hardware, get a hypervisor for your PC and begin writing a basic kernel.

Paul Nathan
+2  A: 

I have been coding in C both as a hobby and professionally for about 16 years now, but always for userland code (i.e., programs, not kernel or drivers). Most of my jobs involved high level languages (I have done a lot of Perl and Ruby programming, with the occasional Java, Python and shell scripting in between). I did develop a lot for MS-DOS (which was probably as close to bare-metal programming as you would get on a x86 machine), but my last job involved 5 years of Perl and Ruby on Rails web development.

That being said, I am now a senior engineer for embedded Linux development, developing drivers (including an emulator for a legacy simple microprocessor inside a kernel module) for uClinux on the Blackfin platform. There are times when my inexperience with hardware related issues (i.e., floating signal levels due to lack of a pull-up/pull-down on a pin) did get in the way, but it has been mostly a highly enjoyable and thrilling experience. As stated by others, understanding your tools is essential -- for uClinux, that meant the GNU Toolchain, which fortunately I was already familiar with due to my background on FOSS technologies.

The Blackfin is hardly an entry-level microprocessor (in particular, it does not have a MMU, which has some relevant effects on Linux development), but as already stated, you can buy a Beagleboard for around US$200 with all required accessories and start messing around with it in just a few days. If you want something simpler, there are many Arduino options out there, though if you have some real development experience under your belt I believe you will find their development environment a little limiting (I know I did).

After you get comfortable with your tools you might want to spend some money on an in-circuit emulator (or ICE). These are usually highly platform specific (both in terms of target architecture and development environment), but are highly recommended for anything beyond the usual blink-LEDs-after-button-press examples I am sure you will quickly outgrow.

In few months you will find yourself building custom images for hackable customer devices using Buildroot and having a lot of fun. All I can say is, go for it, it's highly addictive and not particularly expensive to do nowadays.

Ulisses Montenegro
Beagleboard, how does it compare to Arduino? Seems like it is already a computer on Linux... like micro-controller on steroid? It runs on linux already? Then.. would programming it be higher level, relative to Arduino? Thank you.
Henry
@Henry Beagleboard is almsot a PC from a few years ago, it runs linux has a network, plugs into a keyboard and monitor - you can probably even develop on it directlyArduino is a real micor controller. It's raw C plus commands to change voltages on pins. You code on a PC, download the finished program, connect the power and hope!
Martin Beckett
Can Beagleboard also do what Arduino do? like... changing voltages on pins and stuff?
Henry
The Beagleboard doesn't seem to have any GPIO pins. Do try to prove me wrong, though.
doppelfish