TStik
App Note: SPI
TINI400 in the familiar
SIMM72 module
package

TStik is powered by Dallas Semiconductor TINI


Tstik SPI App Note

This app note will help you begin to use Spi on Tstik.


Required Files:
Current TStik API download

Includes SPI support

Tini SDK You will need the ability to compile Java code and build Tini executables.

Contents:
Hardware Explains the basic Serial Peripheral Interface hardware specification.
TStik SPI API Explains the functions of the Systronix SPI libarary.

SPI Hardware

SPI is an acronym for Serial Peripheral Interface. It is a clocked interface that transfers data one bit at a time (Serially). There are four signals needed in a SPI port.

  • MISO: Master in Slave out. This signal is the serial input bit to TStik.
  • MOSI: Master out Slave in. This signal is the serial output bit from TStik.
  • CS: Chip select. There are five chip selects on TStik:
    1. Configuration Register: This is the internal TStik configuration register. It is documented in the Hello TStik app note.
    2. SCS0: SPI Chip select zero is pin1 on the JSimm bus. It can be used to interface user spi devices to TStik.
    3. SCS1: SPI Chip select 1 is pin 2 on the JSimm bus. It can be used to interface user spi devices to TStik.
    4. SCS2: SPI Chip select 2 is wired to the JSimm SPI register on the TILT 400 pro board. This register is output only and is used to set the voltage levels on pins 15 through 19 on the JSimm bus.
    5. SCS3: SPI Chip select 3 is pin 3 on the JSimm bus. It can be used to interface user spi devices to TStik.
  • SCLK: SPI Clock is used to clock the SPI interface. See the javadocs included in the doc directory is the SPI.zip file for information on the different SPI modes.

TStik SPI API

The attached SPI example program is used to write to the TILT 400 JSimm spi register. This register is a simple 8 bit spi device and is typical of most spi peripherals. The SPI library contains five methods to write to various kinds of spi devices including:

  • xmitSPI_config: Used only to write to the TStik configuration register.
  • xmitSPI_mode_a: Used to write to the TILT 400 JSimm spi register and read/write other mode a devices
  • xmitSPI_mode_b: Used to read/write mode b spi devices.
  • xmitSPI_mode_c: Used to read/write mode c spi devices.
  • xmitSPI_mode_d: Used to read/write mode d spi devices.
To use this Spi api, simply used the tini_dep_systronix.txt file included in the Spi.zip file and include the SpiFast dependancy in your dependancy list. An example build.xml for use with Tini Ant is included.
The Java interface to this library is the com.systronix.spi.SlaveDriver wrapper class. It contains the static methods listed above so it can be called from user code.

Example Code Notes:

See the Hello TStik app note which access the TStik Configuration Register, which has a write/read SPI interface. Also there is now (1.17c) a TestSpi class included in the TStik API which exercises all SPI modes.

Future versions of the Spi app note may use the Systronix cross-platform spi library to make your Spi code portable between JStamp, JStik and TStik.

 

 
Systronix® 939 Edison Street, Salt Lake City, Utah, USA 84111
contact us
 

Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
Systronix is independent of Sun Microsystems, Inc.
TStik, JStik, JCX, JStamp, JSimm, JDroid, and JRealTime are trademarks of Systronix, Inc.
1-Wire, iButton and TINI are trademarks of Dallas Semiconductor
Simmstick is a trademark of Dontronics