jueves, 12 de febrero de 2009

Arduinome phase 3: programming Arduino

Once the Hardware is completely done, the next step is to program the FTDI chip with the correct device name and the Arduino with the Arduinome firmware.

Programming the FTDI chip

The FTDI chip in arduino is the chip responsible for doing the USB connection between the PC and the microcontroller in the Arduino board. The idea of programming the FTDI chip with a different device name than the default is for the "Arduinome serial" application to recognize the device as an Arduinome. Follow these steps to program the FTDI chip:

  1. Download an install the D2XX drivers and the MProg application (in that order)
  2. Connect your arduino to the PC and run MProg.
  3. Select Device => Scan from the Menu. You should get a message like the following in the box bellow:

    Number Of Blank Devices = 0
    Number Of Programmed Devices = 1

  4. Select from the menu "Tools" => "Read and Parse".
  5. At this point I saved the configuration I did "File" => "save as". This is not really needed, but I did it just in case I happen to screw up later on, to be able to recover the original configuration.
  6. Check the “use fixed serial number” box and change the serial number value. Your board should have a serial with this shape: a40h-xxx (I'm using : a40h-des)
  7. Save the configuration ("File" => "save as")
  8. Once saved, program the FTDI by clicking on the flash icon (or doing "device" => "program").
  9. Unplug / plug back your board from the usb port.
  10. Download and install Arduinome serial.
  11. Run Arduinomeserial, you should see a device with the name you gave your arduinoe in step 6.

Programming the Arduinome Firmware
This step is quite simple if you have a relatively new Arduino board (the NGs with Atmega168, Diecimila, Duemilanove and any other newer boards). The steps to follow to program the arduinome firmware are the following:
  1. Download the latest arduino software (if you have not already).
  2. Follow the instructions from the Arduino website to figure out how to install and use the Arduino.
  3. Download the Arduinome firmware.
  4. Open the pde file in the arduinome firmware with the arduino application, verify and then "upload to the I/O board".
That's it!!! You can now connect your Arduino to the arduinome shield and the button pad, connect arduino to the PC, start Arduinome serial... and enjoy.

My particular case was not so easy... I was using an old arduino board, an NG with Atmega8 instead of Atmega168, which was not compatible with the available firmware. I could have just bought a preprogrammed Atmega168 for a few dollars, but that was too easy and would have taken a few more days to get my monome working, so I had to analyze the problem deeply and try to find a solution. The incompatibilities with the firmware were because the firmware was using TIMSK0, TIMSK1 and TIMSK2 registers to configure the timers and those registers are not available in Atmega8, the Atmega8 uses only the register TIMSK instead. After reading through the datasheets of both the Atmega8 and the Atmega168, I found the solution. Here you can find my modified version of the firmware, supporting both the newer board (with Atmega168) and the older NGs (with the Atmega8).

So I had the arduino ready to be used. I plugged it in and unfortunately my 74164 was connected backwards in the socket (ouch) and nothing was working. The 74164 got damaged and when plugged it correctly, each button press was being detected as if the whole line of buttons were pressed. Replacing the 74164 fixed this issue. LEDs were working correctly at first try, except for some (7) of the LEDs that apparently got burned when soldering them. I had to remove the damaged LEDs and solder new ones.

And that's it, that is how I got my arduinome working!!!
The next step is to do the enclosure for the arduinome, which I still need to figure how, although I already have some ideas.

I will have a video soon (whenever I manage to improve my "monoming" skills).

Check out the whole Arduinome build log here.

No hay comentarios: