Avisaro Online Documentation - Wiki
Impressum Kontakt Sitemap

SPI Interface

The SPI interface is the fastest interface of the Avisaro 2.0 module. It is designed to be connected to a micro controller or to programmable logic (FPGA). When connected to a micro controller we recommend to use the 'packet interface' (see details later), when connected to a FPGA, the simpler 'streaming modus' can be used. The SPI interface is not the default interface when shipped or when module was reseted to factory defaults.

SPI bus timing

The SPI bus timing is controlled by two parameters: clock polarity and clock phase. This is how those parameters effect bus timing:

CPOL and CPHA settings First data driven Other data driven Data sampled
CPOL = 0, CPHA = 0 Prior to first SCK rising edge SCK falling edge SCK rising edge
CPOL = 0, CPHA = 1 First SCK rising edge SCK rising edge SCK falling edge
CPOL = 1, CPHA = 0 Prior to first SCK falling edge SCK rising edge SCK falling edge
CPOL = 1, CPHA = 1 First SCK falling edge SCK falling edge SCK rising edge

See the following timing diagrams for details (click to enlarge):

SPI default settings

  • The SPI bus is using 8 bit words.
  • Maximum SCK clock is 10 MHz. The effective data rate depends on the type of application.
  • The bus select (CS) is active low. It is recommended to deactivate the CS between data block in case clock glitches occured.

'Fill-bytes'

With each byte which is send to the Avisaro Module, one byte is also received (... which is true for all SPI interfaces). If there is no valid data to be send either direction, a hex 0xFF is send.
  

Using SPI Interface

The SPI interface is designed to connect the Avisaro WLAN Module or Avisaro Logger Module to a Micro Controller.

See Mehr here for a general describtion on how to configure Avisaro 2.0 products.

Website

Use the following web site entries to control the SPI interface

  • SPI: Set spi interface parameter. Mehr more
  • general: Select spi as active interface. Mehr more  

Command interface

Use the following command to control the spi interface

  • spi: Sets SPI parameter. Mehr more. Notice that in order to use the command interface, the interface must work in the first place. In most case, this command is used in the 'autorun.txt' configuration file.   
  • prot: Select SPI as active interface. Mehr more    

Once configured, one can send text commands or packet commands:

  • Text commands: Send ASCII values of the commands just as one would send them over a RS232 connection. Finish each command with "carrige return and line feed" (0x0D, 0x0A). See Mehr here for ASCII table.  For each character clocked in, a 0xFF will be send from the Avisaro Module.

    To read the command answer, keep on sending 'dummy bytes' (0xFF). After a view milliseconds, the Avisaro Module will answer with ASCII characters followed by the carrige return and line feed. If no more data are to be send, only 0xFF are received.   
  • Packet interface: The packet interface is usually the more suitable interface to work with the SPI interface. See Mehr here  for details on the packet interface. Notice: Since a start and end of a packet is well defined, it is unambiguous whether a 0xFF byte is a valid byte or whether it is a fill-byte.

BASIC scripting

Use the following BASIC commands to control and access the SPI interface

Examples

Wireless SPI data

The Script WR1 (Mehr more) can also be used for SPI:

  • Configure Avisaro Modul to use SPI as data interface.
  • Load the script WR1.
  • Use micro controller to send data through SPI. All data will be transfered wirelessly to and from the Avisaro Module.