Atmega328p standalone
Very simple and basic setup with Raspberry Pi 2 SPI programming. Try at your own risk.
Linux setup for SPI:
/etc/avrdude.conf: programmer id = "linuxspi"; desc = "Use Linux SPI device in /dev/spidev*"; type = "linuxspi"; reset = 25; #this is opposite of SPI ports on the RPI # baudrate=400000; # this is too high for my atmega ... baudrate=100000; ;
avrdude transfer and fuses: sudo avrdude -p m328p -c linuxspi -P /dev/spidev0.0 -U flash:w:build-cli/MYBUILD.hex sudo avrdude -p m328p -c linuxspi -P /dev/spidev0.0 -U lfuse:w:0xFF:m -U hfuse:w:0xDE:m -U efuse:w:0x05:m
/boot/config.txt dtparam=spi=on dtparam=i2c_arm=off
lsmod: pi@raspberrypi ~ $ lsmod Module Size Used by ctr 3717 2 ccm 7811 2 snd_bcm2835 19769 0 snd_pcm 74825 1 snd_bcm2835 snd_seq 53561 0 snd_seq_device 3650 1 snd_seq snd_timer 18157 2 snd_pcm,snd_seq snd 52116 5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device arc4 1753 2 rt2800usb 17802 0 rt2800lib 71907 1 rt2800usb rt2x00usb 8553 1 rt2800usb rt2x00lib 36744 3 rt2x00usb,rt2800lib,rt2800usb mac80211 542174 3 rt2x00lib,rt2x00usb,rt2800lib cfg80211 420690 2 mac80211,rt2x00lib crc_ccitt 1161 1 rt2800lib rfkill 16659 2 cfg80211 spi_bcm2835 7208 0 bcm2835_gpiomem 2995 0 uio_pdrv_genirq 2966 0 uio 8235 1 uio_pdrv_genirq
Makefile: ARDUINO_DIR = /usr/share/arduino BOARD_TAG = uno ARDUINO_PORT = /dev/ttyAMA0 ARDUINO_LIBS = include /usr/share/arduino/Arduino.mk
#define LED_RED 7 #define LED_ORANGE 8 #define LED_YELLOW 9 #define LED_GREEN 10 void setup(){ pinMode(LED_RED, OUTPUT); pinMode(LED_ORANGE, OUTPUT); pinMode(LED_YELLOW, OUTPUT); pinMode(LED_GREEN, OUTPUT); } void loop (){ int irandom = random(0,2000); delay(irandom); digitalWrite(LED_RED, HIGH); digitalWrite(LED_ORANGE, HIGH); digitalWrite(LED_YELLOW, HIGH); digitalWrite(LED_GREEN, HIGH); delay(irandom); digitalWrite(LED_RED, LOW); digitalWrite(LED_ORANGE, LOW); digitalWrite(LED_YELLOW, LOW); digitalWrite(LED_GREEN, LOW); }