Avrdude reset?

Go To Last Post
18 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does AVRdude try to perform a reset by using one of the RS232 handshake signals (assuming one of them is wired to the CPU reset line)? I've been manually pressing the reset button on my prototype boards and then QUICKLY hitting the return key to run avrdude to program the device (having pre-entered the command line up to the return). It would be better if avrdude could first reset the device, and then try to communicate (especially since the final hw wouldn't have the reset button available).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The ISP sequence starts with pulling /RESET low. This is mandatory. ;-)

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wonder if kscharf meant when using with something like the Arduino bootloader. As far as I know (DP knows more about this) they have one of RS232 control lines wired to reset the AVR so that it can be kicked back into bootload reception mode.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dl8dtl wrote:
The ISP sequence starts with pulling /RESET low. This is mandatory. ;-)

Yes, but what I meant was is there a defined way that avrdude can perform this itself via the RS232 handshake lines? The --help option does not seem to have data for this, I would need to know WHICH RS232 handshake line to wire back (I think Arduino connects it with a capacitor) to the reset line.
clawson wrote:
I wonder if kscharf meant when using with something like the Arduino bootloader. As far as I know (DP knows more about this) they have one of RS232 control lines wired to reset the AVR so that it can be kicked back into bootload reception mode.
EXACTLY!!!!! (if avrdude does NOT have this feature, it would be a good one to borrow from Arduino land).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I believe the latest avrdude source has added a file and specific programmer type of "Arduino" and that it's specifically to achieve this very thing.

EDIT: yup, see:

http://svn.savannah.nongnu.org/v...

