[bug #17487] AVR RC oscillator calibration routine not supported

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

[bug #17487] AVR RC oscillator calibration routine not supported

by Christophe Combelles-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


URL:
  <http://savannah.nongnu.org/bugs/?17487>

                 Summary: AVR RC oscillator calibration routine not supported
                 Project: AVR Downloader/UploaDEr
            Submitted by: None
            Submitted on: Monday 08/21/2006 at 12:05 UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: John Voltz
        Originator Email: ninevoltz@...
             Open/Closed: Open

    _______________________________________________________

Details:

This is a feature request rather than a bug.

AVRDUDE currently does not support RC oscillator calibration as outlined in
the AVR053 appnote.



    _______________________________________________________

Carbon-Copy List:

CC Address                          | Comment
------------------------------------+-----------------------------
Available only the item webpage     | Originator Email



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Monday 08/21/2006 at 12:05 UTC  Name: RC calibration.pdf  Size: 89.69KB
  By: None
AVR053
<http://savannah.nongnu.org/bugs/download.php?file_id=10564>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?17487>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/



_______________________________________________
avrdude-dev mailing list
avrdude-dev@...
http://lists.nongnu.org/mailman/listinfo/avrdude-dev

[bug #17487] AVR RC oscillator calibration routine not supported (feature request)

by Christophe Combelles-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Update of bug #17487 (project avrdude):

                 Summary: AVR RC oscillator calibration routine not supported
=> AVR RC oscillator calibration routine not supported (feature request)


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?17487>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/



_______________________________________________
avrdude-dev mailing list
avrdude-dev@...
http://lists.nongnu.org/mailman/listinfo/avrdude-dev

[bug #17487] AVR RC oscillator calibration routine not supported (feature request)

by Christophe Combelles-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Update of bug #17487 (project avrdude):

                Severity:              3 - Normal => 1 - Wish              


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?17487>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/



_______________________________________________
avrdude-dev mailing list
avrdude-dev@...
http://lists.nongnu.org/mailman/listinfo/avrdude-dev

[bug #17487] AVR RC oscillator calibration routine not supported (feature request)

by Christophe Combelles-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Update of bug #17487 (project avrdude):

                Priority:              5 - Normal => 3 - Low                


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?17487>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/



_______________________________________________
avrdude-dev mailing list
avrdude-dev@...
http://lists.nongnu.org/mailman/listinfo/avrdude-dev

[bug #17487] AVR RC oscillator calibration routine not supported (feature request)

by Christophe Combelles-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Follow-up Comment #1, bug #17487 (project avrdude):

Here is my update patch
    _______________________________________________________

Additional Item Attachment:

File name: avrdudeupdate.tar.gz           Size:34 KB
Patch, doc, and changelog
<http://savannah.nongnu.org/bugs/download.php?file_id=10757>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?17487>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/



_______________________________________________
avrdude-dev mailing list
avrdude-dev@...
http://lists.nongnu.org/mailman/listinfo/avrdude-dev

[bug #17487] AVR RC oscillator calibration routine not supported (feature request)

by Christophe Combelles-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Update of bug #17487 (project avrdude):

                Priority:                 3 - Low => 9 - Immediate          
             Assigned to:                    None => joerg_wunsch          

    _______________________________________________________

Follow-up Comment #2:

I promised to handle that before releasing 5.2.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?17487>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/



_______________________________________________
avrdude-dev mailing list
avrdude-dev@...
http://lists.nongnu.org/mailman/listinfo/avrdude-dev

Re: [bug #17487] AVR RC oscillator calibration routine not supported (feature request)

by Joerg Wunsch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi John, (Cc to the list, mainly to discuss the ideas below)

> Follow-up Comment #1, bug #17487 (project avrdude):
>
> Here is my update patch

Just browsing through it.  First of all, thanks so much for your
effort!  When I first read appnote AVR053, I simply didn't get the
idea what their intention was, now I've got the picture.

There are a few things I don't like about the patch, like arbitrary
changes to the code which are unrelated to the oscillator calibration
issue.  That doesn't mean there would be no reason to perhaps change a
few things -- but please, don't mix that with other changes, and often
it would be better to first discuss it in the mailing list.  For
example, the -r option you added is not really needed: just running
avrdude with -v (and no other arguments) also gives you that
information.

However, I've got a few question where I'm simply not sure about your
changes.  In avr.c, you added

   wsize = m->size;
+  
+  if (size == 0) {
+   size = m->size;
+  }
+  
   if (size < wsize) {
     wsize = size;
   }

Is there any reason for this?  I'm not sure whether this is really
related to the oscillator calibration or not.

Just as a side note, the master text for the texinfo documentation is
avrdude.texi -- avrdude.info is a compiled version.  But I'll be able
to merge your documentation changes, no worries.  I'll also add a note
that the calibration routine will clobber EEPROM cell 0.

I wonder whether the "c" update specification is a good idea.  I see
your point, and I guess it's in some way compatible with what
stk500.exe and jtagicemkii.exe are doing.  OTOH, one could think of
similar situations that would require yet another option then, like
pulling the oscillator calibration fuse value, and storing it in an
arbitrary location.  The traditional Unix approach for that would be
to rather read out EEPROM cell 0 in a first call (e. g. using one of
the new "h", "o" or "d" memory "formats", so you get the value as 0x42
or such), store it (somehow) in the caller, and re-run avrdude to put
that value into an arbitrary EEPROM or flash location.  Say, if the
caller is a shell script, you just store the value in a variable:

var=$(avrdude ...)

The only thing currently missing for that job is to allow specifying a
start address for the memory write commands, so in particular when
using the "m" format, you can tell it where to write the data to.  I
think adding such a feature has been considered a good idea some time
ago already.  An idea for the syntax would be

-U eeprom:w:${var}@0x1f0:m

(${var} is filled in by the calling shell script.)

For the read operation, a limitation about how many bytes to read will
be useful, too, so the above could be like

var=$(avrdude -p m8 -U ee:r:-@0/1:h)

to just read a single byte from EEPROM at address 0.

Of course, the ideal partner to handle this would be avrdude-gui, but
that requires some active developers first.

While the above changes seem to be more intrusive at first, I think
they are more generally useful beyond the scope of the oscillator
calibration then.

Further remarks while continuing to read your patch:

The -O option should check for the perform_osscal function pointer to
be non-NULL before calling it, and issue a respective message
otherwise.

     if (rc) {
-      exitrc = 1;
+      exitrc = -1;
       break;

Command exit codes are usually non-negative integers (and often
limited to 0..255 in Unix environments).  Only 0 is considered
success, anything else is an error state.  So there's no need to make
that -1.

As for stk500v2_check_response_status() which you've added, that's one
of those unrelated changes: perhaps it's not a bad idea, but it
doesn't belong into the patch for the oscillator calibration.  Also,
when moving to a central check, the already existing decentral checks
for the response status can be removed.  The other option would be to
fill in the missing checks instead -- most callers already check for
STATUS_CMD_OK but not all do.  It's probably even sufficient to add
the check to stk500v2_command().

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

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



_______________________________________________
avrdude-dev mailing list
avrdude-dev@...
http://lists.nongnu.org/mailman/listinfo/avrdude-dev

[bug #17487] AVR RC oscillator calibration routine not supported (feature request)

by Christophe Combelles-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Update of bug #17487 (project avrdude):

                Priority:           9 - Immediate => 5 - Normal            
                  Status:                    None => In Progress            

    _______________________________________________________

Follow-up Comment #3:

The part of the patch implementing the -O option has been
committed.

I still feel we should seek for a more general method to
transfer the result to an arbitrary location.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?17487>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/



_______________________________________________
avrdude-dev mailing list
avrdude-dev@...
http://lists.nongnu.org/mailman/listinfo/avrdude-dev

[bug #17487] AVR RC oscillator calibration routine not supported (feature request)

by Christophe Combelles-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Additional Item Attachment, bug #17487 (project avrdude):

File name: arbitrary_rw.patch             Size:12 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?17487>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/



_______________________________________________
avrdude-dev mailing list
avrdude-dev@...
http://lists.nongnu.org/mailman/listinfo/avrdude-dev

[bug #17487] AVR RC oscillator calibration routine not supported (feature request)

by Christophe Combelles-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Follow-up Comment #4, bug #17487 (project avrdude):

I just submitted a patch to allow avrdude to read and write at arbitrary
memory locations. You simply specify a block length (in bytes) followed by
the byte offset in the hex file then finally the byte offset in flash or
eeprom.

Here's a command line example:

avrdude -cstk500v2 -B4 -pm16 -P/dev/ttyS0 -v -e -Uflash:w:main.hex:i,10,0,6


this will write 10 bytes from byte offset 0 in main.hex to byte offset 6 in
flash

values can be in decimal or hex, and all are optional (will default to zero).
Values must be multiples of two since the AVR memory is arranged in 16-bit
words.


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?17487>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/



_______________________________________________
avrdude-dev mailing list
avrdude-dev@...
http://lists.nongnu.org/mailman/listinfo/avrdude-dev

[bug #17487] AVR RC oscillator calibration routine not supported (feature request)

by Christophe Combelles-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Follow-up Comment #5, bug #17487 (project avrdude):

I forgot to mention how my last patch is useful. It can be used for RC
oscillator calibration by first reading the AVRs EEPROM to a temporary file,
then you can write it back to the AVR in an arbitrary location in the flash
or EEPROM.

It can also be used to store configuration constants in flash, which is my
latest interest since I have been having a lot of trouble lately with EEPROM
corruption, and yes, I am using the brown-out detector in my application!
:oP


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?17487>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/



_______________________________________________
avrdude-dev mailing list
avrdude-dev@...
http://lists.nongnu.org/mailman/listinfo/avrdude-dev

[bug #17487] AVR RC oscillator calibration routine not supported (feature request)

by Christophe Combelles-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Follow-up Comment #6, bug #17487 (project avrdude):

Not long after submitting my patch I discovered a nasty mistake in my code.
Here's patch #3

(file #12868)
    _______________________________________________________

Additional Item Attachment:

File name: mistake.patch                  Size:2 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?17487>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/



_______________________________________________
avrdude-dev mailing list
avrdude-dev@...
http://lists.nongnu.org/mailman/listinfo/avrdude-dev

[bug #17487] AVR RC oscillator calibration routine not supported (feature request)

by Christophe Combelles-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Additional Item Attachment, bug #17487 (project avrdude):

File name: fixed_arbitrary_rw.patch       Size:12 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?17487>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/



_______________________________________________
avrdude-dev mailing list
avrdude-dev@...
http://lists.nongnu.org/mailman/listinfo/avrdude-dev

[bug #17487] AVR RC oscillator calibration routine not supported (feature request)

by Christophe Combelles-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Follow-up Comment #7, bug #17487 (project avrdude):

Hi,
the documentation states JTAG ICE mkII is supported for calibration, but it
is not.
According to the AVR067, the programmer has to issue a  CMND_ISP_PACKET
containing the ISP CMD_OSCCAL.
A quick fix is to change the manual page. A nice thing would be to add the
support.
Regards,
Charles

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?17487>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/



_______________________________________________
avrdude-dev mailing list
avrdude-dev@...
http://lists.nongnu.org/mailman/listinfo/avrdude-dev