chipKIT® Development Platform

Inspired by Arduino™

Using avrdude directly from command line

Created Thu, 30 Jun 2011 15:29:52 +0000 by Hazard


Hazard

Thu, 30 Jun 2011 15:29:52 +0000

Hello!

I was thinking on using the bootloader that comes with chipkit Max32, and copy the .hex file compiled from MPLAB with avrdude.

Im using Windows 7 32 bit. When I try and talk with the chipKit, it works fine and avrdude finds the PIC:

avrdude.exe -C ../etc/avrdude.conf -c stk500v2 -p pic32 -P COM12 -b 115200 -v

When I try to copy the .hex file, avrdude crashes just after initializing the transfer. command:

avrdude.exe -C ../etc/avrdude.conf -c stk500v2 -P COM12 -p pic32 -b 115200 -U flash:w:test.hex:i -v

Full output from avrdude until crash:

D:\Projects\chipKit32\mpide-0022-chipkit-win-20110619\hardware\tools\avr\bin>avr
dude.exe -C ../etc/avrdude.conf -c stk500v2 -P COM12 -p pic32 -b 115200 -D -U fl
ash:w:test_45.hex:i -v

avrdude.exe: Version 5.10, compiled on Jan 19 2010 at 10:45:23
             Copyright (c) 2000-2005 Brian Dean, 
             Copyright (c) 2007-2009 Joerg Wunsch

             System wide configuration file is "../etc/avrdude.conf"

             Using Port                    : COM12
             Using Programmer              : stk500v2
             Overriding Baud Rate          : 115200
             AVR Part                      : 32MX795F512L
             Chip Erase delay              : 9000 us
             PAGEL                         : PD7
             BS2                           : PA0
             RESET disposition             : dedicated
             RETRY pulse                   : SCK
             serial program mode           : yes
             parallel program mode         : yes
             Timeout                       : 200
             StabDelay                     : 100
             CmdexeDelay                   : 25
             SyncLoops                     : 32
             ByteDelay                     : 0
             PollIndex                     : 3
             PollValue                     : 0x53
             Memory Detail                 :

                                      Block Poll               Page
          Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW
 MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ -----
 ----- ---------
               eeprom        65    10     4    0 no       2048    8      0  9000
  9000 0xff 0xff
               flash         65    10   128    0 yes    524288  256   2048  4500
  4500 0xff 0xff
               lock           0     0     0    0 no          1    0      0  9000
  9000 0x00 0x00
               lfuse          0     0     0    0 no          1    0      0  9000
  9000 0x00 0x00
               hfuse          0     0     0    0 no          1    0      0  9000
  9000 0x00 0x00
               efuse          0     0     0    0 no          1    0      0  9000
  9000 0x00 0x00
               signature      0     0     0    0 no          3    0      0     0
     0 0x00 0x00
               calibration    0     0     0    0 no          1    0      0     0
     0 0x00 0x00

             Programmer Type : STK500V2
             Description     : Atmel STK500 Version 2.x firmware
             Programmer Model: AVRISP
             Hardware Version: 15
             Firmware Version Master : 2.10
             Vtarget         : 0.0 V
             SCK period      : 22.8 us

avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.06s

avrdude.exe: Device signature = 0x504943
avrdude.exe: safemode: lfuse reads as 0
avrdude.exe: safemode: hfuse reads as 0
avrdude.exe: safemode: efuse reads as 0
avrdude.exe: current erase-rewrite cycle count is -1145324613 (if being tracked)

avrdude.exe: reading input file "test_45.hex"

[Crash happens here]

I can use MPIDE and upload sketches just fine. What could I be doing wrong?


jumpin_jack

Fri, 01 Jul 2011 18:19:47 +0000

Does the hex file have code in the boot flash or configuration word area? Maybe you're trying to overwrite the bootloader?


Hazard

Tue, 05 Jul 2011 12:10:08 +0000

I guess you were right.

By disabling the linkin of start up library in MPLab we can upload the code using avrdude.