Program standalone ATmega328P

Hello All
I have created a project using Arduino UNO.
I have made a PCB with an ATmega328P And a 6 pin ICSP connector.
ICSP Name to 328P
1 GND 8,22
2 Reset 1 (10k pullup)
3 +5V 7,20
4 SCK 19
5 MISO 18
6 MOSI 17

I am able to program using an Atmel-ICE with Microchip Studio and downloading the hex file OK, but was hoping I could program straight from PlatformIO into the ATmega328P.
Any help always appreciated.
Thanks
Mike

1 Like

Hi,

I program the ATMega328p through the isp connector with usbasp adapter and my PlatfomIO.ini is:

[env:uno]
platform = atmelavr
board = uno
framework = arduino
board_build.f_cpu = 16000000L
upload_protocol = custom

;board_fuses.lfuse = 0xFF
;board_fuses.hfuse = 0xD7
;board_fuses.efuse = 0xFD

upload_flags =
  -C ${platformio.packages_dir}/tool-avrdude/avrdude.conf
  -p atmega328p
  -Pusb
  -c usbasp

upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i

I’ve got a USBtiny programmer and I’ve used that on my Uno, ATrtiny and Duemilanove to upload code.

All I’ve had to do is add one line to my p[latformio.ini file:

upload_protocol = usbtiny

There’s lots of detail on using other programmers here.

HTH

Cheers,
Norm.

1 Like