static int arduino_open(PROGRAMMER * pgm, char * port)
{
  strcpy(pgm->port, port);
  if (serial_open(port, pgm->baudrate? pgm->baudrate: 115200, &pgm->fd)==-1) {
    return -1;
  }

  /* Clear DTR and RTS to unload the RESET capacitor 
   * (for example in Arduino) */
  serial_set_dtr_rts(&pgm->fd, 0);
  usleep(50*1000);
  /* Set DTR and RTS back to high */
  serial_set_dtr_rts(&pgm->fd, 1);
  usleep(50*1000);

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I tried -c arduino instead of avr109 (which is what my bootloader really is) and got this:
C:\Documents and Settings\Kenneth>avrdude -p x128a3 -b 115200 -P com10 -c arduino
avrdude: stk500_getsync(): not in sync: resp=0x3f

avrdude done. Thank you.

What's that mean?

Guess I would need to rebuild avrdude and add a new option to use the lines of code that you provided to pulse the reset line.

Last Edited: Tue. Nov 2, 2010 - 03:04 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As far as I know, only '-c arduino' pulls the DTR line on the RS232. It makes programming an Arduino a doddle.

Most other bootloaders need a hardware or timing condition. This generally involves pressing buttons, holding keys, ...

Avrdude just automates the whole process. So it is extremely convenient to use the Arduino bootloader.

Of course, many people think that 'arduino' is beneath them. They like to buy unnecessary ISP programmers and destroy bootloaders, program inappropriate fuses, suffer grief...

In answer to he original question:
Any form of ISP programmer effectively does a RESET. So if you just want to re-start your AVR board, do a
avrdude -c yourISP -p yourAVR
The simple side-effect of connecting and requesting a signature will reset your board.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
In answer to he original question:
Any form of ISP programmer effectively does a RESET. So if you just want to re-start your AVR board, do a
avrdude -c yourISP -p yourAVR
The simple side-effect of connecting and requesting a signature will reset your board.

I'm NOT using an ISP, it's a serial bootloader. I can connect the DTR line to the cpu reset, but I have to mod avrdude to use it. (such as -r to use DTR reset) It looks like the bootloader jumps back to the app code once the read sig request is finished ("avrdude -b 115200, -c avr109 -p x128a3 -P com10" reads sig, then exits back to app code.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
What's that mean?

If you are using an AVR109 bootloader, it will not necessarily do a /RESET.

And if you do not have a capacitor from DTR to your RESET line, nothing would happen anyway. Except barf about not getting a proper reply.

Most (many) AVR109 bootloaders need you to physically press the RESET button AND hold port pin low. You do this with two fingers, and type your avrdude command at the same time. Simple!

Hint. I put a jumper on the magic port pin and cycle power. When make gets around to invoking avrdude, the AVR is ready and waiting.

Edit. You don't have to modify avrdude. But very few AVR boards have DTR accessible. If your one does, then just add the capacitor. Every time Windoze opens a RS232 port, it will assert the DTR line anyway.

David.

Last Edited: Tue. Nov 2, 2010 - 03:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
Quote:
What's that mean?

If you are using an AVR109 bootloader, it will not necessarily do a /RESET.

And if you do not have a capacitor from DTR to your RESET line, nothing would happen anyway. Except barf about not getting a proper reply.
Most (many) AVR109 bootloaders need you to physically press the RESET button AND hold port pin low. You do this with two fingers, and type your avrdude command at the same time. Simple!
Hint. I put a jumper on the magic port pin and cycle power. When make gets around to invoking avrdude, the AVR is ready and waiting.
David.

I understand this. My application uses the avr109 protocol, but I need the software reset feature as it can't (easily) be done in hardware by the end user. So I will probably need to mod avrdude (add a -r switch) for my needs. Hey, that's the beauty of the GPL right? Now I need to find out what I need to build avrdude on (yuck) windows.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

> I'm NOT using an ISP, it's a serial bootloader.

Then, how on earth would AVRDUDE know that your /RESET line has
been pulled to one of the RS-232 pins?

(Btw. you could have mentioned the programmer type in your initial
posting, this would have avoided others falsely guessing it.)

The -c arduino programmer type won't be of any help to you, as it's
a modified STK500v1 protocol, rather than AVR109.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

Last Edited: Tue. Nov 2, 2010 - 03:23 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you supply the hardware, you add the capacitor. (and tell the punter to use a proper cable)

If you do not supply the hardware, ask the punter to cycle power with a button pressed or something. Look at how you put the STK500 into 'boot' mode.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dl8dtl wrote:
> I'm NOT using an ISP, it's a serial bootloader.
Then, how on earth would AVRDUDE know that your /RESET line has
been pulled to one of the RS-232 pins?
(Btw. you could have mentioned the programmer type in your initial
posting, this would have avoided others falsely guessing it.)
Sorry about the confusion there. I wanted to know if there was an option to add the DTR reset to the avr109 protocol, I guess I'll have to write the code myself and rebuild avrdude. Now I need to figure out what I need to do that task for both the Winavr and Linux versions.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Of course, many people think that 'arduino' is beneath them. They like to buy unnecessary ISP programmers and destroy bootloaders, program inappropriate fuses, suffer grief...

I know that I made a mistake. But I'm a beginner, I think everyone make mistakes at first tries...
And I don't think Arduino beneath me

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

> I wanted to know if there was an option to add the DTR
> reset to the avr109 protocol, I guess I'll have to write
> the code myself and rebuild avrdude.

Given that the -c arduino programmer recently added it, I guess it
might be simple enough to also add it as an option to other
bootloaders. Alas, only bit-bang programmers currently implement
any kind of pin assignment in avrdude.conf, but perhaps its possible
to add this also for plain RS-232-style programmers. In that case,
you don't need a new programmer class, but could generalize the
implementation like "if a /reset pin assignment is specified in the
respective programmer's avrdude.conf entry, use it".

Such a general implementation might be useful to others as well,
so it could be patched back into the official AVRDUDE tree
(unlike a local hack for just your programmer).

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How about adding a switch to specify the reset pin such as "-r PIN" where PIN is an RS232 signal name such as DTR?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wired a 100NF cap (0.1 uf) from the DTR output of the USB/Serial chip to the RST pin on the AVR. The FIRST time that I run the command line for avrdude the act of opening the com port lowers DTR to reset the processor. The second time (and third time, etc) I try it it doesn't work. BUT if I open the com port with a different program (hyperterm), close that program, and try avrdude again from the command line it works. Close!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am trying to make my own drone controller board based on AVR microcontroler. I know I may never succed but just trying is worthwhile for me.

I want to add bootloader which can remotly reset my uC pulling reset pin low with one of RS232 pins. It will give me a posibility to comunicate with board with bluetooth link and send new programs alternately while laying on my sofa far away from rotating elements. Now I am using WinAVR toolchain with AVRDUDE programmer. 

 

My question is:

Which of AVRDUDE-compatible bootloaders supports remote uC resets - which mean - remote bootloader startup WITHOUT touching the board for example - seting jumper on board?