@@ -6,7 +6,7 @@ color: success
66description : 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
158158This 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
186186The 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
192192All 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- 
257+ 
258258
259259## Firmware uploading
260260
2612611. Compiled in Atmel/Microchip Studio 7 to generate HEX file
262262
263- 
263+ 
264264
265265One should see the USBasp programmer under System Devices like this (some issues may arise with the required drivers, as noted below):
266266
267- 
267+ 
268268
2692692. Used AVRDUDE via AVRDUDESS GUI with USBasp programmer:
270270
271- 
271+ 
272272
273- 
273+ 
274274
275275This 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
281281The 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
285285Furthermore, 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
2892893 . 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
295295The 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
299299After 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
303303Final 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
3223222 - 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
3313313 - ` avrdude: program enable: target doesn't answer (0x01) ` Error
332332- Common error during flashing.
0 commit comments