avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] AVRDude serial access problem under WinXP


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] AVRDude serial access problem under WinXP
Date: Sat, 24 Mar 2007 08:28:48 +0100 (MET)

"Vrudny, Noah O" <address@hidden> wrote:

> And Bob, your right. It would be much better if the ser_open()
> exception would resolve to something like 'try -c stk500v2' instead
> of just 'access denied'.

Sorry, ser_open() just displays what it gets from the underlying
operating system.  If the operating system tells "access denied", how
the **** should avrdude know that this was just a joke only?

Here's how this is working on my FreeBSD system:

% avrdude -p m16 -c stk500 -P /dev/cuad1 -t
avrdude: stk500_recv(): programmer is not responding
avrdude: successfully opened stk500v2 device -- please use -c stk500v2

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9403
avrdude> quit
>>> quit

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

You can see in the first line that it initially tries to talk to the
STK500 using protocol version 1, and eventually times out on that.
(Alas, both protocols are so fundamentally different, the only way to
find out is to try, and eventually run into a timeout.)  Then it
succeeds opening the device using protocol version 2, and does as you
both suggested: it tells you to rather use -c stk500v2 in future (as
this will speed up the startup).

If that doesn't work under Windows, sorry, that's somehow Windows'
fault, so a Windows user has to debug it.  The serial_open() routines
used in both protocol implementations are the same:

STK500 v1:

static int stk500_open(PROGRAMMER * pgm, char * port)
{
  strcpy(pgm->port, port);
  serial_open(port, pgm->baudrate? pgm->baudrate: 115200, &pgm->fd);

  /*
   * drain any extraneous input
   */
  stk500_drain(pgm, 0);

  if (stk500_getsync(pgm) < 0)
    return -1;

  return 0;
}

STK500 v2:

static int stk500v2_open(PROGRAMMER * pgm, char * port)
{
  long baud = 115200;

  DEBUG("STK500V2: stk500v2_open()\n");

  if (pgm->baudrate)
    baud = pgm->baudrate;

  pgmtype = PGMTYPE_UNKNOWN;

  /* some stuff about using USB rather than RS-232 deleted */

  strcpy(pgm->port, port);
  serial_open(port, baud, &pgm->fd);

  /*
   * drain any extraneous input
   */
  stk500v2_drain(pgm, 0);

  stk500v2_getsync(pgm);

  stk500v2_drain(pgm, 0);

  if (pgm->bitclock != 0.0) {
    if (pgm->set_sck_period(pgm, pgm->bitclock) != 0)
      return -1;
  }

  return 0;
}

so isn't it kinda funny that in one of these cases, the OS tells you
"Access denied"?  ser_open()'s implementation itself is not going to
talk anything across the port, it is really only about opening the
port, and setting the parameters (speed, buffer size, timeout etc.).

If you provide an *exact* error message, perhaps I can get a better
idea.  As it is now, I can only regret and tell you to go and ask your
OS vendor about it...

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

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]