Welcome! Log In Create A New Profile

Advanced

Does anyone use AVR studio to program their chips?

Posted by Matthew 
Does anyone use AVR studio to program their chips?
February 17, 2010 05:16AM
I've had troubles getting arduino0017 to work, so I thought I'd give avr studio a go as I am using an atavrisp mkII.

I want to load the bootloader (for at168 and for at644p), but I'm not exactly sure which locking bits to activate so that it goes into the bootloader section of the chip and does not get erased when programming later from USB-TTL.

Any ideas?

Thanks
Re: Does anyone use AVR studio to program their chips?
February 17, 2010 05:30AM
I programmed mine with avrdude. Remember: a "programmed" lock bit is zero, and an "unprogrammed" bit is one. Unimplemented lock bits are read as zero (programmed). constructing the proper hex values for avrdude requires an understanding of all these points.

As for the bits themselves, some of them define the size of the bootloader secion. The bootloader cannot erase itself when these are set correctly. Read the datasheets for the chip, specifically the self-programming section and what can and can't be erased/written.


-----------------------------------------------
Wooden Mendel
Teacup Firmware
Re: Does anyone use AVR studio to program their chips?
February 17, 2010 06:30AM
Thanks Triffid. I read through the chip documents and all about the lock bits, but I was kind of hoping someone had a sort of how-to guide so that I don't make any stupid mistakes. Otherwise I'll just plod my way through it. winking smiley
Re: Does anyone use AVR studio to program their chips?
February 17, 2010 01:48PM
I have been using AVR studio for about 10 years. For this I have a dedicated windows machine. Now XP. On the host side I use Mac OSX. (I worked for apple in the 1990s)

AVR Studio is a big monster. Over 100MB of download. For this reason I have not recommended it.


Most of the users here tend to use linux. This pretty much limits the development to the well supported AVRDude. The maintainers of that tool are on AVRFreaks,net.

AVRfreaks,net Forums, are a great place to get questions like this answered. There is a whole section devoted to tutorials.

The key issue with blank programming usually relates to the target clock. There must be a clock source on the blank chip. There is also a requirement that the program clock be 1/4 the target clock.

The newer Avr mega chips come with an internal RC occilator. Typically this is 8mhz. The clock divide by 4 fuse is also enabled, this gives a target clock of 1Mhz, So the program clock needs to be set to about 250Khz. There should be a command line option on AVR dude to set the program clock. This parameter is normally stored in the AVRISP or clone programming pod, so it is set one time.

Another issue that happens a lot, is that if the fuses get the wrong value sent the chip becomes bricked. Often the external crystal is enabled. These can be "reset" by applying a slow clocksource to the external crystal pin.

-julie
Re: Does anyone use AVR studio to program their chips?
February 17, 2010 11:36PM
Read boards.txt in the hardware directory of the arduino software. It includes the expected fuse byte settings. These can be written directly using avrdude in terminal mode.

I used:
avrdude -F -p m644p -b 19200 -c avrisp -P /dev/ttyUSB0 -e -t -u
and then in the terminal:
send 0xac 0xa4 0x00 0xfd
send 0xac 0xa8 0x00 0xdc
send 0xac 0xa0 0x00 0xff
Which should set the extended, high, and low fuse bytes on the sanguino. I had to use send because avrisp1.3 (which is what I had loaded into my decimilla to program my sanguino with) doesn't implement fuse writing. Otherwise you can use simply "w efuse 0 0xfd"

I haven't gotten to talk to it yet, so I don't know if it worked.


--
I'm building it with Baling Wire
Re: Does anyone use AVR studio to program their chips?
February 18, 2010 06:10PM
I also use avrdude for ISP on GNU/Linux :-) and not Arduino bootloader.

There are info over Internet on how to burn Arduino bootloader using avrdude, you can try following that info. Also look at avrdude help!


---
New cutting edge RepRap electronics, ARM 32 bits @ 100MHz runs RepRap @ 725mm/s:

