Zigbee Module Examples

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
zm_phy_spi.c File Reference

Physical Interface Layer to the Module using the Serial Peripheral Interface (SPI) port. This file acts as an interface between the module library methods and the hardware (hal file). More...

`#include "../HAL/hal.h"`
`#include "zm_phy_spi.h"`
`#include "module_errors.h"`
`#include <stdint.h>`

## Functions
void | zm_phy_init ()
uint8_t | moduleHasMessageWaiting ()
moduleResult_t | sendSreq ()
moduleResult_t | getMessage ()
moduleResult_t | sendMessage ()

## Variables
uint8_t | zmBuf [ZIGBEE_MODULE_BUFFER_SIZE]

## Detailed Description

Physical Interface Layer to the Module using the Serial Peripheral Interface (SPI) port. This file acts as an interface between the module library methods and the hardware (hal file).

Note:
  To output SPI transmit information, define ZM_PHY_SPI_VERBOSE. It is recommended to define this on a per-project basis. In IAR, this can be done in Project Options : C/C++ compiler : Preprocessor In the defined symbols box, add: ZM_PHY_SPI_VERBOSE

Normally the module is quite fast in responding to a SREQ and there is not sufficient time on a slower processor (e.g. < 25MHz) to configure a timeout to detect a missing response. If using a fast processor then define FAST_PROCESSOR. This does several things:

1. sendSreq() will timeout if a response was not received in time.
2. the amount of time spent in each part of the SREQ process is available in variables timeFromChipSelectToSrdyLow and timeWaitingForSrsp.

Rev:
  1642

Author:
  dsmith

Date:
  2012-10-31 11:17:04 -0700 (Wed, 31 Oct 2012)

# Support

Please refer to the wiki at www.anaren.com/air-wiki-zigbee for more information. Additional support is available via email at the following addresses:

- Questions on how to use the product: AIR@a.nosp@m.nare.nosp@m.n.com
- Feature requests, comments, and improvements: featu.nosp@m.rere.nosp@m.quest.nosp@m.s@te.nosp@m.slaco.nosp@m.ntro.nosp@m.ls.co.nosp@m.m
- Consulting engagements: sales.nosp@m.@tes.nosp@m.lacon.nosp@m.trol.nosp@m.s.com

# License

Copyright (c) 2012 Tesla Controls. All rights reserved. This Software may only be used with an Anaren A2530E24AZ1, A2530E24CZ1, A2530R24AZ1, or A2530R24CZ1 module. Redistribution and use in source and binary forms, with or without modification, are subject to the Software License Agreement in the file "anaren_eula.txt"

YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL ANAREN MICROWAVE OR TESLA CONTROLS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSE INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.

## Function Documentation

moduleResult_t getMessage | ( |  | ) |

Polls the Module for data. This is used to receive data from the Module, for example when a message has arrived. This will be initiated by detecting SRDY going low.

Precondition:
  Module has been initialized.
  SRDY has gone low

Postcondition:
  received data is written to zmBuf

Note:
  this method not required to be implemented when using UART interface.

uint8_t moduleHasMessageWaiting | ( |  | ) |

Whether the module has a message waiting to be retrieved.

Returns:
  true (1) if there is a complete message ready for processing, or 0 otherwise.

moduleResult_t sendMessage | ( |  | ) |

    Public method to send messages to the Module. This will send one message and then receive the

Synchronous Response (SRSP) message from the Module to indicate the command was received.

Precondition:
  zmBuf contains a properly formatted message
  Module has been initialized

Postcondition:
  buffer zmBuf contains the response (if any) from the Module.

moduleResult_t sendSreq | ( |  | ) |

Sends a Module Synchronous Request (SREQ) message and retrieves the response. A SREQ is a message to the Module that is immediately followed by a Synchronous Response (SRSP) message from the Module. As opposed to an Asynchronous Request (AREQ) message, which does not have a SRSP. This is a private method that gets wrapped by sendMessage() and spiPoll().

Precondition:
  Module has been initialized
  zmBuf contains a properly formatted message. No validation is done.

Postcondition:
  received data is written to zmBuf

Returns:
  if FAST_PROCESSOR is defined then MODULE_SUCCESS, else an error code. If FAST_PROCESSOR is not defined, then MODULE_SUCCESS.

## Variable Documentation

uint8_t zmBuf[ZIGBEE_MODULE_BUFFER_SIZE]

    This buffer will hold the transmitted messages and received SRSP Payload after sendMessage() was

called. If fragmentation support is not required then this can be smaller, e.g. 100B.