Skip to content

itsjustaplant/ATmega328P-blink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ATmega328P-blink

As Samuel Beckett said

try again, fail again, fail better

What do you need?

1- ATmega328P or any other chip

2- AVR Programmer *USBASP, AVR ISP etc.

3- Lot of jumper you'll need more in time

4- LED

5- Multimeter

6- Resistor

You don't need an external oscillator since you already have an internal one

Software Setup

1- You need an AVR cross-compiler avr-gcc, win-avr etc.

2- You need avrdude or any other uploader

3- You may or not use avr-objdump

Common mistakes and errors

avrdude: verification error, first mismatch at byte...

this may happen because you buy cheap USBASP. Thus it supplies only 3.3V, your chip not gonna work properly

avrdude: initialization failed, rc=-1

That means your programmer and chip cannot communicate with each other, so you better check your connections again

How to build

1- Go into /build folder

2- Run cmake ..

3- Run make

Tips and Recommendations

-Check your connections before you move on to the circuit

-You don't have to set your fuses you can use default fuses

-Don't just assign binary values to registers. Use masking and bit shifting

Resources

https://markvanderlaan.nl/2019-10-25-avr-c-bitshifting/ -> bit shifting

https://www.engbedded.com/fusecalc/ -> fuse calculator

http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf -> official datasheet

Issues

1- flash command doesn't work (SOLVED by adding avrdude config file)

As plant said once

I'm just a plant making sphagetti da ba de

About

Simple standalone Atmega328P blink code

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published