[www.3dprinting-r2c2.com]
I got myself a arduino board and am very desapointed due to it having its own little set of funtions and personal IDE, very poor. Is there an environmente in C such as avr studio 4 that can upload directly the programs to the chip using the arduino bootloader already installed by fabric.
Apreciate since i dont like arduino programming style its not flexible and dont want to learn something that is worthless in real life.
Re: Does anyone use AVR studio to program their chips?
April 04, 2010 12:34PM
sergio Wrote:
-------------------------------------------------------
> I got myself a arduino board and am very
> desapointed due to it having its own little set of
> funtions and personal IDE, very poor. Is there an
> environmente in C such as avr studio 4 that can
> upload directly the programs to the chip using the
> arduino bootloader already installed by fabric.

I think Arduino is rich. not poor, but I guess it depends on perspective.

Arduino is a board with Atmel AVR, you can always go looking for commercial support tools. Look at Atmel pages for such products, for example.


> Apreciate since i dont like arduino programming
> style its not flexible and dont want to learn
> something that is worthless in real life.

Hey? You think RepRap is not real life? -- there are people doing business over RepRap! And even Arduino, many commercial products!

Edited 1 time(s). Last edit at 04/04/2010 12:35PM by casainho.


---
New cutting edge RepRap electronics, ARM 32 bits @ 100MHz runs RepRap @ 725mm/s:

[www.3dprinting-r2c2.com]
Re: Does anyone use AVR studio to program their chips?
April 04, 2010 01:58PM
Its all a matter of perspective, as a professional software engineer I find the Arduino environment limited, I dislike the layout and configuration.

However this is due to the fact that I am familiar with other IDE's and their capabilities.

I am not against Arduino, the simplicity of the interface is ideal for new users and those wishing to understand at least something about embedded programming without being completely overwhelmed by all the potential capabilities of a system.

And the supplied libraries allow some rapid development and being open source allow the users to use the libraries and then understand what they are doing underneath, improving their knowledge.

Take for example, Eclipse one of the most widely used free IDEs around. I feel its the complete polar opposite of Arduino, overcomplicated, clumsy and slow. I also find the ergonomics of this interface poor.

The IDE used is very much a personal preference (although in commercial software the engineer rarely has a choice!), use what you feel happy with! smiling smiley
Re: Does anyone use AVR studio to program their chips?
April 04, 2010 02:10PM
Besides, you don't have to use arduino to compile and upload sketches.
There's a Makefile in arduino-00XX/hardware/cores/arduino!
Re: Does anyone use AVR studio to program their chips?
April 04, 2010 02:33PM
I have been using ATMEL chips and Avr studio for about 10 years. This is probably why I still program in asm, as I have a lot of code written. When I started I coded 8051 so a bunch of that code got ported into my archives. I also have a little sub micro kernal, which allows me to run code inside three different threads.

I do install the C compiler (WINAVR-gcc) Usually I can do the same thing in asm. Someday I expect to write something in C. It is most useful when programming a laptop, where functions like malloc and free make sense.

-julie
Re: Does anyone use AVR studio to program their chips?
April 06, 2010 08:26PM
Ogre, have you ever tried to actually use that makefile?

I have, and it not only does it not work right out of the box, it takes a LOT of fiddling to get it to work.

There are two main problems with it:
The Arduino IDE uses an "invisible" "main.cpp" file. One is included, so that can be copied in. Really stupid that it's not done automatically by the makefile though, as it's only 5 or so lines.
The Arduino IDE seems to do something odd with prototypes. The only way I figured out to get it to work was to manually make a header file with prototypes for all functions and global variables, then modify the "main.cpp" file to include it, and include it before every other file compiled as well.

In short, I never did figure out a way to get it to compile without modification the distributed source code for the reprap firmware. Nor did I figure out anyway to automatically compile arbitrary source code that compiles fine in the IDE.

I was very dissatisfied with the functionality and documentation of the arduino-included makefile.

That WAS a few revisions ago, but I doubt it's substantially changed.


--
I'm building it with Baling Wire
Sorry, only registered users may post in this forum.

Click here to login