Programming a microcontroller.

Thread Starter

CIVEDM

Joined Jan 28, 2014
38
Do I really need a programmer to program a microcontroller? I started researching circuitry and microcontrollers etc,... just want to know if I really need a programmer to program one. I ask because I see these little boards by arduino etc where you hook a usb right to the board to program it. If I built my own little circuit with a uC that I used to control some leds, I'd like to be able to to just hook a usb cable right to the board that I built and go from there. I know this is possible.

So im thinking it is possible. no doubt. But im thinking that I would have to write and install some extra code onto my computer as a driver so that my computer recognizes the device I built? Im just guessing here. You see im trying to learn from the very bottom up. I looked into arduino stuff etc and dont want to go that route because I feel like its a more easy route to go? I want to build and write as much on my own as possible. You know what I mean?

I want to throw a uC onto a bread board and whatever other minimal stuff and connect a usb cable just to get my computer to recognize it so I can begin to write and send to it from a ide.
 

pwdixon

Joined Oct 11, 2012
488
You could use Arduino as the basis by looking at their schematic but you would need a preprogrammed Arduino processor as it has the bootloader that allows you to program directly without programmer hardware. You can even use an Arduino board to program a naked processor but then you are in effect using a programming device I guess. There's no real way around needing a physical programmer device otherwise.

On PICs you can use a cheap programmer like the PicKit device that costs about £30 and then you can program PICs directly with minimal additional hardware.
 

sirch2

Joined Jan 21, 2013
1,037
The chip on an Arduino is already programmed with a bootloader. This is a piece of code that runs at start up and checks for the presence of signals on the USB lines. If it detects the correct handshake it loads a new program over USB, if nothing is detected it runs whatever is in the program memory.

If you buy a bare MCU you cannot program it via USB, you need a programmer. However as pwdixon says you can buy ATMega328 chips that have the Arduino boot loaded already loaded so you could consider that option. Another option is to use an Arduino as a programmer, Google "breadboard arduino".

All that said, programmers for Atmel MCUs are pretty cheap - look at something like a USBTinyISP, about £12 on ebay.
 

MrChips

Joined Oct 2, 2009
30,802
Every MCU manufacturer chooses one or more ways of programming their MCUs.
Some choose a one-wire interface, others use multiple wires, JTAG, SPI, SCI, or even parallel port.

A USB cable will always require some form of embedded software in a controller somewhere to unpack the messages and then program the target MCU.

The simplest solution is to purchase a programmer that the manufacturer recommends. You can also purchase an inexpensive protoboard and use that as your programmer.

Most, of not all MCUs today are designed so that they can be programmed in-circuit. The designer simply has to layout the PCB with a header that connects to the required programming pins.
 

KMoffett

Joined Dec 19, 2007
2,918
Another option is a PICAXE. Free PC programming software, a serial cable (or USB to serial adapter now the serial ports are disappearing), two resistors, and a ~5V power source...that's all you need.
http://www.picaxe.com/
Originally intended for elementary and high school classes. Also a very friendly, knowledgeable, and civil forum.

Ken
 

BobTPH

Joined Jun 5, 2013
8,952
If you intend to program more than a handful of chips, you will save money by buying a programmer and getting raw, unprogrammed chips because chips already programmed with a bootloader like Arduino or PICAXE cost several times as much as the raw chips. Plus, you have more choice in the chips with unprogrammmed ones.

Bob
 

kubeek

Joined Sep 20, 2005
5,795
The MSP430 from texas makes it even easier, it already has a hardware bootloader that lets you program it over a simple serial line.
 

Thread Starter

CIVEDM

Joined Jan 28, 2014
38
Very good info right here! Thanks. I definitely plan on getting a programmer no doubt simply for the ease of it. I was just thinking that say lets down the road i built a piece of hardware for a friend that controls some leds. It would be cool if that friend could hook it up to his computer and be able to write code for it and write it to the hardware with a programmer. You know what I mean? So I would have to obviously build the hardware in such a way that his computer can be hooked up via usb and then I would have to write additional code etc so that the hardware and computer communicate. Im definitely getting a head of myself with this but I just wanted to know because it's been stuck in my head for a the past few days as im learning about all this.

Also,... I learned that each IDE only supports certain controllers. So if I want to use Studio 6 I would only be able to use that IDE for atmel controllers? I feel like im being pressured into choosing sides here. Choosing a manufacturer. you know what I mean? I dont really want to ask which is a better controller line to go with because im afraid that will spark your typical frenzy of these are better yadda yadda. I should just chose something and get started learning?!?!?
 

shteii01

Joined Feb 19, 2010
4,644
Also,... I learned that each IDE only supports certain controllers. So if I want to use Studio 6 I would only be able to use that IDE for atmel controllers? I feel like im being pressured into choosing sides here. Choosing a manufacturer. you know what I mean? I dont really want to ask which is a better controller line to go with because im afraid that will spark your typical frenzy of these are better yadda yadda. I should just chose something and get started learning?!?!?
Depends on ATmel controller.

When I was researching mine back in 2012 I saw people using Arduino IDE and using ATmel Studio. So if you get ATmel chip that Arduino uses on their boards, you can usually use Arduino IDE. But if you get chip that is more industrial and does not have wide support, then you might end up using ATmel Studio exclusively because there is simply nothing else to use.
 

kubeek

Joined Sep 20, 2005
5,795
I personally really like the atmel studio 6, so I think you cannot go wrong there.
Certainly each chip manufacturer has their own tools, just the arduino-avr tandem are sort of interchangeable.
 

Chalma

Joined May 19, 2013
54
I wouldn't feel pressured to pick a controller. I did for a very long time, and also when I came back into learning mcu's again. I would recommend picking one that you notice has great support on forums. As you learn the microcontrollers so does your knowledge. I started with Parallax Basic stamp, and while I really enjoyed it and it was easy you find out later how limited they really are (especially with name brand packages). I've done a few rather large projects now for work with the 8051 and pic's, and all I can say is you'll find nuances and things you don't like. Also with IDE's and programmers/compilers. I would go with what you think will be great for you and your pocketbook. for what my two cents are worth if my child was old enough I would teach her the arduino, not only are the programmers themselves really cheap they give you the programming IDE and other goodies for free, not to mention you can program in C/C++ and their help forums are very newbie friendly (trust me this is a good thing, I went to get help in a PIC forum *which will remain nameless* and they beat me up and down the street because I didn't know ASM and didn't want to learn). Have fun, keep and keep at it.
 

josip

Joined Mar 6, 2014
67
Very good info right here! Thanks. I definitely plan on getting a programmer no doubt simply for the ease of it. I was just thinking that say lets down the road i built a piece of hardware for a friend that controls some leds. It would be cool if that friend could hook it up to his computer and be able to write code for it and write it to the hardware with a programmer. You know what I mean? So I would have to obviously build the hardware in such a way that his computer can be hooked up via usb and then I would have to write additional code etc so that the hardware and computer communicate. Im definitely getting a head of myself with this but I just wanted to know because it's been stuck in my head for a the past few days as im learning about all this.
There are many micros that are coming by default with integrated loader and don't request any programmer (extra hardware) for flashing. For me this is must, and don't see any point if I need any extra flasher (even for 1$) for every user that will use my device and update it with new firmware sometimes.

Also,... I learned that each IDE only supports certain controllers.
For development, there are IDE's (IAR for example, but there also others) with support to many different target devices. There is code size limitation for C free use. Assembler is free without any limitation.
 
Top