Help ATmega328PB upload hex file:

Hello everyone, I have this construction plan and I have assembled a circuit board with it. I used a usbasp and would like to drag a hex file onto the microcontroller. Enclosed are plans and pictures and the error messages that the atmel 328pb is somehow not recognised correctly.

Here is the code to upload:
avrdude -V -c usbasp -p m328pb -P usb -U flash:w:XXX...XXX.hex:i

The error:
Error: program enable: target does not answer (0x01)
Error: initialization failed (rc = -1)

  • double check the connections and try again
  • use -B to set lower the bit clock frequency, e.g. -B 125kHz
  • use -F to override this check

Avrdude done. Thank you.

What OS are you using?
-P usb does not look right to me?

On Windows I would expect COMx.
On Linux it would be something like /dev/ttyUSBx or /dev/ttyACMx
On a Mac it might be /dev/cu.something

Usually avrdude will use the default port for the programmer anyway, chances are you can just drop the -P anyway.

i work on mac, and connect via a usb-c hub

i also tryed: /Users/XX/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude -C/Users/XXX/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf -v -p m8 -c usbasp -P usb -U flash:w:/UsersXXXl/Desktop/usbasp.atmega8.2011-05-28.hex:i

to update the usbasp and it worked. But if i doit on the other: /Users/XXXLibrary/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude -C/Users/XXX/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf -v -p m328pb -c usbasp -P usb -U flash:w:/Users/XXX/Desktop/Beerdrinker.hex:i

i get this error:
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "/Users/XXX/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
     User configuration file is "/Users/XXX/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : usb
     Using Programmer              : usbasp
     AVR Part                      : ATmega328PB
     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 : usbasp
     Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: error: program enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude done. Thank you.

i also tryed this but it also did not worked:
avrdude -F -V -c usbasp -p m328pb -P usb -b 115200 -U flash:w:/Users/XXX/Desktop/Beerdrinker.hex
Error: program enable: target does not answer (0x01)
Error: initialization failed (rc = -1)

  • double check the connections and try again
  • use -B to set lower the bit clock frequency, e.g. -B 125kHz
    Device signature = 00 00 00 (retrying)
    Device signature = 00 00 00 (retrying)
    Device signature = 00 00 00
    Error: invalid device signature
    Warning: expected signature for ATmega328PB is 1E 95 16
    Reading 1720 bytes for flash from input file Beerdrinker.hex
    Writing 1720 bytes to flash
    Writing | ################################################## | 100% 0.85 s
    1720 bytes of flash written
    Avrdude done. Thank you.

No base resistors for your transistors may cause the applied programming signals to be clamped to a Vbe; too low for programming the chip….

Indeed. And no series (current limiting) resistors either for the segments of the 4 x 7 seg display LED90.

It is often easier to use a Max7219 or Max7221 display driver instead of using shift registers, transistors, resistors and your own multiplexing code.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.