Author Topic: avr confusion  (Read 6062 times)

0 Members and 1 Guest are viewing this topic.

Offline blackjamesTopic starter

  • Regular Contributor
  • *
  • Posts: 78
avr confusion
« on: September 17, 2012, 07:12:09 am »
hi, i just received this: https://www.sparkfun.com/products/9825 programmer from sparkfun electronics. i want to program a attiny chip with it. (on arduino) i dont have much expirience installing drivers and stuff. it turns out its quite complicated on windows 7, which happens to be what i use. i'm just getting too confused. can anybody help me?
 

Offline blackjamesTopic starter

  • Regular Contributor
  • *
  • Posts: 78
Re: avr confusion
« Reply #1 on: September 17, 2012, 08:20:19 am »
dont worry about attiny chips, just my arduino uno
 

Offline shebu18

  • Frequent Contributor
  • **
  • Posts: 309
  • Country: ro
Re: avr confusion
« Reply #2 on: September 17, 2012, 08:42:09 am »
You wnat to write code to your arduino uno with the programer? why would you want that?
 

Offline blackjamesTopic starter

  • Regular Contributor
  • *
  • Posts: 78
Re: avr confusion
« Reply #3 on: September 17, 2012, 08:49:07 am »
just so i know that im ready to program other boards
 

Offline shebu18

  • Frequent Contributor
  • **
  • Posts: 309
  • Country: ro
Re: avr confusion
« Reply #4 on: September 17, 2012, 09:07:40 am »
If you write something on the avr of the uno you will erase the bootloader so you can not use it as an arduino any more. There should be some tutorials about the programmer on sparkfun. You could use the command line and avrdude to write the hex file to the chip.
 

Offline flano

  • Contributor
  • Posts: 31
  • Country: au
Re: avr confusion
« Reply #5 on: September 17, 2012, 09:46:08 am »
Assume you have Win7 64 bit.

Try these drivers, they use a signed copy of the libusb driver.

http://www.adafruit.com/blog/2010/09/10/usbtinyisp-drivers-for-64-bit-windows-7-vista-x64/
 

Offline blackjamesTopic starter

  • Regular Contributor
  • *
  • Posts: 78
Re: avr confusion
« Reply #6 on: September 17, 2012, 10:36:39 am »
got it working, almost. on arduino software, what programmer should i select
 

Offline blackjamesTopic starter

  • Regular Contributor
  • *
  • Posts: 78
Re: avr confusion
« Reply #7 on: September 17, 2012, 10:40:58 am »
arduino software dosen't know what com port.
 

Offline Tepe

  • Frequent Contributor
  • **
  • Posts: 572
  • Country: dk
Re: avr confusion
« Reply #8 on: September 17, 2012, 11:26:31 am »
arduino software dosen't know what com port.
It is your job to tell it that :)
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11713
  • Country: my
  • reassessing directives...
Re: avr confusion
« Reply #9 on: September 17, 2012, 11:35:05 am »
with arduino uno and arduino software, you dont need any external programmer hardware. just connect the uno to PC using plain usb cable, select appropriate com port (try and error) in ide and done. if using the above hardware, as shebu said you are risking the uno bootloader bye bye. not anything wrong if that is your intention.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline Trigger

  • Regular Contributor
  • *
  • Posts: 78
Re: avr confusion
« Reply #10 on: September 19, 2012, 06:55:03 pm »
There are two main ways an Arduino can be programmed.

When you use the Arduino IDE to program a board over USB you're using the capabilities of the Arduino bootloader.  The bootloader is a small piece of software that will check if it's getting a signal to be programmed when it boots and if not then it will send the execution pointer to the beginning of the code section.  If it gets the signal that it's going to be programmed it will listen and write the incoming program to the code section and when it's finished it will reboot.  This is using the chip's self programming ability to make it easier for people without the hardware usually required to program the chip.  This is why you only need a serial converter like an FTDI chip to be able to program a chip with the Arduino bootloader on it through the serial interface.

The other method is using a hardware programmer to directly write to the memory on the chip.  The programmer you bought from Sparkfun is an example of this.  The Arduino IDE isn't really set up to use this type of hardware.  You'll want to use something like http://www.atmel.com/Microsite/atmel_studio6/  As others have mentioned if you use the programmer you're going to overwrite the Arduino bootloader.  It's not really that much of a problem since you can download it off the chip and save it, or get the image online and reload it later.  The advantage is you get the full resources of the chip as the bootloader isn't taking up any space.

When you step outside of the Arduino environment you're going to find things become a lot more complicated.  The Arduino libraries hide a lot of the underlying complexity of working with the chip.  You'll need to have the datasheet http://www.atmel.com/Images/doc8271.pdf on hand to know how to set up the chip's registers yourself.  It's a much steeper learning curve, but it's rewarding as you get the full capabilities of the chip.  The Arduino libraries restrict some of the chips to maintain backwards compatibility.  You'll need to keep in mind that the way you interact with registers can change depending on the compiler so you'll need to have that documentation on hand too.

Oh and if you do program the Uno use the header on the far edge of the board not the one by the USB port.  If you flash the one controlling USB by mistake you won't be able to use it until you reflash it with the correct firmware.

Edit: I noticed the PocketAVR is for avrdude.  You own't be able to use it directly from the Atmel IDE but you can compile from the IDE and then use avrdude separately to push the firmware.
« Last Edit: September 19, 2012, 07:31:28 pm by Trigger »
 

Offline blackjamesTopic starter

  • Regular Contributor
  • *
  • Posts: 78
Re: avr confusion
« Reply #11 on: September 20, 2012, 09:08:58 am »
whyat is avrdude?
 

Offline Trigger

  • Regular Contributor
  • *
  • Posts: 78
Re: avr confusion
« Reply #12 on: September 20, 2012, 01:43:46 pm »
whyat is avrdude?

You purchased a PocketAVR programmer without reading the description?  It's mentioned a few times and there are links to it.  The PocketAVR is built to be used with it.
 

Offline blackjamesTopic starter

  • Regular Contributor
  • *
  • Posts: 78
Re: avr confusion
« Reply #13 on: September 20, 2012, 09:36:55 pm »
I know about avrdude, but i wast sure how it works, but i read a tutorial. All good
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf