<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://www.microrusty.com/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Programming_Flash_-_EEPROM_memory</id>
	<title>Programming Flash - EEPROM memory - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://www.microrusty.com/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Programming_Flash_-_EEPROM_memory"/>
	<link rel="alternate" type="text/html" href="http://www.microrusty.com/mediawiki/index.php?title=Programming_Flash_-_EEPROM_memory&amp;action=history"/>
	<updated>2026-04-23T18:10:53Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>http://www.microrusty.com/mediawiki/index.php?title=Programming_Flash_-_EEPROM_memory&amp;diff=36&amp;oldid=prev</id>
		<title>U731219879 rc: Created page with &quot;This Project we will setup &#039;&#039;&#039;ATmega328P Target Bd&#039;&#039;&#039; at 16 MHz and Flash the Blink-AVRdude program to chip.&lt;br&gt;  The program Writes ASCII characters to EEPROM and then blinks...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.microrusty.com/mediawiki/index.php?title=Programming_Flash_-_EEPROM_memory&amp;diff=36&amp;oldid=prev"/>
		<updated>2019-03-23T03:50:10Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This Project we will setup &amp;#039;&amp;#039;&amp;#039;ATmega328P Target Bd&amp;#039;&amp;#039;&amp;#039; at 16 MHz and Flash the Blink-AVRdude program to chip.&amp;lt;br&amp;gt;  The program Writes ASCII characters to EEPROM and then blinks...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This Project we will setup &amp;#039;&amp;#039;&amp;#039;ATmega328P Target Bd&amp;#039;&amp;#039;&amp;#039; at 16 MHz and Flash the Blink-AVRdude program to chip.&amp;lt;br&amp;gt; &lt;br /&gt;
The program Writes ASCII characters to EEPROM and then blinks a Yellow and Red LED &amp;lt;br&amp;gt;&lt;br /&gt;
This Project will explore the Flash and EEPROM memory inside the ATmega328P.&amp;lt;br&amp;gt;&lt;br /&gt;
Learn how to display the EEPROM memory and then write to the EEPROM using AVRdude. &lt;br /&gt;
&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;Prerequisites&amp;#039;&amp;#039;&amp;#039;: Know how to use &amp;#039;&amp;#039;&amp;#039;AVRdude&amp;#039;&amp;#039;&amp;#039; with a &amp;#039;&amp;#039;&amp;#039;USB programmer&amp;#039;&amp;#039;&amp;#039;. (usbtiny, usbasp, etc.....)&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;avrdude -p m328p -c usbtiny -v&amp;#039;&amp;#039;&amp;#039; | &amp;#039;&amp;#039;&amp;#039;avrdude -p m328p -c usbasp -P usb -v&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Connect &amp;#039;&amp;#039;&amp;#039;USBtiny&amp;#039;&amp;#039;&amp;#039; to &amp;#039;&amp;#039;&amp;#039;ATmega328P Target Board&amp;#039;&amp;#039;&amp;#039;. &amp;lt;br&amp;gt;&lt;br /&gt;
* Test the connection to programmer:  &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;avrdude -p m328p -c usbtiny -v&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
* Set Clock Fuse to 16 MHz &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;avrdude -p m328p -c usbtiny -v -U lfuse:w:0xFF:m -U hfuse:w:0xDE:m -U efuse:w:0xFF:m&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;  &lt;br /&gt;
* Connect Yellow LED with pull down resistor to &amp;#039;&amp;#039;&amp;#039;Pin D13&amp;#039;&amp;#039;&amp;#039; on &amp;#039;&amp;#039;&amp;#039;ATmega328P Target bd&amp;#039;&amp;#039;&amp;#039;. (Not needed if using Target Bd built in Yellow LED) &amp;lt;br&amp;gt;&lt;br /&gt;
* Connect Red LED with pull down resistor to &amp;#039;&amp;#039;&amp;#039;Pin D10&amp;#039;&amp;#039;&amp;#039; on &amp;#039;&amp;#039;&amp;#039;ATmega328P Target bd&amp;#039;&amp;#039;&amp;#039;. &amp;lt;br&amp;gt;&lt;br /&gt;
* Open &amp;#039;&amp;#039;&amp;#039;Arduino IDE&amp;#039;&amp;#039;&amp;#039; and change the following settings: Under the &amp;#039;&amp;#039;&amp;#039;Tools&amp;#039;&amp;#039;&amp;#039; tab &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       &amp;#039;&amp;#039;&amp;#039;Board:&amp;#039;&amp;#039;&amp;#039; =&amp;#039;&amp;#039;&amp;#039;&amp;quot;Arduino/Genunio Uno&amp;quot;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
       &amp;#039;&amp;#039;&amp;#039;Programmer:&amp;#039;&amp;#039;&amp;#039; = &amp;#039;&amp;#039;&amp;#039;&amp;quot;USBtiny or USBasp&amp;quot;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Copy-Paste/Load &amp;#039;&amp;#039;&amp;#039;Blink-AVRdude.ino&amp;#039;&amp;#039;&amp;#039; Arduino file. (&amp;#039;&amp;#039;&amp;#039;Do not Flash at this time&amp;#039;&amp;#039;&amp;#039;)&amp;lt;br&amp;gt;&lt;br /&gt;
 /*&lt;br /&gt;
  Blink-AVRdude.ino Atmega328P Blink Green &amp;amp; Red LEDs.&lt;br /&gt;
  Write to EEPROM memory and use AVRdude Terminal Mode to Read the EEPROM.&lt;br /&gt;
  Terminal mode command: avrdude -c usbtiny -p atmega328p -v -t&lt;br /&gt;
   dump flash 0 2138&lt;br /&gt;
   dump eeprom 0 128&lt;br /&gt;
 */&lt;br /&gt;
 #include &amp;lt;EEPROM.h&amp;gt;&lt;br /&gt;
 #define LED_YELLOW 13&lt;br /&gt;
 #define LED_RED 10&lt;br /&gt;
 void setup() &lt;br /&gt;
 {&lt;br /&gt;
  // initialize digital pin 13 as an output.&lt;br /&gt;
  pinMode(LED_YELLOW, OUTPUT);      //Green LED set up at output&lt;br /&gt;
  pinMode(LED_RED, OUTPUT);         //Red LED set up at output&lt;br /&gt;
  Serial.begin(9600);&lt;br /&gt;
  Serial.println(&amp;quot; Embedded Workshop &amp;quot;;&lt;br /&gt;
  for (int i = 0; i &amp;lt; 255; i++)     //Loop Functionto write ASCII characters   &lt;br /&gt;
  EEPROM.write(i, i);               // Write to EEprom&lt;br /&gt;
 }&lt;br /&gt;
 void loop() &lt;br /&gt;
 {&lt;br /&gt;
 Serial.println(&amp;quot; Embedded Workshop &amp;quot;);&lt;br /&gt;
 Serial.println(&amp;quot;Author Microrustyc October 2018&amp;quot;);  &lt;br /&gt;
 digitalWrite(LED_YELLOW, HIGH);    // turn the LED on (HIGH is the voltage level)&lt;br /&gt;
 delay(100);                        // wait for a second&lt;br /&gt;
 digitalWrite(LED_YELLOW, LOW);     // turn the LED off by making the voltage LOW&lt;br /&gt;
 delay(100);                        // wait for a second&lt;br /&gt;
 digitalWrite(LED_RED, HIGH);       // turn the LED on (HIGH is the voltage level)&lt;br /&gt;
 delay(100);                        // wait for a second&lt;br /&gt;
 digitalWrite(LED_RED, LOW);        // turn the LED off by making the voltage LOW&lt;br /&gt;
 delay(100);                        // wait for a second&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
*Under the Sketch Tab Select &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Export compiled Binary&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*Under the Sketch Tab Select &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Show Folder location&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; You should see the following 3 files:&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: HexFilesPic.PNG ]]&amp;lt;br&amp;gt;&lt;br /&gt;
Notice the two additional Hex files. One has a [[https://www.arduino.cc/en/Hacking/Bootloader?from=Tutorial.Bootloader &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Bootloader&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;]] and the other does not.&amp;lt;br&amp;gt; &lt;br /&gt;
Does the &amp;#039;&amp;#039;&amp;#039;ATmega328P&amp;#039;&amp;#039;&amp;#039; Target board need a [[https://www.arduino.cc/en/Hacking/Bootloader?from=Tutorial.Bootloader &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Bootloader&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;]]? &amp;lt;br&amp;gt;&lt;br /&gt;
Copy those two &amp;#039;&amp;#039;&amp;#039;hex files&amp;#039;&amp;#039;&amp;#039; over to the &amp;#039;&amp;#039;&amp;#039;AVRdude&amp;#039;&amp;#039;&amp;#039; directory.&amp;lt;br&amp;gt;&lt;br /&gt;
Under the Sketch Tab Select: &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Upload Using Programmer&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:ArduinoFileSizePic.PNG]]&amp;lt;br&amp;gt;&lt;br /&gt;
Notice the Sketch uses &amp;#039;&amp;#039;&amp;#039;2138 bytes&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Now lets go and look at the memory inside the ATmega328P&lt;br /&gt;
*Open AVRdude in the Terminal Mode with the following command: &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;avrdude -p m328p -c usbtiny -t&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
*Enter the following Terminal commands and experiment with each one.&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;dump flash 00 2138&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;dump eeprom 0 128&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;write eeprom 00 0x20 0x57 0x6f 0x72 0x6b 0x73 0x68 0x6f 0x70 0x20 0x32 0x30 0x31 0x38 0x20&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;dump eeprom 0 128&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
[[File:DumpEEPROMPic.PNG]]&amp;lt;br&amp;gt;&lt;br /&gt;
Now lets use the erase command and see what happens.&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;erase&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;dump flash 00 2138&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;dump eeprom 0 128&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;write eeprom 00 0x20 0x57 0x6f 0x72 0x6b 0x73 0x68 0x6f 0x70 0x20 0x32 0x30 0x31 0x38 0x20&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;dump eeprom 0 128&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Notice all memory was cleared and the LED&amp;#039;s are not blinking. &lt;br /&gt;
The Fuse setting did not change and are not affected by the erase command.&amp;lt;br&amp;gt;&lt;br /&gt;
*Exit AVRdude Terminal Mode &amp;gt;&amp;gt;&amp;gt; &amp;#039;&amp;#039;&amp;#039;quit&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&lt;br /&gt;
*Flash the ATmega328P board without using the &amp;#039;&amp;#039;&amp;#039;Arduino IDE&amp;#039;&amp;#039;&amp;#039;. Use the following &amp;#039;&amp;#039;&amp;#039;AVRdude&amp;#039;&amp;#039;&amp;#039; command:&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;avrdude -c usbtiny -p m328p -U flash:w:Blink-AVRdude.ino.standard.hex&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*Open AVRdude in the Terminal Mode with the following command: &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;avrdude -p m328p -c usbtiny -t&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
*Enter the following Terminal commands again and everything has been flashed.&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;dump flash 00 2138&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;dump eeprom 0 128&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;write eeprom 0x80 0x20 0x57 0x6f 0x72 0x6b 0x73 0x68 0x6f 0x70 0x20 0x32 0x30 0x31 0x38 0x20&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;dump eeprom 0 128&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
How to use AVRdude Command to Read Flash memory and Write to Disk .&lt;br /&gt;
&lt;br /&gt;
 Read Flash memory and save in a hex file to disk.&lt;br /&gt;
 *Enter the following command in the AVRdude &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;avrdude -c usbtiny -p m328p -U flash:r:Blink-AVRdude2.hex:r&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 [[File:AvrdudeReadPic.PNG]]&amp;lt;br&amp;gt;&lt;br /&gt;
 *Erase Chip Memory Command &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;avrdude -p m328p -c usbtiny -e&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 Notice all memory was cleared and the LED&amp;#039;s are not blinking..&amp;lt;br&amp;gt;&lt;br /&gt;
 *Write file back to Flash memory &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;avrdude -c usbtiny -p m328p -U flash:w:Blink-AVRdude2.hex&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 [[File:AvrdudeWritePic.PNG]]&lt;br /&gt;
 Notice the LED&amp;#039;s are Blinking again.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reading EEPROM Memory and file to disk: &lt;br /&gt;
 avrdude -c usbtiny -p m328p -U eeprom:r:eeprom.hex:i&lt;br /&gt;
&lt;br /&gt;
Writing to EEPROM from disk:&lt;br /&gt;
 avrdude -c usbtiny -p m328p -U eeprom:w:eeprom.hex:i&lt;br /&gt;
&lt;br /&gt;
This completes Project 2.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==[[ AVRDUDE Class ]]==&lt;/div&gt;</summary>
		<author><name>U731219879 rc</name></author>
		
	</entry>
</feed>