welcome: please sign in
location: Diff for "MicrodecArduino"
Differences between revisions 22 and 23
Revision 22 as of 2011-08-12 00:45:01
Size: 5300
Editor: guest
Comment:
Revision 23 as of 2011-08-12 22:35:03
Size: 5540
Editor: guest
Comment:
Deletions are marked like this. Additions are marked like this.
Line 19: Line 19:
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. The rest is up to you! 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.

MICrODEC

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:

\arduino-0022\hardware\arduino\boards.txt

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:

  • BOD level = 4.3V
  • RSTDISBL not set

  • OCDEN not set

  • JTAGEN set
  • SPIEN set
  • WTDON not set

  • BOOTSZ = 1024 words (2k)
  • BOOTRST set
  • CKDIV8 not set

  • CKOUT not set

  • EESAVE not set

  • 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

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