Thursday, October 29, 2009

Testing Duino644 - RTC and EEPROM

With the Duino644 kit assembled, we can now start testing it.
First, plug the USB cable in the USB miniB onboard connector and make sure the blue LED is lighting.
Alternatively, plug in the FTDI connector (or "FTDI basic breakout"), making sure that the USB (power-only) cable is unplugged. Unlike Wiseduino board, Duino644 is powered by the 5V FTDI pin. Blue LED should be on.


Before uploading any sketch to Duino644, we need to install the Sanguino libraries. (Remember that Duino644 is compatible with Sanguino.) At the end of the integration we will see Sanguino listed in the Tools/Board menu of the Arduino IDE. This is the board that must be selected when working with Duino644.

Before proceeding further, we need to modify boards.txt file, specifically the "Sanguino" section, to look like this:

sanguino.name=Sanguino
sanguino.upload.protocol=stk500
sanguino.upload.maximum_size=63488
sanguino.upload.speed=38400
sanguino.bootloader.low_fuses=0xFF
sanguino.bootloader.high_fuses=0xDC
sanguino.bootloader.extended_fuses=0xFD
sanguino.bootloader.path=atmega644
#sanguino.bootloader.path=atmega644p
sanguino.bootloader.file=ATmegaBOOT_644.hex
#sanguino.bootloader.file=ATmegaBOOT_644P.hex
sanguino.bootloader.unlock_bits=0x3F
sanguino.bootloader.lock_bits=0x0F
sanguino.build.mcu=atmega644
#sanguino.build.mcu=atmega644p
sanguino.build.f_cpu=16000000L
sanguino.build.core=sanguino
sanguino.verbose=false

This is because Duino644 comes with ATmega644 instead of Sanguino's ATmega644P. The difference between the two processors is a second UART in ATmega644P.
(Note: Future revisions may ship with ATmega644P, although the extra functionality is not required nor used in Wise Clock 2.)

Using the FTDI cable, upload the first sketch, the one that sets the real time clock.
(Note: This is just for testing the RTC, since the clock itself can be set using the method described here).

If you feel adventurous you can start directly with the main sketch. It should work, unless you skipped a step or two (forgot to insert the DS1307 chip in the socket, for example) .

Download this file and unzip it in the hardware/libraries folder of your Arduino IDE.
It contains rtc.pde sketch and DS1307 class (header and cpp files).

To set the clock, un-comment the portion of the code in setup(), upload the sketch and run it once. To avoid setting up the same time at every reset and power-up, modify the sketch by commenting out the setup() portion, then upload it again. Now, the board will just send back the time from RTC on serial port.

Testing the EEPROM is done similarly with Wise Clock and detailed here.
(Note: The Wise Clock 2 functionality does not use the EEPROM so far. In the "glass dome" Wise Clock, the quotations were stored in EEPROM, there was no SD card.)

If everything works fine so far, let's take the big jump and load the sketch for Wise Clock 2, which reads the SD card and displays the content of quotes.txt file onto the LED display.

So, next step is the last, and most important, one: uploading the main sketch.

No comments:

Post a Comment