UNO as ISP to download sketches ( Solved #4 )

I have developed a code for a simple RFID reader and it runs on a Feather 328P Basic proto - for those new to the Feather from Adafruit the link is here : Adafruit Feather 328P - Atmega328P 3.3V @ 8 MHz : ID 3458 : $12.50 : Adafruit Industries, Unique & fun DIY electronics and kits

A cute little module that comes with its own LiPo charger and does all what a UNO can do.

I have a simple requirement : To erase the boot loader and directly make the MCU start my code as the 2 sec boot loader delay annoys the user when powering the unit to read a RFID tag. As soon as they press the power button, nothing seems to happen and then try to press again releasing it ... a real mess.

I know i can use another UNO as an ISP and using the SPI interface download the boot loader code. I regularly do this based on the excellent resource from here https://www.gammon.com.au/bootloader

Now my question is how to prepare my sketch for this process and load it to the target MCU ? What about the fuses that need to be set ?

Thanks

Nothing special with the sketch. It is same. Once the sketch is uploaded via ISP the bootloader is removed. The only thing you have to change is fuse to boot from adress 0 instead of bootloader region.

If the sketch is already uploaded you have to just change high fuse from 0xDE to 0xD9 (ATmega328P) which tells that the boot region has size 0 and default reset vector.

It is possible to just do a Sketch > Upload Using Programmer to compile and upload your sketch to the board, overwriting the bootloader. That should work fine, even though the fuses will be configured for a bootloader.

If you want to set the fuses correctly, the easiest way is to use MiniCore:

  • Install MiniCore following the instructions at the above link.
  • Tools > Board > ATmega328
  • Tools > Bootloader > No
  • Tools > Variant > 328P / 328PA
  • Tools > Burn Bootloader
  • Sketch > Upload Using Programmer

@Pert

Have followed your steps with respect to the MiniCore. Fine up to the stage of installation.

The question is how to proceed further .. which Programmer to choose ? What I think will be the detailed steps further is :

  1. Connect a UNO and burn the bootloader with shown settings.
    2, Now connect the board to be programmed to this UNO's SPI port.
  2. Choose Arduino as ISP in the programmer option.
  3. Finally choose Sketch > Upload Using Programmer

Sorry if its a basic query.

OK, here are the full instructions:

  • Connect your Uno to the Feather 328P Basic as follows:

Uno - Feather
MOSI - MOSI
MISO - MISO
SCK - SCK
5V - 5V
GND - GND
10 - RST

You can find SPI pin mapping info here: SPI - Arduino Reference

  • Connect the Uno to your computer via the USB cable
  • File > Examples > 11.ArduinoISP > ArduinoISP
  • Tools > Board > Arduino/Genuino Uno
  • Tools > Port > select the port of the Uno
  • Sketch > Upload (this uploads the ArduinoISP sketch to the Uno
  • Install MiniCore following the instructions at the above link.
  • Tools > Board > ATmega328
  • Tools > Bootloader > No
  • Tools > Variant > 328P / 328PA
  • Tools > Programmer > Arduino as ISP
  • Tools > Burn Bootloader (this sets the fuses on the Feather according to the MiniCore board definition you selected)
  • Open the sketch you want to upload to the Feather
  • Sketch > Upload Using Programmer (this uploads the sketch to the Feather via the Arduino as ISP programmer).

@ pert

Excellent. That’s exactly what I needed .. I had a doubt at the point of choosing the Arduino as the external programmer.

I am sure it will help lot many others like me !!