Atmega328 Arduino Optiboot with Leaonardo

Hello there,
I've purchased an atmega328 with arduino uno bootloader. I wonder if I can use it with leonardo without burning the bootloader. There many tutorials available but nothing seems to cover my case.
Finally, how i'm gonna connect it to my leonardo ???

Thanks in advance,
Mikos Mikekos

I presume when you say Atmega 328 you mean the same chip that is in an Uno.

There is no socket for any chip on a Leonardo so I don't know what you have in mind.

...R

If you are asking to use your Leonardo as an ISP programmer to program the m328p mcu then yes, you can. You don't need the bootloader. There are a number of posts that kind of show you but it's not clear. Like, Burning a Atmega 328 Bootloader with an Arduino Leonardo - Microcontrollers - Arduino Forum, Arduino Micro as ISP and atTiny84A - Installation & Troubleshooting - Arduino Forum

The basic summary to use your Leonardo as ISP:

  1. Add a programmer.txt definition for the Leonardo as ISP.

  2. Modify the ArduinoISP sketch from the IDE Examples.

  3. Upload the sketch to your Leonardo.

  4. connect up the pins from the Leonardo to the target m328p.

  5. Select Programmer type for Leonardo as ISP

  6. Use the IDE to upload a sketch via Upload Using Programmer to program your target m328p.

  7. Select board type for Uno, (this requires that your target has a 16MHz crystal for it.)

  8. Create a file under /{sketches}/hardware/myarduino/programmers.txt file. (Do this before starting the IDE)

arduinoispmicro.name=Micro/Leonardo as ISP
arduinoispmicro.communication=serial
arduinoispmicro.protocol=arduino
arduinoispmicro.speed=19200
  1. Edit from examples ArduinoISP sketch. Change this line from SS to 10.
#define RESET     10
  1. upload this sketch to your Leonardo.

  2. Connect up the pins from the Leonardo ISP 6-pin header and pin D10 to the target m328p pins.

Leonardo           target m328P(physical pin numbers)
D10                    RESET pin 1

Leonardo
ISP header
MOSI                   MOSI pin 17
MISO                   MISO pin 18
SCK                    SCK  pin 19
VCC                    VCC  pin 7
GND                    GND  pin 8
  1. From the IDE select Programmer -> Micro/Leonardo as ISP
  2. Select board type -> Uno
  3. Open your sketch, then use Upload Using Programmer.