I tried with Raspberry Pi then. I used tutorial from here but it didn't really cover the whole process. What I did was:
1. Install avrdude
sudo apt-get update
sudo apt-get install avrdude
2. Connect the wires:

Arduino ICSP VCC to Raspberry Pi 5 volt pin.
Arduino ICSP GND to Raspberry Pi ground pin.
Arduino ICSP RESET to Raspberry Pi GPIO #12.
Arduino ICSP SCK to Raspberry Pi GPIO #24.
Arduino ICSP MOSI to Raspberry Pi GPIO #23.
Arduino ICSP MISO to Raspberry Pi GPIO #18.
3. Prepare configuration file (I used leafpad to edit it):
cp /etc/avrdude.conf /etc/avrdude_gpio.conf
leafpad /etc/avrdude_gpio.conf
4. At the end of avrdude_gpio.conf I added below lines:
# Linux GPIO configuration for avrdude.
# Change the lines below to the GPIO pins connected to the AVR.
programmer
id = "pi_1";
desc = "Use the Linux sysfs interface to bitbang GPIO lines";
type = "linuxgpio";
reset = 12;
sck = 24;
mosi = 23;
miso = 18;
;
5. Now we need hex file with bootloader. The tutorial says to use what was compiled in IDE however it didn't work for me. I used generic bootloader from file sparkfunboards.1.1.9.tar.bz2 downloaded from this link.
6. Inside that archive I went to \avr-1.1.9\bootloaders\caterina\ and copied Caterina.hex to Raspberry Pi.
7. Check if can connect:
avrdude -p atmega328p -C ~/avrdude_gpio.conf -c pi_1 -v
8. Flash bootloader with below command:
avrdude -p m32u4 -C /etc/avrdude_gpio.conf -c pi_1 -v -U flash:w:Caterina.hex:i
Output was following:
avrdude: Version 6.3 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch System wide configuration file is "/etc/avrdude_gpio.conf" User configuration file is "/root/.avrduderc" User configuration file does not exist or is not a regular file, skipping Using Port : unknown Using Programmer : pi_1 AVR Part : ATmega32U4 Chip Erase delay : 9000 us PAGEL : PD7 BS2 : PA0 RESET disposition : dedicated RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail : Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- eeprom 65 20 4 0 no 1024 4 0 9000 9000 0x00 0x00 flash 65 6 128 0 yes 32768 128 256 4500 4500 0x00 0x00 lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00 signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00 Programmer Type : linuxgpio Description : Use the Linux sysfs interface to bitbang GPIO lines Pin assignment : /sys/class/gpio/gpio{n} RESET = 12 SCK = 24 MOSI = 23 MISO = 18 avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e9587 (probably m32u4) avrdude: safemode: hfuse reads as D8 avrdude: safemode: efuse reads as CB 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: reading input file "Caterina.hex" avrdude: writing flash (32762 bytes): Writing | ################################################## | 100% 2.31s avrdude: 32762 bytes of flash written avrdude: verifying flash memory against Caterina.hex: avrdude: load data flash data from input file Caterina.hex: avrdude: input file Caterina.hex contains 32762 bytes avrdude: reading on-chip flash data: Reading | ################################################## | 100% 2.11s avrdude: verifying ... avrdude: 32762 bytes of flash verified avrdude: safemode: hfuse reads as D8 avrdude: safemode: efuse reads as CB avrdude: safemode: Fuses OK (E:CB, H:D8, L:FF) avrdude done. Thank you.
After that my Arduino Leonardo was recognized by Windows and successfully flashed test blink program.
No comments:
Post a Comment