summaryrefslogtreecommitdiffstats
path: root/_site/archive/arduino-uno
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2025-10-25 18:19:48 +0800
committerSadeep Madurange <sadeep@asciimx.com>2025-10-25 19:07:22 +0800
commit8cd867cd53794386cb9443bfc023fe97c5c5fa47 (patch)
tree0f3f076e8b7f542b511d737eaaf3f3ec1cef457d /_site/archive/arduino-uno
parent210a4c8671b368a3a240f9cb7a0bd1718a301523 (diff)
downloadwww-8cd867cd53794386cb9443bfc023fe97c5c5fa47.tar.gz
Render posts.
Diffstat (limited to '_site/archive/arduino-uno')
-rw-r--r--_site/archive/arduino-uno/3v3.Makefile46
-rw-r--r--_site/archive/arduino-uno/Makefile43
-rw-r--r--_site/archive/arduino-uno/breadboard.jpegbin0 -> 54319 bytes
-rw-r--r--_site/archive/arduino-uno/index.html117
-rw-r--r--_site/archive/arduino-uno/pinout.pngbin0 -> 247197 bytes
5 files changed, 206 insertions, 0 deletions
diff --git a/_site/archive/arduino-uno/3v3.Makefile b/_site/archive/arduino-uno/3v3.Makefile
new file mode 100644
index 0000000..4ca89d4
--- /dev/null
+++ b/_site/archive/arduino-uno/3v3.Makefile
@@ -0,0 +1,46 @@
+CC = avr-gcc
+MCU = atmega328p
+PORT = /dev/cuaU0
+TARGET = app
+
+SRC = main.c
+OBJ = $(SRC:.c=.o)
+
+CFLAGS = -std=gnu99
+CFLAGS += -Os
+CFLAGS += -Wall
+CFLAGS += -mmcu=$(MCU)
+CFLAGS += -DBAUD=57600
+CFLAGS += -DF_CPU=8000000UL
+CFLAGS += -ffunction-sections -fdata-sections
+
+LDFLAGS = -mmcu=$(MCU)
+LDFLAGS += -Wl,--gc-sections
+
+HEX_FLAGS = -O ihex
+HEX_FLAGS += -j .text -j .data
+
+AVRDUDE_FLAGS = -p $(MCU)
+AVRDUDE_FLAGS += -c arduino
+AVRDUDE_FLAGS += -b 57600
+AVRDUDE_FLAGS += -P $(PORT)
+AVRDUDE_FLAGS += -D -U
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+elf: $(OBJ)
+ $(CC) $(LDFLAGS) $(OBJ) -o $(TARGET).elf
+
+hex: elf
+ avr-objcopy $(HEX_FLAGS) $(TARGET).elf $(TARGET).hex
+
+upload: hex
+ avrdude $(AVRDUDE_FLAGS) flash:w:$(TARGET).hex:i
+
+.PHONY: clean
+
+clean:
+ rm -f *.o *.elf *.hex
+
+
diff --git a/_site/archive/arduino-uno/Makefile b/_site/archive/arduino-uno/Makefile
new file mode 100644
index 0000000..9db7b09
--- /dev/null
+++ b/_site/archive/arduino-uno/Makefile
@@ -0,0 +1,43 @@
+CC = avr-gcc
+MCU = atmega328p
+PORT = /dev/cuaU0
+TARGET = app
+
+SRC = main.c
+OBJ = $(SRC:.c=.o)
+
+CFLAGS = -std=gnu99
+CFLAGS += -Os
+CFLAGS += -Wall
+CFLAGS += -mmcu=$(MCU)
+CFLAGS += -DBAUD=115200
+CFLAGS += -DF_CPU=16000000UL
+CFLAGS += -ffunction-sections -fdata-sections
+
+LDFLAGS = -mmcu=$(MCU)
+LDFLAGS += -Wl,--gc-sections
+
+HEX_FLAGS = -O ihex
+HEX_FLAGS += -j .text -j .data
+
+AVRDUDE_FLAGS = -p $(MCU)
+AVRDUDE_FLAGS += -c arduino
+AVRDUDE_FLAGS += -P $(PORT)
+AVRDUDE_FLAGS += -D -U
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+elf: $(OBJ)
+ $(CC) $(LDFLAGS) $(OBJ) -o $(TARGET).elf
+
+hex: elf
+ avr-objcopy $(HEX_FLAGS) $(TARGET).elf $(TARGET).hex
+
+upload: hex
+ avrdude $(AVRDUDE_FLAGS) flash:w:$(TARGET).hex:i
+
+.PHONY: clean
+
+clean:
+ rm *.o *.elf *.hex
diff --git a/_site/archive/arduino-uno/breadboard.jpeg b/_site/archive/arduino-uno/breadboard.jpeg
new file mode 100644
index 0000000..bd74907
--- /dev/null
+++ b/_site/archive/arduino-uno/breadboard.jpeg
Binary files differ
diff --git a/_site/archive/arduino-uno/index.html b/_site/archive/arduino-uno/index.html
new file mode 100644
index 0000000..ff3ca44
--- /dev/null
+++ b/_site/archive/arduino-uno/index.html
@@ -0,0 +1,117 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Notes on programming ATmega328P chips</title>
+ <head>
+<meta charset="utf-8">
+ <title>Notes on programming ATmega328P chips</title>
+ <link rel="stylesheet" href="/assets/css/main.css">
+ <link rel="stylesheet" href="/assets/css/normalize.css">
+ <link rel="stylesheet" href="/assets/css/skeleton.css">
+</head>
+
+
+ </head>
+ <body>
+
+ <div class="container">
+ <ul id="navlist" class="left">
+
+ <li >
+ <a href="/">hme</a>
+ </li>
+ <li >
+ <a href="/projects/">proj</a>
+ </li>
+ <li >
+ <a href="/about/">abt</a>
+ </li>
+ <li><a href="/feed.xml">rss</a></li>
+ </ul>
+</div>
+
+
+
+ <main>
+ <div class="container">
+ <h2 class="brand center" id="title">NOTES ON PROGRAMMING ATMEGA328P CHIPS</h2>
+
+ <h6 class="center">10 APRIL 2025</h5>
+
+ <br>
+
+ <div class="threecol justify"><p>This post is a step-by-step guide for wiring up ATmega328P ICs to run at 5 V
+with a 16 MHz crystal and 3.3 V with an 8 MHz crystal. While the 5 V
+configuration is common, the 3.3 V configuration can be advantageous in
+low-power applications and when interfacing with parts that run at 3.3 V.</p>
+
+<h2 id="5-v---16-mhz-configuration">5 V - 16 MHz configuration</h2>
+
+<p>The steps that follow refer to the following pinout.</p>
+
+<table style="border: none; width: 100%;">
+ <tr style="border: none;">
+ <td style="border: none; width: 50%; vertical-align: top;">
+ <img src="pinout.png" alt="Pinout" style="width: 100%" />
+ <p style="text-align: center;">Pinout</p>
+ </td>
+ <td style="border: none; width: 50%; vertical-align: top;">
+ <img src="breadboard.jpeg" alt="Circuit" style="width: 100%" />
+ <p style="text-align: center;">Breadboard</p>
+ </td>
+ </tr>
+</table>
+
+<ol>
+ <li>Connect pin 1 to 5 V via a 10 kΩ resistor.</li>
+ <li>Connect a 16 MHz crystal oscillator across pins 9 and 10.</li>
+ <li>Connect each pin of the crystal to ground via 22 pF capacitors.</li>
+ <li>Connect pins 7, 20, and 21 to 5 V.</li>
+ <li>Connect pins 8 and 22 to ground.</li>
+</ol>
+
+<p>In addition to the connections described above, it’s a good idea to add 0.1 μF
+decoupling capacitors between pins 7, 20, and 21 and ground.
+<a href="Makefile">Here’s</a> a sample Makefile for avr-gcc and avrdude.</p>
+
+<h2 id="33-v---8-mhz-configuration">3.3 V - 8 MHz configuration</h2>
+
+<p>The following steps use Arduino Uno as an ISP and Arduino utilities to program
+ATmega328P’s bootloader and the fuses (e.g., BOD level) for a 3.3 V supply.</p>
+
+<ol>
+ <li>Upload the ‘ArduinoISP’ sketch to the Uno.</li>
+ <li>Wire up the ATmega328P as described in the previous section. Replace the 5 V
+supply with a 3.3 V supply and use an 8 MHz crystal instead of the 16 MHz
+crystal.</li>
+ <li>Connect the SPI ports (SCK, MISO, and MOSI) of the two MCUs.</li>
+ <li>Connect Uno’s SS pin to the IC’s pin 1 (RESET).</li>
+ <li>The IC can be powered by the Arduino Uno’s 5 V pin.</li>
+ <li>Burn the bootloader to the ATmega328P:
+ <ul>
+ <li>Select ‘ATmega328P (3.3 V, 8 MHz)’ from Tools &gt; Processor.</li>
+ <li>Select ‘Arduino as ISP’ from Tools &gt; Programmer.</li>
+ <li>Select Tools &gt; Burn Bootloader.</li>
+ </ul>
+ </li>
+</ol>
+
+<p>The ATmega328P is now ready to run at 8 MHz with a 3.3 V power supply. You can
+upload programs to the ATmega328P as you usually would using avrdude.
+<a href="3v3.Makefile">Here’s</a> a sample Makefile with adjusted parameters (e.g., baud
+rate) for an 8 MHz clock.</p>
+
+<p>In both configurations, if you intend to use the ATmega328P’s analog-to-digital
+converter with the internal 1.1 V or AV<sub>cc</sub> voltage as reference, do
+not connect AREF (pin 21) to V<sub>cc</sub>. Refer to section 23.5.2 ADC
+Voltage Reference in the datasheet for more information.</p>
+
+</div>
+
+ <p class="right italics">by W. D. Sadeep Madurange</p>
+ </div>
+ </main>
+
+ </body>
+</html>
diff --git a/_site/archive/arduino-uno/pinout.png b/_site/archive/arduino-uno/pinout.png
new file mode 100644
index 0000000..59acfbc
--- /dev/null
+++ b/_site/archive/arduino-uno/pinout.png
Binary files differ