welcome: please sign in
location: MicrodecArduino


Arduino Programming / Bootloading

Most MICrODECs shipped after 8.11.11 come preloaded with the Arduino bootloader. This allows new code to be loaded without having to use a JTAG or ISP programming dongle. It also allows the use of the Arduino programming environment, which some people find easier to use. Although a very good Arduino library has been written for the MICrODEC, there is a compromise in writing in C, and making the code general purpose, that limits what sort of tasks that can be accomplished in the ~400 clock cycles between samples. So, although you may find it easier to program, you might not be able to do as much with your MICrODEC.

MICrODEC Arduino Library

To use Arduino with your MICrODEC, you have to do a few things first. First, download and unzip the library file above, and place the entire folder Microdec into your arduino sketches directory. On WINXP this is located in:

C:\Documents and Settings\user\My Documents\Arduino\library\

where user is your username. You may have to create the library folder first, if you haven't already done so. If you are having trouble locating this directory, try to find where Arduino is storing your sketches.

Next, you will have to update your Arduino boards.txt file, to include the MICrODEC as a target platform. Inside of the Microdec folder, there is a file named microdec_boards.txt. Copy the contents of this file, and paste it onto the end of your Arduino boards.txt file. On WINXP you can find this file at:


Now you are ready to program! Just run Arduino and navigate to File -> Examples -> Microdec and open up an example program. Click load, and verify that it works. Although the example programs give a good overview of the various functions available, there are many, many more features that they do not show. Please read through the readme.txt file included in the Microdec folder to learn about these extra features.

Loading Code without Arduino

To use the MICrODEC bootloader, and Arduino, you will need an FTDI cable. These are USB to serial cables with a 6pin header on one end. We reccomend the 3.3V version, as most 5V logic can accept 3.3V, and the cable itself is 5V tolerant. This way you can reuse the cable for other 3.3V projects.

The proper orientation of the FTDI cable is shown below. Note that the black wire of the FTDI cable is on the left-hand side, if you are viewing the MICrODEC from the back. It is very important to plug the cable in the right way, as reversing it could damage the cable.

If you are loading code from Arduino, just do so as you normally would. Read the information above for detailed instructions. If you wish to load basic .hex files (such as those created by AVRStudio), you can either use ArdUp, or AVRdude. For both of these, you will need to have the FTDI USB drivers installed. Make sure you get the VCP (virtual com port) drivers. If you have Arduino installed, then you are already set with the FTDI drivers, as they come with Arduino.

ArdUp is a windows interface that allows you to point and click your way to code uploading. The ArdUp program is free, but only works on the Windows operating system. You can get the program, and learn how to use it, from the smileymicros website.

If you would rather upload code from the command line, you can use AVRdude. First, you will need to install AVRdude. If you have installed Arduino, then you already have AVRdude, and you're ready to go. Then, just navigate to the directory your .hex file is in, and type the following magic phrase:

avrdude -p atmega3250 -c arduino -P COM3 -b 115200 -e -U flash:w:microdec.hex

where COM3 is replaced with the COM port that your MICrODEC is connected to, and microdec.hex is replaced with whatever file you want to upload. To find out which COM port your MICrODEC is connected to (on WINXP at least), go to System Properties -> Hardware -> Device Manger and click on Ports (COM & LPT). This will bring up a list of devices, one of which will be USB Serial Port (COMn), where n is your port number. The port number often changes when you replug in your FTDI cable, so you might have to search for it each time you use it.

MICrODEC Bootloader

If you want to place the bootloader on your MICrODEC, you will need to use the above files. Only the .hex file need be loaded, but the remainder will let you change and rebuild the bootloader to suit your needs, if they are different. To load the bootloader, and set the fuses, you will need to use the ISP or JTAG programming interface.

The fuse settings are as follows:

avrdude arguments: -U lfuse:w:0xff:m -U hfuse:w:0x9a:m -U efuse:w:0xf9:m -U lock:w:0xcf:m

MicrodecArduino (last edited 2012-06-30 00:46:27 by guest)