Skip to main content
Topic: Flashing Atmel Xplained 168 (Read 4051 times) previous topic - next topic

Flashing Atmel Xplained 168

Hi,

I got one of these Atmel Xplained boards with an Atmega168.

However, avrdude with connected piratebus tells me:

Code: [Select]
    avrdude: Device signature = 0x1e9415
    avrdude: Expected signature for ATmega168 is 1E 94 06

I can't find any possible chip with the signature above. I tried m168, m168p.
Anyone has seen this signature above for an Atmel device?

Continuing. Flashing the bootloader with -F works and gives:

Code: [Select]
$ avrdude -F -c buspirate -p m168 -v -P /dev/cu.usbserial-A603PKYJ -U flash:w:ATmegaBOOT_168_atmega1280.hex

avrdude: Version 6.1, compiled on Mar 23 2014 at 04:42:55
        Copyright (c) 2000-2005 Brian Dean,
        Copyright (c) 2007-2014 Joerg Wunsch

        System wide configuration file is "/usr/local/Cellar/avrdude/6.1/etc/avrdude.conf"
        User configuration file is "/Users/pmu/.avrduderc"
        User configuration file does not exist or is not a regular file, skipping

        Using Port                    : /dev/cu.usbserial-A603PKYJ
        Using Programmer              : buspirate
        AVR Part                      : ATmega168
        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        512    4      0  3600  3600 0xff 0xff
          flash        65    6  128    0 yes    16384  128    128  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 not found.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.08s

avrdude: Device signature = 0x1e9415
avrdude: Expected signature for ATmega168 is 1E 94 06
avrdude: safemode: lfuse reads as E0
avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as 7
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
        To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "ATmegaBOOT_168_atmega1280.hex"
avrdude: input file ATmegaBOOT_168_atmega1280.hex auto detected as Intel Hex
avrdude: ERROR: address 0x1f010 out of range at line 2 of ATmegaBOOT_168_atmega1280.hex
avrdude: read from file 'ATmegaBOOT_168_atmega1280.hex' failed

avrdude: safemode: lfuse reads as E0
avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as 7
avrdude: safemode: Fuses OK (E:07, H:DF, L:E0)
BusPirate is back in the text mode

avrdude done.  Thank you.

However, connecting the Arduino IDE then only allows to flash the device once. For the second time, it gives progammer not responding.

Thanks for sharing ideas for flashing a bootloader!

Re: Flashing Atmel Xplained 168

Reply #1
Hi;
  you are using the wrong bootloader.
"avrdude: ERROR: address 0x1f010 out of range at line 2 of ATmegaBOOT_168_atmega1280.hex"
This hex file is for an ATMega1280, not ATMega168.

There is a 168 file:
arduino/hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega168.hex

That should work, note my path is for linux and Arduino 1.5.7.

Mick M

Re: Flashing Atmel Xplained 168

Reply #2
I see. I tried various flash images, but non seem really to work.

I saw the 168 and 168pb have some differences: see PDF Atmel-42374-Differences-between-ATmega48_88_168-variants-and-the-new%20ATmega48_88_168PB_APNote_AT06609

Also, it might be necessary to update the avrconf device information with -> avrdude -> user-manual/avrdude_13.html#Part-Definitions

Yet, I am doing this the first time. If you have more pointers or loud thinking to share, that would be very helpful. Thanks!

Re: Flashing Atmel Xplained 168

Reply #3
Another observation. With the Diecimila bootloader, I can flash the device successfully once:

Code: [Select]
Sketch uses 1,116 bytes (7%) of program storage space. Maximum is 14,336 bytes.
Global variables use 11 bytes (1%) of dynamic memory, leaving 1,013 bytes for local variables. Maximum is 1,024 bytes.
avrdude - tools/avr/etc/avrdude.conf -v -v -v -v -patmega168 -carduino -P/dev/cu.usbmodem14242 -b19200 -D -Uflash:w:/var/folders/48/b2ggr32n1gsc0lwlpftw3vt00000gn/T/build7440555895062317979.tmp/blink_2_3rd.cpp.hex:i

avrdude: Version 5.11, compiled on Sep  2 2011 at 18:52:52
        Copyright (c) 2000-2005 Brian Dean,
        Copyright (c) 2007-2009 Joerg Wunsch

        User configuration file does not exist or is not a regular file, skipping

        Using Port                    : /dev/cu.usbmodem14242
        Using Programmer              : arduino
        Overriding Baud Rate          : 19200
avrdude: Send: 0 [30]  [20]
avrdude: Send: 0 [30]  [20]
avrdude: Send: 0 [30]  [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
        AVR Part           


But the second time I get:

Code: [Select]

        User configuration file does not exist or is not a regular file, skipping

        Using Port                    : /dev/cu.usbmodem14242
        Using Programmer              : arduino
        Overriding Baud Rate          : 19200
avrdude: Send: 0 [30]  [20]
avrdude: Send: 0 [30]  [20]
avrdude: Send: 0 [30]  [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding

avrdude done.  Thank you.