Troubleshooting Avrdude Dan Bus Pirate

From Indonesian Research And Development Center
Jump to: navigation, search

Pendahuluan

Tutorial singkat ini akan membahas solusi error yang terjadi jika menggunakan avrdude pada bus pirate sebagai programmer. Pada tutorial ini avrdude yang digunakan adalah versi 6.1 dan bus pirate v4 dengan firmware v6.1 r1676.


Permasalahan

Berikut ini adalah pesan error yang muncul ketika menggunakan avrdude dan bus pirate untuk melakukan pemeriksaan development board AVR:

% avrdude -v -c buspirate -p atmega328p -P /dev/ttyACM0

avrdude: Version 6.1, compiled on Jun 14 2014 at 07:40:00
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/etc/avrdude/avrdude.conf"
         User configuration file is "/home/rndc/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : buspirate
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         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    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : BusPirate
         Description     : The Bus Pirate

Attempting to initiate BusPirate binary mode...
BusPirate binmode version: 1
BusPirate SPI version: 1
avrdude: Paged flash write enabled.
AVR Extended Commands version 0
avrdude: initialization failed, rc=-2
         Double check connections and try again, or use -F to override
         this check.

avrdude: warning: did not get a response to PowerDown command.
BusPirate reset failed. You may need to powercycle it.

Bisa terlihat bahwa avrdude gagal melakukan inisialisasi dan menyarankan untuk menggunakan opsi -F. Selanjutnya, kita akan menggunakan opsi -F seperti yang disarankan oleh avrdude, namun pesan error kembali muncul seperti ini:

% avrdude -v -c buspirate -p atmega328p -P /dev/ttyACM0 -F

avrdude: Version 6.1, compiled on Jun 14 2014 at 07:40:00
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/etc/avrdude/avrdude.conf"
         User configuration file is "/home/rndc/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : buspirate
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         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    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : BusPirate
         Description     : The Bus Pirate

Attempting to initiate BusPirate binary mode...
BusPirate binmode version: 1
BusPirate SPI version: 1
avrdude: Paged flash write enabled.
AVR Extended Commands version 0
avrdude: initialization failed, rc=-2
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0xc877db
avrdude: Expected signature for ATmega328P is 1E 95 0F
BusPirate reset failed. You may need to powercycle it.


Solusi

Hal tersebut terjadi karena avrdude berusaha menggunakan mode binary pada bus pirate dan solusi untuk permasalahan tersebut adalah dengan menambahkan beberapa opsi khusus untuk bus pirate berikut ini:

-x ascii -x nopagedread -x nopagedwrite

Berikut ini adalah output dari avrdude setelah menambahkan opsi tersebut:

% avrdude -c buspirate -x ascii -x nopagedread -x nopagedwrite -p atmega328p -P /dev/ttyACM0

Attempting to initiate BusPirate ASCII mode...
**  Bus Pirate v4
**  Firmware v6.1 r1676
**  DEVID:0x1019 REVID:0x0004 (24FJ256GB106 UNK)
**  http://dangerousprototypes.com
**
BusPirate: using ASCII mode
avrdude: warning: did not get a response to PowerUp command.
avrdude: warning: Trying to continue anyway...
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f

avrdude: safemode: Fuses OK (E:05, H:DA, L:FF)
avrdude: warning: did not get a response to PowerDown command.

avrdude done.  Thank you.

Bisa terlihat bahwa setelah menambahkan opsi tersebut, avrdude dapat mengenali target development board. Sekian tutorial singkat kali ini, semoga bermanfaat.


Referensi