Author Topic: Beginner AVR First Steps  (Read 2511 times)

0 Members and 1 Guest are viewing this topic.

Offline McflyTopic starter

  • Contributor
  • Posts: 18
  • Country: us
Beginner AVR First Steps
« on: December 22, 2012, 04:56:39 am »
Hi all
I have been programming for the arduino for some time now and i'm getting reasonably good at it, but how should I go about
moving on to AVR MCUs?  I also already know how to make PCBs for thru hole and SMD, so mounting isnt an option.

__

What should i buy?
Can i get away with using the arduino as an isp?
What software? --> 64 bit windows 7
_
thanks
 ;D
 

Offline notsob

  • Frequent Contributor
  • **
  • Posts: 696
  • Country: au
Re: Beginner AVR First Steps
« Reply #1 on: December 22, 2012, 05:04:08 am »
Probably be a good idea to go to avrfreaks.net website
 

Offline McMonster

  • Frequent Contributor
  • **
  • Posts: 413
  • Country: pl
    • McMonster's blog
Re: Beginner AVR First Steps
« Reply #2 on: December 22, 2012, 05:36:09 am »
Arduino isn't a microcontroller! It is a developement board, IDE, C++ libraries and a bootloader for the AVR microcontrollers. So you've been programming an AVR all the time.

To program bare AVRs outside Arduino IDE just install Atmel Studio or find a tutorial for Eclipse + WinAVR. You don't even need to buy a programmer, you can use the existing bootloader to load the hex. Then get the datasheet for the micro in your Arduino and start programming. It'll be the same, but you'll be setting individual bits in registers instead of calling functions that did it for you. Any tutorial should be a good start, I learned AVRs from this one, just skip the programmer stuff.
 

Offline UPI

  • Regular Contributor
  • *
  • Posts: 139
  • Country: us
Re: Beginner AVR First Steps
« Reply #3 on: December 22, 2012, 01:52:34 pm »
I use the Pololu USB AVR Programmer for ICSP programming as well as changing fuse settings.
http://www.pololu.com/catalog/product/1300

It works well with Atmel Studio 6.
http://www.atmel.com/microsite/atmel_studio6/

I purchased a license for Cadsoft Eagle for schematics and board layout. It works good enough for me but expensive.
http://www.cadsoftusa.com/

I downloaded all of the Arduino Eagle schematics to use as examples as well as to borrow different package layouts etc.
http://arduino.cc/en/Main/Products

Here are some links to basic MCU interfacing circuits.
http://www.bristolwatch.com/ele/transistor_drivers.htm
http://cq.cx/interface.pl
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1289
  • Country: fi
Re: Beginner AVR First Steps
« Reply #4 on: December 22, 2012, 02:11:05 pm »
Hi all
I have been programming for the arduino for some time now and i'm getting reasonably good at it, but how should I go about
moving on to AVR MCUs?  I also already know how to make PCBs for thru hole and SMD, so mounting isnt an option.

__

What should i buy?
Can i get away with using the arduino as an isp?
What software? --> 64 bit windows 7
_
thanks
 ;D
OK, you can make PCBs. In that case let me suggest this: Come up with a reasonably simple small project where you can put the features of a microcontroller into use. A combined egg timer / oven thermometer or something equally silly but something where you need to exercise the integrated peripherals of the chip.
The ATMega328 in an Arduino is a good candidate for a practice MCU. They come in 32 pin QFPs that are reasonably easy to solder even manually with an iron (i do that all the time).
One thing you need to make clear to yourself early on: how are you going to program the chip and how are you going to debug the code you are going to write. In Arduino the programming has been taken care of, so you didn't need to worry. Similar idea is possible in your own system but then you need to get familiar with bootloaders; how to set it up and how to communicate with one. Conceptually simpler is just to use Atmel's ready made tools as part of say AVR Studio 4-5 / Atmel Studio 6. That way you don't need a bootlöoader+accessories at all, but you do need a programmer device to move the program image to the target MCU. Also you need to implement the ISP signaling header on your PCB (piece of cake). Personally, i never bother with bootloaders because i have all the tools, but it may be significant if you want to do field upgrades. Then an Arduino style bootloading system gets you there with just a regular PC and a USB cable.
The Arduino I/O is the simplest possible - wires out from the MCU and straight into the headers. That is not how it is done in real life. Generally you need to consider input protection against surges, and signal integrity in the environment that the device is subjected to. Also you need to pay attention to pin assignment regarding primary and secondary functions available for each of them.
Once you have created your initial HW design, you should check that it will be programmable to function the way you wanted, and that you are clear how to transfer the program image and debug the solution (if you plan to do that, but i highly recommend it). Once there it is time to implement and let loose.

A final word about debugging: Arduino doesn't have it. The Atmel chip inside sure does, but Arduino does not implement it due to lack of necessary hardware. The 328 and many other Atmel chips implement a system called debugWire, where the reset signal pin is used to communicate debugging info across. For that to work, you need PC hardware to support the protocol. I haven't studied the alternatives, personally i use Atmel's JTAGICE 2 and 3 devices but they have their price. There may be other, 3rd party options but you will have to find out. AVRFreaks forum, as stated, is the go-to place.
Nothing sings like a kilovolt.
Dr W. Bishop
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf