getting started with AVRDUDE on STK500

View: New views
5 Messages — Rating Filter:   Alert me  

getting started with AVRDUDE on STK500

by Irving Ruan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If it's no problem, could someone kindly point me in the right direction on where to get started with this? I'm relatively new to embedded programming and haven't found exactly what I was looking for in the avrdude documention. I have an STK500 (ATmega324p) and a USB to RS-232 adapter. I have the libusb-dev package on ubuntu 9.04, and have avrdude compiled. What steps/precautions should I take from here on out? Can avrdude be integrated with CodeBlocks IDE on linux?

I'm trying to get this all working on Linux so I can move away from development on Windows.

- Irving

--
Irving Y. Ruan
irvingruan@...

_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: getting started with AVRDUDE on STK500

by Wally-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday 06 August 2009 5:04 Irving Ruan wrote:

> If it's no problem, could someone kindly point me in the right direction on
> where to get started with this? I'm relatively new to embedded programming
> and haven't found exactly what I was looking for in the avrdude
> documention. I have an STK500 (ATmega324p) and a USB to RS-232 adapter. I
> have the libusb-dev package on ubuntu 9.04, and have avrdude compiled. What
> steps/precautions should I take from here on out? Can avrdude be integrated
> with CodeBlocks IDE on linux?
>
> I'm trying to get this all working on Linux so I can move away from
> development on Windows.
>
> - Irving

Hi Irving

few weeks ago, i was in the same situation as you describe above.
Fortunately i found  the "Arduino-Project"  (http://arduino.cc).
This project is  perfect for beginners in AVR uC programming.


e.g. the arduino IDE creates a commandline and you can see how
the avrdude is called to flash the uC.

I did not find a documention for the AVR Wizard included in
CodeBlocks but first trials gave good results.

I'm also sure there is an option in C::B to start avrdude to flash
the uC after compiling.

I still use the Arduino IDE but i would prefer to use C::B in future.
I'm using OpenSuse.

cheers wally











 








_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: getting started with AVRDUDE on STK500

by Joerg Wunsch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Irving Ruan <irvingruan@...> wrote:

> I have an STK500 (ATmega324p) and a USB to RS-232 adapter.

In that case, your operating system is allocating a TTY device entry
for the adapter.  That's what you have to use.

> I have the
> libusb-dev package on ubuntu 9.04, and have avrdude compiled.

libusb is not even needed in that case, it's only needed for those
programmers that don't use the TTY abstraction layer.

> What
> steps/precautions should I take from here on out?

Depending on the way your Makefile has been created, it might already
contain precautions to run avrdude (usually as the "program" target).

For a start, just type "man avrdude". ;-)

The plain command is

avrdude -p <your MCU type> -c stk500v2 -P /dev/ttyUSB<N> \
-B<M> -U <your input file to program>

<your MCU type> is whatever AVR type you are trying to program.
Makefiles normally do know that already, as they also have to tell it
(as -mmcu=) to the compiler.

<N> is (obviously) whatever your OS assigns the USB/RS-232 adapter.

<M> is the ISP clock cycle time to tell the STK500, so 1/<M> is the
ISP frequency.  The ISP frequency must always be less than 1/4 of the
CPU clock frequency.  As all AVRs ship with a 1 MHz RC oscillator
enabled (very few with 1.2 MHz), you have to be well below 250 kHz (to
allow for RC oscillator frequency tolerances).  Usually, the value 10
(corresponding to 100 kHz) is a safe, conservative default to use.  If
you intend to run your AVR at a higher clock speed (by modifying
fuses), you can afterwards increase the ISP frequency to speed up the
communication.

<your input file to program> is the loadable file, usually in Intel
Hex format.  (Note that the -U option shown is the shortened form to
just program the flash ROM contents; there's a longer form of the
option arguments to allow for programming arbitrary memory areas
inside the target AVR.  See the manual.)

> Can avrdude be integrated
> with CodeBlocks IDE on linux?

Don't know, I'm an old-time Emacs user. ;-)  It can be easily
integrated into Makefiles (for example, the Mfile template supports
this), so if you can tell Code::Blocks about a custom Makefile target
to run, it should be trivial to integrate.

--
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)


_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: getting started with AVRDUDE on STK500

by Irving Ruan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Wally - I'll check that out. I've heard of it before but never thought of it as a viable tool (lack of information on my part). Thanks.

Joerg - I appreciate the detailed responses. As for RS-232/USB adapters out there, I think the one I currently have is a bit flaky and bad. Do you know any good ones that could work well with linux by any chance?

- Irving


On Wed, Aug 5, 2009 at 10:42 PM, Joerg Wunsch <j@...> wrote:
Irving Ruan <irvingruan@...> wrote:

> I have an STK500 (ATmega324p) and a USB to RS-232 adapter.

In that case, your operating system is allocating a TTY device entry
for the adapter.  That's what you have to use.

> I have the
> libusb-dev package on ubuntu 9.04, and have avrdude compiled.

libusb is not even needed in that case, it's only needed for those
programmers that don't use the TTY abstraction layer.

> What
> steps/precautions should I take from here on out?

Depending on the way your Makefile has been created, it might already
contain precautions to run avrdude (usually as the "program" target).

For a start, just type "man avrdude". ;-)

The plain command is

avrdude -p <your MCU type> -c stk500v2 -P /dev/ttyUSB<N> \
-B<M> -U <your input file to program>

<your MCU type> is whatever AVR type you are trying to program.
Makefiles normally do know that already, as they also have to tell it
(as -mmcu=) to the compiler.

<N> is (obviously) whatever your OS assigns the USB/RS-232 adapter.

<M> is the ISP clock cycle time to tell the STK500, so 1/<M> is the
ISP frequency.  The ISP frequency must always be less than 1/4 of the
CPU clock frequency.  As all AVRs ship with a 1 MHz RC oscillator
enabled (very few with 1.2 MHz), you have to be well below 250 kHz (to
allow for RC oscillator frequency tolerances).  Usually, the value 10
(corresponding to 100 kHz) is a safe, conservative default to use.  If
you intend to run your AVR at a higher clock speed (by modifying
fuses), you can afterwards increase the ISP frequency to speed up the
communication.

<your input file to program> is the loadable file, usually in Intel
Hex format.  (Note that the -U option shown is the shortened form to
just program the flash ROM contents; there's a longer form of the
option arguments to allow for programming arbitrary memory areas
inside the target AVR.  See the manual.)

> Can avrdude be integrated
> with CodeBlocks IDE on linux?

Don't know, I'm an old-time Emacs user. ;-)  It can be easily
integrated into Makefiles (for example, the Mfile template supports
this), so if you can tell Code::Blocks about a custom Makefile target
to run, it should be trivial to integrate.

--
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)


_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat



--
Irving Y. Ruan
irvingruan@...

_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: getting started with AVRDUDE on STK500

by Joerg Wunsch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Irving Ruan <irvingruan@...> wrote:

> As for RS-232/USB adapters out there, I think the one I currently
> have is a bit flaky and bad. Do you know any good ones that could
> work well with linux by any chance?

So far, I've been working on different operating systems with RS-232
adapters based on the FTDI and PL-2303 chips, they all worked well for
me.

--
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)


_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat