m48pa not found


6 posts
by gstreeter » Wed Nov 27, 2013 10:53 am
I've succeeded in uploading the blink example via the modified avrdude and also the standard "blink" sketch example via the Arudino IDE to the ATmega328 on the Gerduino. However when I switched the jumpers to the ATMega48 and tried to load the low_power example via avrdude through the program_48 script it fails as avrdude does not recognise the m48pa device:

avrdude: AVR Part "m48pa" not found.

The list of known parts has only one reference to an "m48"

Have I missed something in the setup of the tools?
Posts: 97
Joined: Sun Sep 02, 2012 11:11 am
Location: UK
by AndyD » Thu Nov 28, 2013 2:31 am
gstreeter wrote:... Have I missed something in the setup of the tools?

No, there is something missing in the setup. As you say the program_48 script has the following

Code: Select all
/usr/bin/avrdude -c gpio -p m48pa ...

Which specifies a programer-id of gpio and a part number of m48pa. The gpio programmer id has been added in to the patched version of avrdude provided by Gordon Henderson, but /etc/avrdude.conf has not been patched for the part m48pa. I have looked at all the available changes, as I am in the process of applying Gordon's patches to avrdude 5.11.1 (as this is the current version in the Raspbian archives). Some searches with Google found a number of things, but not enough for me to work out the specifics to add to avrdude.conf. I found this on the Avrdude dev forum. I also attempted to find out the difference between the Atmega48 and the Atmega48pa and I found this.

I am not sure if Gordon is reading these posts. Perhaps Gert can contact him. It would be good if all the discussions of hardware and software for the Gertboard could stay on this forum.

Edit: I sent an email to Gordon.

The zip file that Gert put up on the Element14 website has

Code: Select all
/usr/bin/avrdude -c gpio -p m48pa ...

while the use manual suggests

Code: Select all
/usr/bin/avrdude -c gpio -p m48p ...

Either way neither of these is defined in the avrdude setup file (both original and Gordon's patched version).

Edit: Now, I sent an email to Gordon. Seems I can't tell the difference between drogon and dragon.
Posts: 648
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
by gstreeter » Thu Nov 28, 2013 7:32 am
Andy - I too found similar details and was subsequently able to upload using the program_48 script by duplicating the m48 entry in the avrdude.conf file to create a new entry for m48pa with the correct signature value (0x1e 0x92 0x0a). This appears to be the only change required.

The latest avrdude allows for a "parent" clause that makes this a lot easier as the definition for m48pa can inherit all of the m48 attributes and just specify the deltas.

part parent "m48"
id = "m48pa";
desc = "ATMega48pa";
signature = 0x1e 0x92 0x0a;
;
Posts: 97
Joined: Sun Sep 02, 2012 11:11 am
Location: UK
by AndyD » Thu Nov 28, 2013 12:08 pm
Thanks gstreeter,
the 'part parent' appears to be new in avrdude 6. I think for older versions of avrdude you will need to copy the whole ATmega48 section in avrdude.conf and create a new section and change the id, desc, and signature as you have shown. It appears that m48p is specified in avrdude.conf for avrdude 6.0.1.
Posts: 648
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
by Gert van Loo » Thu Nov 28, 2013 12:10 pm
I am not THAT familiar with avrdude so other might not be either.
Anybody wants to post the new 48 text and where to add it?
User avatar
Moderator
Moderator
Posts: 1843
Joined: Tue Aug 02, 2011 7:27 am
by AndyD » Thu Nov 28, 2013 12:43 pm
Gordon is going to release a whole bunch of examples etc soon. So it might be better to wait for Gordon's update.

However for the impatient. If you are using Gordon's patched version of avrdude you will need to add the following to /etc/avrdude.conf
I am pretty sure you can just add it to the end of the file. You should then be able to program the Atmega48 chip on the Gertuino using the program_48 script

Code: Select all
#------------------------------------------------------------
# ATmega48pa
#------------------------------------------------------------

part
    id               = "m48pa";
    desc             = "ATMEGA48PA";
     has_debugwire = yes;
     flash_instr   = 0xB6, 0x01, 0x11;
     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
                     0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
                     0x99, 0xF9, 0xBB, 0xAF;
    stk500_devcode   = 0x59;
    signature        = 0x1e 0x92 0x0a;
    pagel            = 0xd7;
    bs2              = 0xc2;
    chip_erase_delay = 45000;
    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                       "x x x x  x x x x    x x x x  x x x x";

    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
                       "x x x x  x x x x    x x x x  x x x x";

    timeout             = 200;
    stabdelay           = 100;
    cmdexedelay         = 25;
    synchloops          = 32;
    bytedelay           = 0;
    pollindex           = 3;
    pollvalue           = 0x53;
    predelay            = 1;
    postdelay           = 1;
    pollmethod          = 1;

    pp_controlstack     =
        0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
        0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
        0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
        0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
    hventerstabdelay    = 100;
    progmodedelay       = 0;
    latchcycles         = 5;
    togglevtg           = 1;
    poweroffdelay       = 15;
    resetdelayms        = 1;
    resetdelayus        = 0;
    hvleavestabdelay    = 15;
    resetdelay          = 15;
    chiperasepulsewidth = 0;
    chiperasepolltimeout = 10;
    programfusepulsewidth = 0;
    programfusepolltimeout = 5;
    programlockpulsewidth = 0;
    programlockpolltimeout = 5;

    memory "eeprom"
        paged           = no;
        page_size       = 4;
        size            = 256;
        min_write_delay = 3600;
        max_write_delay = 3600;
        readback_p1     = 0xff;
        readback_p2     = 0xff;
        read            = "  1   0   1   0      0   0   0   0",
                          "  0   0   0   x      x   x   x   x",
                          " a7  a6  a5  a4     a3  a2  a1  a0",
                          "  o   o   o   o      o   o   o   o";

        write           = "  1   1   0   0      0   0   0   0",
                          "  0   0   0   x      x   x   x   x",
                          " a7  a6  a5  a4     a3  a2  a1  a0",
                          "  i   i   i   i      i   i   i   i";

        loadpage_lo     = "  1   1   0   0      0   0   0   1",
                          "  0   0   0   0      0   0   0   0",
                          "  0   0   0   0      0   0  a1  a0",
                          "  i   i   i   i      i   i   i   i";

        writepage       = "  1   1   0   0      0   0   1   0",
                          "  0   0   x   x      x   x   x   x",
                          " a7  a6  a5  a4     a3  a2   0   0",
                          "  x   x   x   x      x   x   x   x";

        mode            = 0x41;
        delay           = 20;
        blocksize       = 4;
        readsize        = 256;
      ;
    memory "flash"
        paged           = yes;
        size            = 4096;
        page_size       = 64;
        num_pages       = 64;
        min_write_delay = 4500;
        max_write_delay = 4500;
        readback_p1     = 0x00;
        readback_p2     = 0x00;
        read_lo         = "  0   0   1   0    0   0   0   0",
                          "  0   0   0   0    0 a10  a9  a8",
                          " a7  a6  a5  a4   a3  a2  a1  a0",
                          "  o   o   o   o    o   o   o   o";

        read_hi         = "  0   0   1   0    1   0   0   0",
                          "  0   0   0   0    0 a10  a9  a8",
                          " a7  a6  a5  a4   a3  a2  a1  a0",
                          "  o   o   o   o    o   o   o   o";

        loadpage_lo     = "  0   1   0   0      0   0   0   0",
                          "  0   0   0   x      x   x   x   x",
                          "  x   x   x  a4     a3  a2  a1  a0",
                          "  i   i   i   i      i   i   i   i";

        loadpage_hi     = "  0   1   0   0      1   0   0   0",
                          "  0   0   0   x      x   x   x   x",
                          "  x   x   x  a4     a3  a2  a1  a0",
                          "  i   i   i   i      i   i   i   i";

        writepage       = "  0   1   0   0      1   1   0   0",
                          "  0   0   0   0      0 a10  a9  a8",
                          " a7  a6  a5   x      x   x   x   x",
                          "  x   x   x   x      x   x   x   x";

        mode            = 0x41;
        delay           = 6;
        blocksize       = 64;
        readsize        = 256;
      ;

    memory "lfuse"
        size            = 1;
        min_write_delay = 4500;
        max_write_delay = 4500;
        read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
                          "x x x x  x x x x   o o o o  o o o o";

        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
                          "x x x x  x x x x   i i i i  i i i i";
      ;

    memory "hfuse"
        size            = 1;
        min_write_delay = 4500;
        max_write_delay = 4500;
        read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
                          "x x x x  x x x x   o o o o  o o o o";

        write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
                          "x x x x  x x x x   i i i i  i i i i";
      ;

    memory "efuse"
        size            = 1;
        min_write_delay = 4500;
        max_write_delay = 4500;
        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
                          "x x x x  x x x x   x x x x  x x x o";

        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
                          "x x x x  x x x x   x x x x  x x x i";
      ;

    memory "lock"
        size            = 1;
        min_write_delay = 4500;
        max_write_delay = 4500;
        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
                          "x x x x  x x x x   x x o o  o o o o";

        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
                          "x x x x  x x x x   1 1 i i  i i i i";
      ;

    memory "calibration"
        size            = 1;
        read            = "0  0  1  1   1  0  0  0   0  0  0  x   x  x  x  x",
                          "0  0  0  0   0  0  0  0   o  o  o  o   o  o  o  o";
      ;

    memory "signature"
        size            = 3;
        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
      ;
  ;
Posts: 648
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia