Contiki 2.6

RZRAVEN LCD 3290p

Modules

 LCD Functions and data

Detailed Description

raven3290p.jpg

LCD Introduction

This Raven LCD Driver application software was designed for a user interface to the Contiki 6LoWPAN collaboration on board the ATmega3290p. The LCD functionality uses the binary command set described in the release notes. These binary commands can also be found in a list of main.h.

Compiling Raven LCD Driver

The Raven LCD Driver is located in /platforms/avr-ravenlcd but it is not a contiki platform. $make TARGET=avr-ravenlcd will not work! Build it using the AVR Studio project and WinAVR or in Linux/Windows cmd/Cygwin $make in that directory. The AVR Studio dependency folder will confuse additional makes, use $make CYG=1 to bypass /dep creation or do $rm -R dep as needed. The .h file dependencies will be lost, so also $make CYG=1 clean after modifying any of those.

Board fuse settings

The Raven LCD (3290p device) requires the proper fuse settings to function properly. They are automatically set when flashing the .elf file. When using a .hex file set them manually:

  1. Raven LCD (3290p device)
    1. Extended: 0xFF (No Brown Out)
    2. High: 0x99 (JTAG and ISP enabled, No OCDEN or EEPROM saving required)
    3. Low: 0xE2 (Use Int RC OSC - Start-up Time:6CK + 65ms)

Operation Release Notes

After programming the Raven LCD 3290p with the proper image, you will be introduced to the menu in the picture below:

contiki_menu_3290.jpg

Operating the menu requires that the matching command set has been programmed into the ATmega1284 application. This will allow the menu to communicate properly and control the Contiki 6LoWPAN applcation on the 1284p.

During normal operation, you will need to make note of these IMPORTANT operating instructions:

  1. Temp Sensor - The temperature sensor shares the same GPIO as the JTAG interface for the 3290p. This requires the JTAG feature to be disabled in order to have proper temperature readings.
  2. Debug Menu - The DEBUG menu setting is used to configure this JTAG feature.
    1. If the JTAG feature is enabled during a temperature reading attempt, the menu will signal a caution symbol to the user letting them know the JTAG feature needs to be disabled.
      caution.gif
    2. The JTAG header may also need to be physically disconnected from any external programming/debugging device in order to obtain correct temperature readings.
    3. The software will disable JTAG in sleep/doze modes. If the JTAG connection fails during reprogramming with AVR Studio, "try again with external reset" to recover.
  3. Temp Data - Once the temperature reading is proper, the user can send this reading to the webserver for Sensor Reading Data (Once or Auto). The webserver will only update the html data when refreshed.
  4. EXT_SUPL_SIG - This signal connects the external supply voltage to ADC2 through a divider. Enabling MEASURE_ADC2 in temp.h causes it to be sampled and sent to the 1284p along with the temperature.

More information about the operation of the Raven with Contiki can be found in the contikiwiki at http://www.sics.se/~adam/wiki/index.php/Avr_Raven.

See also:
http://www.sics.se/contiki/tutorials/tutorial-running-contiki-with-uipv6-and-sicslowpan-support-on-the-atmel-raven.html

Binary Command Description

Using the binary commmand list described in main.h, the 3290p will contruct a binary command serial frame to control the 1284p. An example command frame is contructed below:

  1. 0x01,0x01,0x81,0x01,0x04 - Send Ping Request number 1 to 1284p
    1. 0x01 - Start of binary command frame
    2. 0x01 - Length of binary command payload
    3. 0x81 - Binary command SEND_PING
    4. 0x01 - Payload value (eg. ping Request number 1)
    5. 0x04 - End of binary command frame

The following commands are sent to the 1284p.

  1. SEND_TEMP - (0x80)
  2. SEND_PING - (0x81)
  3. SEND_ADC2 - (0x82)
  4. SEND_SLEEP- (0x83)
  5. SEND_WAKE - (0x84)

The following commands are received from the 1284p.

  1. REPORT_PING - (0xC0)
  2. REPORT_PING_BEEP - (0xC1)
  3. REPORT_TEXT_MSG - (0xC2)
  4. REPORT_WAKE - (0xC3)

Sleep and Doze

  1. The Raven draws 27 milliamps when the 3290p and 1284p are both running and the RF230 in receive mode.
  2. Sleeping the 3290p and LCD display drops this to 21 ma with no loss in contiki functionality.
  3. The RF230 radio draws 15.5/16.5/7.8/1.5/0.02 ma in Rx/Tx/PLL_ON/TRX_OFF/SLEEP states. It is controlled by contiki on the 1284p according to the selected MAC power protocols to obtain the bulk of power savings; however the 3290p menu can tell it to sleep unconditionally or in a doze cycle.
  4. Unconditional SLEEP requires pushing the joystick button for wakeup. Once awake the 3290p sends SEND_WAKE commands to the 1284p until it responds with a REPORT_WAKE. "WAIT 1284p" is displayed during this time. Current draw is 40 microamps.
  5. As configured, doze sleeps the 3290p for 5 seconds after telling 1284p to sleep for 4 seconds. The 3290p wakes briefly to send temperature and voltage to the 1284p (which should be awake at this time), then tells it to sleep again. Thus the 1284p will be active 20% of the time, although it may ignore the command to sleep if there are active TCP connections. The 3290p energy usage is essentially zero in this mode; total savings will depend on actual 1284p wake time and radio usage. Alter the timings as desired, or comment out the 1284p sleep command to shut down only the 3290p in doze mode.