Cannot re-program ATMEGA328P with internal 8MHz setting

Hello everyone. I have some trouble for ATMEGA328P with internal 8MHz setting, could I get your advice ?

I tried to program ATMEGA328P without bootloader on following setting. One time I have no problem to write but after that cannot re-program with following error message.

Is there any way to improve it ?

  • setting Arduino IDE ver 1.8.5 Writer AVRISP MK2 Vcc external 5V is supplied to pin7 & 21 GND connected to pin8 & 22

  • error message Arduino:1.8.5 (Windows 7), board:"ATmega328 on a breadboard (8 MHz internal clock)"

Warning: Board breadboard:avr:atmega328bb doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA328BB avrdude: stk500v2_command(): command failed avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Unknown status 0x00 avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check.

I am looking forward to your advice.

Sorry not Vcc is connected to external 5V is supplied to pin7 & 20

I've never heard of an ATMega328BB, did you write your own board definition for it?

atmega328bb is just the board ID in boards.txt of the "ATmega328P on a breadboard" hardware package Arduino provides in the "Minimal Circuit (Eliminating the External Clock)" section of this tutorial: https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard

It's not an MCU model number. The "bb" part just stands for "breadboard".

Warnings are from hardware package meant for older version of the IDE. Use https://github.com/MCUdude/MiniCore - supports all the 328p-like AVRs and every conceivable clock configuration via submenus. Very well maintained.

Error.... Do you have an AVRisp mkIi connected to the processor you are trying to program? Are you sure its connected correctly?