Skip to content

Commit 7d5c490

Browse files
committed
.
1 parent 0ea3318 commit 7d5c490

19 files changed

+17
-17
lines changed

_posts/2025-04-23-ATMega328P_two_leds.md renamed to _posts/2025-04-23-ATMega328PU_two_leds.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ color: success
66
description: Developing a basic ATMega328P application
77
---
88

9-
<img src="../assets/blog_images/2025-04-23-ATMega328P_two_leds/leds.jpg" width="400" height="400" />
9+
<img src="../assets/blog_images/2025-04-23-ATMega328PU_two_leds/leds.jpg" width="400" height="400" />
1010

1111
# Introduction
1212

@@ -157,7 +157,7 @@ If all components are active continuously, the total current is 137 mA. This mea
157157

158158
This low power total consumption < 10mA enables battery operation. But to power the system, we choose to use the very useful [Elegoo power supply module](https://flaviocopes.com/electronics-component-power-supply/), directly connected to the breadboard:
159159

160-
![5V](../assets/blog_images/2025-04-23-ATMega328P_two_leds/5V.jpg)
160+
![5V](../assets/blog_images/2025-04-23-ATMega328PU_two_leds/5V.jpg)
161161

162162
# Bill of materiales (BOM)
163163

@@ -185,9 +185,9 @@ We will, later, mount the prototype circuit in a very simple breadboard basis.
185185

186186
The circuit was first simulated in Proteus ISIS using WinAVR compiler. This allowed verification of LED timing patterns before physical implementation.
187187

188-
![code](../assets/blog_images/2025-04-23-ATMega328P_two_leds/code.png)
188+
![code](../assets/blog_images/2025-04-23-ATMega328PU_two_leds/code.png)
189189

190-
![schematic](../assets/blog_images/2025-04-23-ATMega328P_two_leds/schematic.png)
190+
![schematic](../assets/blog_images/2025-04-23-ATMega328PU_two_leds/schematic.png)
191191

192192
All the firmware code is written in C using the AVR libraries and is compiled in the following main.c:
193193

@@ -254,23 +254,23 @@ int main(void) {
254254
}
255255
```
256256
257-
![simul](../assets/blog_images/2025-04-23-ATMega328P_two_leds/simul.gif)
257+
![simul](../assets/blog_images/2025-04-23-ATMega328PU_two_leds/simul.gif)
258258
259259
## Firmware uploading
260260
261261
1. Compiled in Atmel/Microchip Studio 7 to generate HEX file
262262
263-
![studio](../assets/blog_images/2025-04-23-ATMega328P_two_leds/studio.png)
263+
![studio](../assets/blog_images/2025-04-23-ATMega328PU_two_leds/studio.png)
264264
265265
One should see the USBasp programmer under System Devices like this (some issues may arise with the required drivers, as noted below):
266266
267-
![dispos](../assets/blog_images/2025-04-23-ATMega328P_two_leds/dispos.png)
267+
![dispos](../assets/blog_images/2025-04-23-ATMega328PU_two_leds/dispos.png)
268268
269269
2. Used AVRDUDE via AVRDUDESS GUI with USBasp programmer:
270270
271-
![usbasp_programmer](../assets/blog_images/2025-04-23-ATMega328P_two_leds/usbasp_programmer.jpg)
271+
![usbasp_programmer](../assets/blog_images/2025-04-23-ATMega328PU_two_leds/usbasp_programmer.jpg)
272272
273-
![avrdudess](../assets/blog_images/2025-04-23-ATMega328P_two_leds/avrdudess.png)
273+
![avrdudess](../assets/blog_images/2025-04-23-ATMega328PU_two_leds/avrdudess.png)
274274
275275
This is the specific command that burns the firmware (one could just use avrdude in command-line interface mode):
276276
@@ -280,29 +280,29 @@ avrdude.exe -c usbasp -p m328p -P usb -B 5.33 -U flash:w:"C:\Users\Alejandro\Doc
280280

281281
The fuses (low, high, and extended fuses) of the microcontroller had to be configured according to the required clock, divider, etc., using the AVRDUDESS fuse calculator:
282282

283-
![fuses](../assets/blog_images/2025-04-23-ATMega328P_two_leds/fuses.png)
283+
![fuses](../assets/blog_images/2025-04-23-ATMega328PU_two_leds/fuses.png)
284284

285285
Furthermore, the acquired programmer included a very useful accessory to avoid any confusion with the orientation of the SPI connector pins:
286286

287-
![interfac_10_to_6_SPI](../assets/blog_images/2025-04-23-ATMega328P_two_leds/interfac_10_to_6_SPI.jpg)
287+
![interfac_10_to_6_SPI](../assets/blog_images/2025-04-23-ATMega328PU_two_leds/interfac_10_to_6_SPI.jpg)
288288

289289
3. Verified SCK signal during programming. Next, we checked that the programming circuit is working by selecting the "Detect" option in AVRDUDESS. We can see an active pulse in the SCK pin:
290290

291-
![sck_detect](../assets/blog_images/2025-04-23-ATMega328P_two_leds/sck_detect.gif)
291+
![sck_detect](../assets/blog_images/2025-04-23-ATMega328PU_two_leds/sck_detect.gif)
292292

293293
# Testing
294294

295295
The circuit we used to program the microcontroller would be the following:
296296

297-
![programmer_circuit](../assets/blog_images/2025-04-23-ATMega328P_two_leds/programmer_circuit.jpg)
297+
![programmer_circuit](../assets/blog_images/2025-04-23-ATMega328PU_two_leds/programmer_circuit.jpg)
298298

299299
After flashing the firmware in the (non-volatile) uC flash memory, we transferred it to the prototype of the actual circuit:
300300

301-
![breadboard_circuit](../assets/blog_images/2025-04-23-ATMega328P_two_leds/breadboard_circuit.png)
301+
![breadboard_circuit](../assets/blog_images/2025-04-23-ATMega328PU_two_leds/breadboard_circuit.png)
302302

303303
Final implementation showing alternating LED pattern:
304304

305-
![real](../assets/blog_images/2025-04-23-ATMega328P_two_leds/real.gif)
305+
![real](../assets/blog_images/2025-04-23-ATMega328PU_two_leds/real.gif)
306306

307307
# Troubleshooting
308308

@@ -317,7 +317,7 @@ Due to using a USBasp clone programmer, several issues were encountered during t
317317
- [Alternative fix method](https://www.youtube.com/watch?v=tzekKRCbITQ)
318318
- [Arduino Forum Thread](https://forum.arduino.cc/t/built-in-avrdude-refuses-to-work-with-usbasp-clone/995372/2)
319319

320-
![zadig](../assets/blog_images/2025-04-23-ATMega328P_two_leds/zadig.png)
320+
![zadig](../assets/blog_images/2025-04-23-ATMega328PU_two_leds/zadig.png)
321321

322322
2 - ISP programmer appears as HID instead of USBasp
323323
- Requires the **Chinese PROGISPV172** tool:
@@ -326,7 +326,7 @@ Due to using a USBasp clone programmer, several issues were encountered during t
326326
- More info on [AVRfreaks](https://www.avrfreaks.net/s/topic/a5C3l000000UZPzEAO/t149941)
327327
- This often occurs with USBasp clones using outdated or modified firmware.
328328

329-
![solution_is_reinstall_drivers](../assets/blog_images/2025-04-23-ATMega328P_two_leds/solution_is_reinstall_drivers.png)
329+
![solution_is_reinstall_drivers](../assets/blog_images/2025-04-23-ATMega328PU_two_leds/solution_is_reinstall_drivers.png)
330330

331331
3 - `avrdude: program enable: target doesn't answer (0x01)` Error
332332
- Common error during flashing.

0 commit comments

Comments
 (0)