- Pinouts
- Words of Warning
- Adding compiler and flasher to PATH
- Compiling and Flashing
- Quickly testing hardware with Arduino with libraries.
Pinouts



Words of Warning
- Arduino is 5V, using Atmega328P directly can be ran at 3.3V but not all peripheral may be supported at that level such as the built in EEPROM which requires at least as much as 4.3V.
- A word of caution on running at 5V beware that most other modern mcu are only 3.3V so you will need to use a 3.3V to 5V logic level shifter to interface between the two. This may apply to some sensors as well.
Adding compiler and flasher to PATH
The most pain free way to install the compiler avr-gcc and the flasher avr-dude, is to just install Arduino IDE.
For avr-gcc add the following to you PATH
C:\Users\ckoch\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\bin
For avrdude add the following to your PATH
C:\Users\ckoch\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17\bin
Compiling and Flashing
Flashing usbasp with avrdude for an Arduino generated hex file with Ctrl+Shift+S to export the build.
❯ .\avrdude -c usbasp -p m328p -B 125 -U flash:w:C:\Users\ckoch\OneDrive\Documents\Arduino\bossButton\build\arduino.avr.uno\bossButton.ino.with_bootloader.hex
TODO move this
❯ .\avrdude -c usbasp -p m328p -B 125 -U flash:w:C:\Users\ckoch\OneDrive\Documents\Arduino\Blink\build\arduino.avr.lilypad\Blink.ino.hex
Check the fuses original from factory
❯ .\avrdude -c usbasp -p m328p -U lfuse:r:-:h -U hfuse:r:-:h -U efuse:r:-:h
Error: cannot set sck period; please check for usbasp firmware update
Processing -U lfuse:r:-:h
Reading lfuse memory …
Writing 1 byte to output file
0x62
Processing -U hfuse:r:-:h
Reading hfuse memory …
Writing 1 byte to output file
0xd9
Processing -U efuse:r:-:h
Reading efuse memory …
Writing 1 byte to output file
0xff
Avrdude done. Thank you.
Setting to 8MHz
❯ .\avrdude -c usbasp -p m328p -U lfuse:w:0xE2:m
Error: cannot set sck period; please check for usbasp firmware update
Reading 1 byte for lfuse from input file 0xE2
Writing 1 byte (0xE2) to lfuse, 1 byte written, 1 verified
Avrdude done. Thank you.
After setting
❯ .\avrdude -c usbasp -p m328p -U lfuse:r:-:h
Error: cannot set sck period; please check for usbasp firmware update
Reading lfuse memory …
Writing 1 byte to output file
0xe2
Avrdude done. Thank you.
Set fuse bits to enable 4.3V brown-out detection level, to make it safe to work with internal EEPROM,
to prevent corrupting it from too low of a voltage.
❯ .\avrdude -c usbasp -p m328p -U efuse:w:0xFC:m -B 100kHz
Set SCK frequency to 93750 Hz
Error: cannot set sck period; please check for usbasp firmware update
Reading 1 byte for efuse from input file 0xFC
Writing 1 byte (0xFC) to efuse, 1 byte written, 1 verified
Avrdude done. Thank you.
ckoch@LAPTOP-G8E9F3LR ~ Downloads avrdude-v8.1-windows-x64
❯ .\avrdude -c usbasp -p m328p -U lfuse:r:-:h -U hfuse:r:-:h -U efuse:r:-:h
Error: cannot set sck period; please check for usbasp firmware update
Processing -U lfuse:r:-:h
Reading lfuse memory …
Writing 1 byte to output file
0xe2
Processing -U hfuse:r:-:h
Reading hfuse memory …
Writing 1 byte to output file
0xd9
Processing -U efuse:r:-:h
Reading efuse memory …
Writing 1 byte to output file
0xfc
________
Settings of set of three with 16mHz oscillators
After hooking up the chip to the oscillator with the 22p capacitors I was able to get the chip working.
.\avrdude -c usbasp -p m328p -U lfuse:r:-:h -U hfuse:r:-:h -U efuse:r:-:h -v
Avrdude version 8.1
Copyright see https://github.com/avrdudes/avrdude/blob/main/AUTHORS
System wide configuration file is C:\Users\ckoch\Downloads\avrdude-v8.1-windows-x64\avrdude.conf
Using port : usb
Using programmer : usbasp
AVR part : ATmega328P
Programming modes : SPM, ISP, HVPP, debugWIRE
Programmer type : usbasp
Description : USBasp ISP and TPI programmer
Error: cannot set sck period; please check for usbasp firmware update
AVR device initialized and ready to accept instructions
Device signature = 1E 95 0F (ATmega328P, ATA6614Q, LGT8F328P)
Processing -U lfuse:r:-:h
Reading lfuse memory …
Writing 1 byte to output file
0xff
Processing -U hfuse:r:-:h
Reading hfuse memory …
Writing 1 byte to output file
0xda
Processing -U efuse:r:-:h
Reading efuse memory …
Writing 1 byte to output file
0xfd
Avrdude done. Thank you.
Set clock to 8mHz with 4.3V Brown out Detection
.\avrdude -c usbasp -p m328p -U lfuse:w:0xe2:m -U hfuse:w:0xd9:m -U efuse:w:0xfc:m
Error: cannot set sck period; please check for usbasp firmware update
Processing -U lfuse:w:0xe2:m
Reading 1 byte for lfuse from input file 0xe2
Writing 1 byte (0xE2) to lfuse, 1 byte written, 1 verified
Processing -U hfuse:w:0xd9:m
Reading 1 byte for hfuse from input file 0xd9
Writing 1 byte (0xD9) to hfuse, 1 byte written, 1 verified
Processing -U efuse:w:0xfc:m
Reading 1 byte for efuse from input file 0xfc
Writing 1 byte (0xFC) to efuse, 1 byte written, 1 verified
Avrdude done. Thank you.
Quickly testing hardware with Arduino with libraries.
If you are having issues with hardware and are limited by time while return is accepted such as Amazon then buy it, start the return asap when running into problems. Install Arduino Libraries for your hardware. Test hardware with library examples to do a quick smoke test of the hardware.
Saving money on Arduino boards
Get third party boards for as low as $7 that get the job done.