Prototype RF driver for STM Sub-1 GHz RF expansion board based on the SPSGRF-868 module for STM32 Nucleo.

Prototype RF Driver for STM Sub-1 GHz RF Expansion Boards based on the SPSGRF-868 and SPSGRF-915 Modules for STM32 Nucleo

Currently supported boards:

Note, in order to use expansion board X-NUCLEO-IDS01A4 in mbed you need to perform the following HW modifications on the board:

  • Unmount resistor R4
  • Mount resistor R7

Furthermore, on some Nucleo development boards (e.g. the NUCLEO_F429ZI), in order to be able to use Ethernet together with these Sub-1 GHz RF expansion boards, you need to compile this driver with macro SPIRIT1_SPI_MOSI=PB_5 defined, while the development board typically requires some HW modification as e.g. described here!

This driver can be used together with the 6LoWPAN stack (a.k.a. Nanostack).

Committer:
Wolfgang Betz
Date:
Thu Jul 06 11:13:31 2017 +0200
Revision:
67:93bec0baf1de
Parent:
45:2d01cc9bc761
Clarify some comments

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wolfgang Betz 67:93bec0baf1de 1 /*
Wolfgang Betz 67:93bec0baf1de 2 * Copyright (c) 2012, STMicroelectronics.
Wolfgang Betz 67:93bec0baf1de 3 * All rights reserved.
Wolfgang Betz 67:93bec0baf1de 4 *
Wolfgang Betz 67:93bec0baf1de 5 * Redistribution and use in source and binary forms, with or without
Wolfgang Betz 67:93bec0baf1de 6 * modification, are permitted provided that the following conditions
Wolfgang Betz 67:93bec0baf1de 7 * are met:
Wolfgang Betz 67:93bec0baf1de 8 * 1. Redistributions of source code must retain the above copyright
Wolfgang Betz 67:93bec0baf1de 9 * notice, this list of conditions and the following disclaimer.
Wolfgang Betz 67:93bec0baf1de 10 * 2. Redistributions in binary form must reproduce the above copyright
Wolfgang Betz 67:93bec0baf1de 11 * notice, this list of conditions and the following disclaimer in the
Wolfgang Betz 67:93bec0baf1de 12 * documentation and/or other materials provided with the distribution.
Wolfgang Betz 67:93bec0baf1de 13 * 3. Neither the name of the Institute nor the names of its contributors
Wolfgang Betz 67:93bec0baf1de 14 * may be used to endorse or promote products derived from this software
Wolfgang Betz 67:93bec0baf1de 15 * without specific prior written permission.
Wolfgang Betz 67:93bec0baf1de 16 *
Wolfgang Betz 67:93bec0baf1de 17 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
Wolfgang Betz 67:93bec0baf1de 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Wolfgang Betz 67:93bec0baf1de 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Wolfgang Betz 67:93bec0baf1de 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
Wolfgang Betz 67:93bec0baf1de 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Wolfgang Betz 67:93bec0baf1de 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
Wolfgang Betz 67:93bec0baf1de 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
Wolfgang Betz 67:93bec0baf1de 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
Wolfgang Betz 67:93bec0baf1de 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
Wolfgang Betz 67:93bec0baf1de 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
Wolfgang Betz 67:93bec0baf1de 27 * SUCH DAMAGE.
Wolfgang Betz 67:93bec0baf1de 28 *
Wolfgang Betz 67:93bec0baf1de 29 * This file is part of the Contiki operating system.
Wolfgang Betz 67:93bec0baf1de 30 *
Wolfgang Betz 67:93bec0baf1de 31 */
Wolfgang Betz 67:93bec0baf1de 32 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 33 #ifndef __SPIRIT1_CONFIG_H__
Wolfgang Betz 67:93bec0baf1de 34 #define __SPIRIT1_CONFIG_H__
Wolfgang Betz 67:93bec0baf1de 35 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 36 #include "radio.h"
Wolfgang Betz 67:93bec0baf1de 37 #include "SPIRIT_Config.h"
Wolfgang Betz 67:93bec0baf1de 38 #include "spirit1-const.h"
Wolfgang Betz 67:93bec0baf1de 39 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 40 #define CCA_THRESHOLD -98.0 /* dBm */
Wolfgang Betz 67:93bec0baf1de 41 #define XTAL_FREQUENCY 50000000 /* Hz */
Wolfgang Betz 67:93bec0baf1de 42 #define SPIRIT_MAX_FIFO_LEN (96) // betzw - WAS: 600
Wolfgang Betz 67:93bec0baf1de 43 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 44
Wolfgang Betz 67:93bec0baf1de 45 /* Sometimes Spirit1 seems to NOT deliver (correctly) the 'IRQ_RX_DATA_READY'
Wolfgang Betz 67:93bec0baf1de 46 * event for packets which have a length which is close to a multiple of
Wolfgang Betz 67:93bec0baf1de 47 * RX FIFO size. Furthermore, in these cases also the content delivery seems
Wolfgang Betz 67:93bec0baf1de 48 * to be compromised as well as the generation of RX/TX FIFO errors.
Wolfgang Betz 67:93bec0baf1de 49 * This can be avoided by reducing the maximum packet length to a value which
Wolfgang Betz 67:93bec0baf1de 50 * is lower than the RX FIFO size.
Wolfgang Betz 67:93bec0baf1de 51 *
Wolfgang Betz 67:93bec0baf1de 52 * Enable beyond macro if you want to use the version of the driver which avoids
Wolfgang Betz 67:93bec0baf1de 53 * FIFO overflows by reducing packet length.
Wolfgang Betz 67:93bec0baf1de 54 *
Wolfgang Betz 67:93bec0baf1de 55 * NOTE: the non delivery of event 'IRQ_RX_DATA_READY' MUST still be
Wolfgang Betz 67:93bec0baf1de 56 * investigated further deeply (both on HW & SW level)!
Wolfgang Betz 67:93bec0baf1de 57 */
Wolfgang Betz 67:93bec0baf1de 58 #define RX_FIFO_THR_WA
Wolfgang Betz 67:93bec0baf1de 59
Wolfgang Betz 67:93bec0baf1de 60 /**
Wolfgang Betz 67:93bec0baf1de 61 * The MAX_PACKET_LEN is an arbitrary value used to define the two array
Wolfgang Betz 67:93bec0baf1de 62 * spirit_txbuf and spirit_rxbuf.
Wolfgang Betz 67:93bec0baf1de 63 * The SPIRIT1 supports with its packet handler a length of 65,535 bytes,
Wolfgang Betz 67:93bec0baf1de 64 * and in direct mode (without packet handler) there is no limit of data.
Wolfgang Betz 67:93bec0baf1de 65 */
Wolfgang Betz 67:93bec0baf1de 66 #ifdef RX_FIFO_THR_WA
Wolfgang Betz 67:93bec0baf1de 67 #define MAX_PACKET_LEN (SPIRIT_MAX_FIFO_LEN-1)
Wolfgang Betz 67:93bec0baf1de 68 #else
Wolfgang Betz 67:93bec0baf1de 69 #define MAX_PACKET_LEN (255) // betzw - WAS: SPIRIT_MAX_FIFO_LEN, but LEN_WIDTH is set to 7 so the variable payload length is theoretically from 0 to 255 bytes
Wolfgang Betz 67:93bec0baf1de 70 #endif
Wolfgang Betz 67:93bec0baf1de 71
Wolfgang Betz 67:93bec0baf1de 72 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 73 /**
Wolfgang Betz 67:93bec0baf1de 74 * Spirit1 IC version
Wolfgang Betz 67:93bec0baf1de 75 */
Wolfgang Betz 67:93bec0baf1de 76 #define SPIRIT1_VERSION SPIRIT_VERSION_3_0
Wolfgang Betz 67:93bec0baf1de 77 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 78 #endif /* __SPIRIT1_CONFIG_H__ */
Wolfgang Betz 67:93bec0baf1de 79 /*---------------------------------------------------------------------------*/