Accessing WISP Hardware Features

There is a learning gap between the hardware schematic and the firmware. I know the WISP has xyz hardware features, but how do I use them?
Questions? - yeagerd yeagerd maintains this page.

This page is targeted at the WISP 4.1 DL hardware. The goal is to provide code snippets, links to full example code, and schematic excerpts to illustrate usage of WISP hardware functionality (like an App Note).

Basics


There is some common lingo and practices when using the MSP430.

1. "Drive" or "Set High/Low" a pin means set the pin direction to output.
To set P3.1 to an output pin: "P3DIR |= BIT1;"

2. "Set to input" or "Clear pin direction" means set the pin direction to input.
To set P3.1 to an input pin: "P3DIR &= ~BIT1;"

3. "Drive High" or "Set High" means set the output value to a logic 1.
To set P3.4 to output a logic 1 (after setting the direction): "P3OUT |= BIT4;"

4. "Drive Low" or "Clear" means set the output value to a logic 0.
To set P3.4 to output a logic 0 (after setting the direction): "P3OUT &= ~BIT4;"

5. "Sample" or "Test" a digital input on a pin
To test if the value of P2.4 is a logic 1 (after setting direction to input): " if ( P2IN & BIT4 ) { ... "
To test if the value of P2.4 is a logic 0 (after setting direction to input): " if ( ! ( P2IN & BIT4 ) ) { ... "

6. "Sample" an analog input signal on a pin
a. Turn off the input buffer on that pin
b. Configure ADC for correct input channel (INCH). INCH values are listed in WISP header file on the WISP 4.1 DL hardware page.
c. Start the sample and poll for ADC to complete, or configure ADC to generate an interrupt and wait for interrupt in a low power mode.

7. Instead of hard-coding references to particular pins, future proof your work and improve readability by using constants.
For example, LED_POWER is defined as BIT6. To turn on the led, "P1OUT |= LED_POWER;"

Hardware Details


LED

  • The LED is controlled by P1.6
  • Drive LED_POWER high on Port 1 to turn on LED. Drive LED_POWER low on Port 1 to turn off LED.

Internal Temperature Sensor


External Temperature Sensor

  • The external temp sensor power is enabled / disabled by P1.0, or TEMP_POWER on Port 1.
  • Drive TEMP_POWER high on Port 1. Wait for temperature sensor to settle. Sample INCH_TEMP_EXT_IN (P3.7).

Accelerometer

  • The accelerometer sensor power is enabled / disabled by P1.5, or ACCEL_POWER on Port 1.
  • Drive ACCEL_POWER high on Port 1. Wait for accelerometer to reach x% of final value (see WISP Code Examples).
Sample INCH_ACCEL_X, INCH_ACCEL_Y, INCH_ACCEL_Z (P2.0, 2.1, 2.2).

Rectified Voltage (Vout) Sensor

  • The external temp sensor power is enabled / disabled by P3.3, or VSENSE_POWER on Port 3.
  • Drive VSENSE_POWER high on Port 3. Wait for sensor to settle. Sample INCH_VSENSE_IN (P3.6).

Capacitance

  • Drive CAP_SENSE high on Port 1 (P1.7). Leave the output value logic 1, but change the CAP_SENSE to an input pin. With the DCO in the MHz range, measure the length of time required for CAP_SENSE to become in input 0 logic level.

EEPROM

  • External 1.8v non-volatile memory is included on the WISP. The code is here: EEPROM

Communication In/Out

  • To set the transmit line, set TX_PIN on Port 1. This is usually unnecessary - optimized assembly code transmits the data.
  • To sample the receive line, sample RX_PIN on Port 1. A better algorithm would wait for an interrupt on this pin, or just check the IFG to see if the pin toggled. This is usually unnecessary - optimized assembly code receives the data.

Connecting External Sensors

  • P2.3 is available (INCH_DEBUG_2_3). Connect to analog output of your sensor to this pin. Be sure to update the DRIVE_ALL_PINS macro in the pin definition file so your sensor output is not driven by the microcontroller pin.
  • P1.4 is available to power your sensor (DEBUG_1_4). Connect this to the supply of your sensor and enable/disable the sensor through firmware.

Connecting External Devices

  • The "B" channel of the USCI (I2C) is connected to the on-board EEPROM.
  • The "A" channel is unused (UART, I2C, SPI), which includes P3.0, P3.4 and P3.5.
  • For info on how to use, see TI Sample Code. There are links from WISP code examples

Communication In/Out


Voltage Supervisor

  • The voltage supervisor (SV) is connected to P2.4, or VOLTAGE_SV_PIN on Port 2.
  • The voltage supervisor allows the WISP to wait in LPM4 (very low power mode) until we have enough stored energy to some some useful task.


(Add your request here!)





The last modification was made by - yeagerd yeagerd on Mar 29, 2010 11:54 am