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 following library file, and place it in your Arduino fol
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. You will need to install AVRdude, which you can get here. If you have installed Arduino, then you already have AVRdude, and you're ready to go. 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.
If you want to place the bootloader on your MICrODEC, you will need to use the following 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:
- BOD level = 4.3V
- JTAG enabled
- ISP enabled
- BOOTSZ = 1024 words (2k)
- BOOTRST enabled
- EESAVE disabled
- SUT/CKSEL = external crystal, 8+ MHZ, 258CK + 65ms
LOCK BITS only set for SPM and LPM protection on bootload section
- FUSE XTEN = 0xF9
- FUSE HIGH = 0x9A
- FUSE LOW = 0xDE
- FUSE BOOT = 0xCF