0% found this document useful (0 votes)
102 views

How To Upload Using AVR Dude

This document provides instructions for uploading a hex file to an Arduino 3DoT or Uno board using AVR Dude. It explains how to modify the upload.bat batch file with the correct COM port and hex file name. Running the batch file will use AVR Dude to upload the hex file to the board in bootloader mode in two attempts in case the first fails to upload. It also describes how to create a hex file from an Arduino sketch in the IDE.

Uploaded by

rc2molina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views

How To Upload Using AVR Dude

This document provides instructions for uploading a hex file to an Arduino 3DoT or Uno board using AVR Dude. It explains how to modify the upload.bat batch file with the correct COM port and hex file name. Running the batch file will use AVR Dude to upload the hex file to the board in bootloader mode in two attempts in case the first fails to upload. It also describes how to create a hex file from an Arduino sketch in the IDE.

Uploaded by

rc2molina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

How to Upload your Hex file using AVR Dude

If you have not done so already, download and install AVR Studio, WinAVR, and Arduino IDE
from http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2725,
http://sourceforge.net/projects/winavr/, and http://arduino.cc/en/Main/Software

At this time you should have verified that your Arduino 3DoT works by uploading and running
3DoT blink from the Arduino IDE (Integrated Development Environment). Instructions are
provided in "3DoT Training Document" found on the class website.

From the Lab01 folder, open the batch file name upload.bat in notepad (right-click upload.bat
and select Edit). Here you will see the following two commands (REM statements deleted for
clarity).

3DoT
avrdude -v -p atmega32u4 -c avr109 -P \\.\COM14 -b 57600 -D -U
flash:w:Lab1.hex
pause
avrdude -v -p atmega32u4 -c avr109 -P \\.\COM14 -b 57600 -D -U
flash:w:Lab1.hex
exit

Arduino UNO
avrdude -p m328p -c arduino -P \\.\COM4 -b 115200 -U flash:w:Lab1.hex
pause

Here is a short description the options and how you will need to modify them. For a complete list
of avrdude command line options go to http://www.nongnu.org/avrdude/user-
manual/avrdude_4.html#SEC4 her

-v Enable verbose output.


-p partno Use -p ? option in the command window (Windows - R Open:cmd)
to get a list of part numbers
-c programmer-id You can also use stk500v1
-P port Set to your port number. The \\.\ provides support for com port
numbers greater than 7.
-b baudrate For 3DoT keep the baud rate at 57600. For the Uno set the baud
rate at 115200.
-D Disable auto erase for flash
-U memtype:op:filename[:format] Enter the name of your file (ex. Blink.hex)
memtype flash The flash ROM of the device.
op w Read the specified file and write it to the specified device
memory.

In the future if you need to create a new batch file or if you modified this one; be sure to save
the file with a .bat extension (not .txt) in the folder containing your hex file (look in the folder
named 'default').

How to use this batch file


1. Find out what COM port is used when the board is put into bootloader mode (see step c
and explanation below)
a) Open the Device manager. On Windows 7 Start ►Devices and Printers
b) Connect the 3DoT board and turn it ON
c) Put the board into bootloader mode by pressing the reset button twice.
d) The list of connected devices should update. Look for the one that says Arduino
Lilypad Bootloader.
2. Update the batch file with the COM port found in step 1 and the file name of the “.hex”
file generated in AVR Studio.
3. Upload the file by running the batch file.

Why do we have two avrdude command lines?


The 3DoT board needs to be placed into bootloader mode before the batch file is executed.
This means you need to press the button twice and then quickly run the batch file. The double
avrdude command line structure of the batch file is in case you were unable to put the 3DoT
board into bootloader mode when the batch file was originally run. If you were unable to upload
the first time, it waits for you to press a key (pause command line) before the second command
is run. This gives you time to make sure it is in bootloader mode before pressing a key to
upload.

How to Create a Hex file in the Arduino IDE


First thing that needs to be done is to make sure the Arduino sketch file is in its own folder at a
location that you can find. For example, you can click on File ► Save and have it placed onto
the desktop. In order to verify this has been done, you can click on Sketch ► Show Sketch
Folder and confirm the file path indicates it is on the desktop.

In order to create the hex file, click on Sketch ► Export Compiled Binary..
This will generate the hex file inside the sketch folder. You can then paste the upload.bat file
into this folder and execute it to upload the code

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy