khofesh / avr-programming

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AVR Programming

IDE

flatpak install flathub cc.arduino.IDE2

add your username to dialout group

sudo usermod -aG dialout fahmad

USBasp

https://www.fischl.de/usbasp/

lsusb -v

Bus 005 Device 008: ID 16c0:05dc Van Ooijen Technische Informatica shared ID for use with libusb
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass          255 Vendor Specific Class
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x16c0 Van Ooijen Technische Informatica
  idProduct          0x05dc shared ID for use with libusb
  bcdDevice            1.02
  iManufacturer           1 www.fischl.de
  iProduct                2 USBasp
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0012
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower               50mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         0
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
Device Status:     0x0000
  (Bus Powered)

add udev rule

sudo vim /etc/udev/rules.d/99-USBasp.rules

add the following

# USBasp - USB programmer for Atmel AVR controllers
# Copy this file to /etc/udev/rules.d so

SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", SYSFS{idVendor}=="16c0", SYSFS{idProduct}=="05dc", MODE="0666", GROUP="dialout"

reload

udevadm control --reload

try talking to the programmer directly

[fahmad@ryzen avr-programming]$  avrdude -p atmega328p -c usbasp

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably lgt8fx328p)

avrdude: safemode: Fuses OK (E:FD, H:DE, L:FF)

avrdude done.  Thank you.

Warning: cannot set sck period

[fahmad@ryzen ~]$  avrdude -cusbasp -pm328p -Pusb

avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably lgt8fx328p)

avrdude: safemode: Fuses OK (E:FD, H:DE, L:FF)

avrdude done.  Thank you.

solder header pin on JP2 and connect the two of them

header pin soldered

connect the first usbasp to the second usbasp

two usbasp

update firmware

cd usbasp
tar xvf usbasp.2011-05-28.tar.gz
cd usbasp.2011-05-28
[fahmad@ryzen usbasp.2011-05-28]$  avrdude -p atmega8 -c usbasp -U flash:w:bin/firmware/usbasp.atmega8.2011-05-28.hex:i -F -P usb

avrdude: warning: cannot set sck period. please check for usbasp firmware update.

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably lgt8fx328p)
avrdude: Expected signature for ATmega8 is 1E 93 07
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: reading input file "bin/firmware/usbasp.atmega8.2011-05-28.hex"
avrdude: writing flash (4700 bytes):

Writing | ################################################## | 100% 2.99s

avrdude: 4700 bytes of flash written
avrdude: verifying flash memory against bin/firmware/usbasp.atmega8.2011-05-28.hex:
avrdude: load data flash data from input file bin/firmware/usbasp.atmega8.2011-05-28.hex:
avrdude: input file bin/firmware/usbasp.atmega8.2011-05-28.hex contains 4700 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 2.37s

avrdude: verifying ...
avrdude: 4700 bytes of flash verified

avrdude: safemode: Fuses OK (E:FF, H:DE, L:FF)

avrdude done.  Thank you.

Atmega168 and Atmega328

differences between processors

differences

references

About


Languages

Language:Makefile 74.1%Language:C 24.5%Language:C++ 1.4%