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 Jan 18 15:07:23 2018 +0100
Revision:
77:a9a9807bf3ed
Parent:
67:93bec0baf1de
Merge pull request #3 from SeppoTakalo/skip

Skip compilation if FEATURE_NANOSTACK is not enabled

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wolfgang Betz 67:93bec0baf1de 1 /**
Wolfgang Betz 67:93bec0baf1de 2 ******************************************************************************
Wolfgang Betz 67:93bec0baf1de 3 * @file platform/stm32nucleo-spirit1/platform-conf.h
Wolfgang Betz 67:93bec0baf1de 4 * @author System LAB
Wolfgang Betz 67:93bec0baf1de 5 * @version V1.0.0
Wolfgang Betz 67:93bec0baf1de 6 * @date 17-May-2015
Wolfgang Betz 67:93bec0baf1de 7 * @brief Configuration parameters
Wolfgang Betz 67:93bec0baf1de 8 ******************************************************************************
Wolfgang Betz 67:93bec0baf1de 9 * @attention
Wolfgang Betz 67:93bec0baf1de 10 *
Wolfgang Betz 67:93bec0baf1de 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Wolfgang Betz 67:93bec0baf1de 12 *
Wolfgang Betz 67:93bec0baf1de 13 * Redistribution and use in source and binary forms, with or without modification,
Wolfgang Betz 67:93bec0baf1de 14 * are permitted provided that the following conditions are met:
Wolfgang Betz 67:93bec0baf1de 15 * 1. Redistributions of source code must retain the above copyright notice,
Wolfgang Betz 67:93bec0baf1de 16 * this list of conditions and the following disclaimer.
Wolfgang Betz 67:93bec0baf1de 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Wolfgang Betz 67:93bec0baf1de 18 * this list of conditions and the following disclaimer in the documentation
Wolfgang Betz 67:93bec0baf1de 19 * and/or other materials provided with the distribution.
Wolfgang Betz 67:93bec0baf1de 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Wolfgang Betz 67:93bec0baf1de 21 * may be used to endorse or promote products derived from this software
Wolfgang Betz 67:93bec0baf1de 22 * without specific prior written permission.
Wolfgang Betz 67:93bec0baf1de 23 *
Wolfgang Betz 67:93bec0baf1de 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Wolfgang Betz 67:93bec0baf1de 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Wolfgang Betz 67:93bec0baf1de 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Wolfgang Betz 67:93bec0baf1de 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Wolfgang Betz 67:93bec0baf1de 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Wolfgang Betz 67:93bec0baf1de 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Wolfgang Betz 67:93bec0baf1de 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Wolfgang Betz 67:93bec0baf1de 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Wolfgang Betz 67:93bec0baf1de 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Wolfgang Betz 67:93bec0baf1de 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Wolfgang Betz 67:93bec0baf1de 34 *
Wolfgang Betz 67:93bec0baf1de 35 ******************************************************************************
Wolfgang Betz 67:93bec0baf1de 36 */
Wolfgang Betz 67:93bec0baf1de 37 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 38 /**
Wolfgang Betz 67:93bec0baf1de 39 * \addtogroup stm32nucleo-spirit1
Wolfgang Betz 67:93bec0baf1de 40 * @{
Wolfgang Betz 67:93bec0baf1de 41 *
Wolfgang Betz 67:93bec0baf1de 42 * \defgroup stm32nucleo-spirit1-peripherals User Button on STM32 Nucleo
Wolfgang Betz 67:93bec0baf1de 43 *
Wolfgang Betz 67:93bec0baf1de 44 * Defines some of the platforms capabilities
Wolfgang Betz 67:93bec0baf1de 45 * @{
Wolfgang Betz 67:93bec0baf1de 46 *
Wolfgang Betz 67:93bec0baf1de 47 * \file
Wolfgang Betz 67:93bec0baf1de 48 * Header file for the stm32nucleo-spirit1 platform configuration
Wolfgang Betz 67:93bec0baf1de 49 */
Wolfgang Betz 67:93bec0baf1de 50 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 51 #ifndef __PLATFORM_CONF_H__
Wolfgang Betz 67:93bec0baf1de 52 #define __PLATFORM_CONF_H__
Wolfgang Betz 67:93bec0baf1de 53 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 54 #ifdef USE_STM32L1XX_NUCLEO
Wolfgang Betz 67:93bec0baf1de 55 #include <inttypes.h>
Wolfgang Betz 67:93bec0baf1de 56 #include <string.h>
Wolfgang Betz 67:93bec0baf1de 57 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 58 #define PLATFORM_HAS_LEDS 1
Wolfgang Betz 67:93bec0baf1de 59 #define PLATFORM_HAS_BUTTON 1
Wolfgang Betz 67:93bec0baf1de 60 #define PLATFORM_HAS_RADIO 1
Wolfgang Betz 67:93bec0baf1de 61
Wolfgang Betz 67:93bec0baf1de 62 #define LEDS_GREEN 1 /*Nucleo LED*/
Wolfgang Betz 67:93bec0baf1de 63 #define LEDS_RED 2 /*SPIRIT1 LED*/
Wolfgang Betz 67:93bec0baf1de 64
Wolfgang Betz 67:93bec0baf1de 65 #ifdef COMPILE_SENSORS
Wolfgang Betz 67:93bec0baf1de 66 #define LEDS_CONF_ALL 1 /*Can't use SPIRIT1 LED in this case*/
Wolfgang Betz 67:93bec0baf1de 67 #else
Wolfgang Betz 67:93bec0baf1de 68 #define LEDS_CONF_ALL 3 /*No sensors -> we can use SPIRIT1 LED in this case*/
Wolfgang Betz 67:93bec0baf1de 69 #endif /*COMPILE_SENSORS*/
Wolfgang Betz 67:93bec0baf1de 70 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 71 #define F_CPU 32000000ul
Wolfgang Betz 67:93bec0baf1de 72 #define RTIMER_ARCH_SECOND 32768
Wolfgang Betz 67:93bec0baf1de 73 #define PRESCALER ((F_CPU / (RTIMER_ARCH_SECOND*2)))
Wolfgang Betz 67:93bec0baf1de 74
Wolfgang Betz 67:93bec0baf1de 75 #define UART1_CONF_TX_WITH_INTERRUPT 0
Wolfgang Betz 67:93bec0baf1de 76 #define WITH_SERIAL_LINE_INPUT 1
Wolfgang Betz 67:93bec0baf1de 77 #define TELNETD_CONF_NUMLINES 6
Wolfgang Betz 67:93bec0baf1de 78 #define NETSTACK_CONF_RADIO spirit_radio_driver
Wolfgang Betz 67:93bec0baf1de 79 #define NETSTACK_RADIO_MAX_PAYLOAD_LEN 96 /* spirit1-config.h */
Wolfgang Betz 67:93bec0baf1de 80
Wolfgang Betz 67:93bec0baf1de 81 #if WITH_IP64
Wolfgang Betz 67:93bec0baf1de 82 #include "ip64-conf.h"
Wolfgang Betz 67:93bec0baf1de 83 #define WITH_SLIP 1
Wolfgang Betz 67:93bec0baf1de 84 #ifndef UIP_FALLBACK_INTERFACE
Wolfgang Betz 67:93bec0baf1de 85 #define UIP_FALLBACK_INTERFACE ip64_uip_fallback_interface
Wolfgang Betz 67:93bec0baf1de 86 #endif
Wolfgang Betz 67:93bec0baf1de 87 #endif /* WITH_IP64 */
Wolfgang Betz 67:93bec0baf1de 88
Wolfgang Betz 67:93bec0baf1de 89 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 90 /* define ticks/second for slow and fast clocks. Notice that these should be a
Wolfgang Betz 67:93bec0baf1de 91 power of two, eg 64,128,256,512 etc, for efficiency as POT's can be optimized
Wolfgang Betz 67:93bec0baf1de 92 well. */
Wolfgang Betz 67:93bec0baf1de 93 #define CLOCK_CONF_SECOND 128
Wolfgang Betz 67:93bec0baf1de 94 #define RELOAD_VALUE ((F_CPU/CLOCK_CONF_SECOND) - 1)
Wolfgang Betz 67:93bec0baf1de 95 /* One tick: 62.5 ms */
Wolfgang Betz 67:93bec0baf1de 96
Wolfgang Betz 67:93bec0baf1de 97 #define RTIMER_CLOCK_LT(a,b) ((signed short)((a)-(b)) < 0)
Wolfgang Betz 67:93bec0baf1de 98 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 99 typedef unsigned long clock_time_t;
Wolfgang Betz 67:93bec0baf1de 100 typedef unsigned long long rtimer_clock_t;
Wolfgang Betz 67:93bec0baf1de 101 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 102 #define CC_CONF_REGISTER_ARGS 0
Wolfgang Betz 67:93bec0baf1de 103 #define CC_CONF_FUNCTION_POINTER_ARGS 1
Wolfgang Betz 67:93bec0baf1de 104 #define CC_CONF_FASTCALL
Wolfgang Betz 67:93bec0baf1de 105 #define CC_CONF_VA_ARGS 1
Wolfgang Betz 67:93bec0baf1de 106 #define CC_CONF_INLINE inline
Wolfgang Betz 67:93bec0baf1de 107
Wolfgang Betz 67:93bec0baf1de 108 #define CCIF
Wolfgang Betz 67:93bec0baf1de 109 #define CLIF
Wolfgang Betz 67:93bec0baf1de 110 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 111 typedef uint8_t u8_t;
Wolfgang Betz 67:93bec0baf1de 112 typedef uint16_t u16_t;
Wolfgang Betz 67:93bec0baf1de 113 typedef uint32_t u32_t;
Wolfgang Betz 67:93bec0baf1de 114 typedef int32_t s32_t;
Wolfgang Betz 67:93bec0baf1de 115 typedef unsigned short uip_stats_t;
Wolfgang Betz 67:93bec0baf1de 116 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 117 #define MULTICHAN_CONF_SET_CHANNEL(x)
Wolfgang Betz 67:93bec0baf1de 118 #define MULTICHAN_CONF_READ_RSSI(x) 0
Wolfgang Betz 67:93bec0baf1de 119 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 120 #endif//USE_STM32L1XX_NUCLEO
Wolfgang Betz 67:93bec0baf1de 121
Wolfgang Betz 67:93bec0baf1de 122 #ifdef USE_STM32F4XX_NUCLEO
Wolfgang Betz 67:93bec0baf1de 123 #include <inttypes.h>
Wolfgang Betz 67:93bec0baf1de 124 #include <string.h>
Wolfgang Betz 67:93bec0baf1de 125 #include "main.h"
Wolfgang Betz 67:93bec0baf1de 126 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 127 #define PLATFORM_HAS_LEDS 1
Wolfgang Betz 67:93bec0baf1de 128 #define PLATFORM_HAS_BUTTON 1
Wolfgang Betz 67:93bec0baf1de 129 #define PLATFORM_HAS_RADIO 1
Wolfgang Betz 67:93bec0baf1de 130
Wolfgang Betz 67:93bec0baf1de 131 #define LEDS_GREEN 1 /*Nucleo LED*/
Wolfgang Betz 67:93bec0baf1de 132 #define LEDS_RED 2 /*SPIRIT1 LED*/
Wolfgang Betz 67:93bec0baf1de 133
Wolfgang Betz 67:93bec0baf1de 134 #ifdef COMPILE_SENSORS
Wolfgang Betz 67:93bec0baf1de 135 #define LEDS_CONF_ALL 1 /*Can't use SPIRIT1 LED in this case*/
Wolfgang Betz 67:93bec0baf1de 136 #else
Wolfgang Betz 67:93bec0baf1de 137 #define LEDS_CONF_ALL 3 /*No sensors -> we can use SPIRIT1 LED in this case*/
Wolfgang Betz 67:93bec0baf1de 138 #endif /*COMPILE_SENSORS*/
Wolfgang Betz 67:93bec0baf1de 139 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 140 #define F_CPU 84000000ul
Wolfgang Betz 67:93bec0baf1de 141 #define RTIMER_ARCH_SECOND 96000//32678
Wolfgang Betz 67:93bec0baf1de 142 //#define PRESCALER uwPrescalerValue
Wolfgang Betz 67:93bec0baf1de 143
Wolfgang Betz 67:93bec0baf1de 144 #define UART1_CONF_TX_WITH_INTERRUPT 0
Wolfgang Betz 67:93bec0baf1de 145 #define WITH_SERIAL_LINE_INPUT 1
Wolfgang Betz 67:93bec0baf1de 146 #define TELNETD_CONF_NUMLINES 6
Wolfgang Betz 67:93bec0baf1de 147 #define NETSTACK_CONF_RADIO spirit_radio_driver
Wolfgang Betz 67:93bec0baf1de 148 #define NETSTACK_RADIO_MAX_PAYLOAD_LEN 96 /* spirit1-config.h */
Wolfgang Betz 67:93bec0baf1de 149
Wolfgang Betz 67:93bec0baf1de 150 #if WITH_IP64
Wolfgang Betz 67:93bec0baf1de 151 #include "ip64-conf.h"
Wolfgang Betz 67:93bec0baf1de 152 #define WITH_SLIP 1
Wolfgang Betz 67:93bec0baf1de 153 #ifndef UIP_FALLBACK_INTERFACE
Wolfgang Betz 67:93bec0baf1de 154 #define UIP_FALLBACK_INTERFACE ip64_uip_fallback_interface
Wolfgang Betz 67:93bec0baf1de 155 #endif
Wolfgang Betz 67:93bec0baf1de 156 #endif /* WITH_IP64 */
Wolfgang Betz 67:93bec0baf1de 157
Wolfgang Betz 67:93bec0baf1de 158 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 159 /* define ticks/second for slow and fast clocks. Notice that these should be a
Wolfgang Betz 67:93bec0baf1de 160 power of two, eg 64,128,256,512 etc, for efficiency as POT's can be optimized
Wolfgang Betz 67:93bec0baf1de 161 well. */
Wolfgang Betz 67:93bec0baf1de 162 #define CLOCK_CONF_SECOND 512
Wolfgang Betz 67:93bec0baf1de 163 #define RELOAD_VALUE ((F_CPU/CLOCK_CONF_SECOND) - 1)
Wolfgang Betz 67:93bec0baf1de 164
Wolfgang Betz 67:93bec0baf1de 165 /* One tick: 62.5 ms */
Wolfgang Betz 67:93bec0baf1de 166
Wolfgang Betz 67:93bec0baf1de 167 #define RTIMER_CLOCK_LT(a,b) ((signed short)((a)-(b)) < 0)
Wolfgang Betz 67:93bec0baf1de 168 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 169 typedef unsigned long clock_time_t;
Wolfgang Betz 67:93bec0baf1de 170 typedef unsigned long long rtimer_clock_t;
Wolfgang Betz 67:93bec0baf1de 171 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 172 #define CC_CONF_REGISTER_ARGS 0
Wolfgang Betz 67:93bec0baf1de 173 #define CC_CONF_FUNCTION_POINTER_ARGS 1
Wolfgang Betz 67:93bec0baf1de 174 #define CC_CONF_FASTCALL
Wolfgang Betz 67:93bec0baf1de 175 #define CC_CONF_VA_ARGS 1
Wolfgang Betz 67:93bec0baf1de 176 #define CC_CONF_INLINE inline
Wolfgang Betz 67:93bec0baf1de 177
Wolfgang Betz 67:93bec0baf1de 178 #define CCIF
Wolfgang Betz 67:93bec0baf1de 179 #define CLIF
Wolfgang Betz 67:93bec0baf1de 180 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 181 typedef uint8_t u8_t;
Wolfgang Betz 67:93bec0baf1de 182 typedef uint16_t u16_t;
Wolfgang Betz 67:93bec0baf1de 183 typedef uint32_t u32_t;
Wolfgang Betz 67:93bec0baf1de 184 typedef int32_t s32_t;
Wolfgang Betz 67:93bec0baf1de 185 typedef unsigned short uip_stats_t;
Wolfgang Betz 67:93bec0baf1de 186 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 187 #define MULTICHAN_CONF_SET_CHANNEL(x)
Wolfgang Betz 67:93bec0baf1de 188 #define MULTICHAN_CONF_READ_RSSI(x) 0
Wolfgang Betz 67:93bec0baf1de 189 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 190 #endif//USE_STM32F4XX_NUCLEO
Wolfgang Betz 67:93bec0baf1de 191
Wolfgang Betz 67:93bec0baf1de 192 #endif /* __PLATFORM_CONF_H__ */
Wolfgang Betz 67:93bec0baf1de 193 /*---------------------------------------------------------------------------*/
Wolfgang Betz 67:93bec0baf1de 194 /**
Wolfgang Betz 67:93bec0baf1de 195 * @}
Wolfgang Betz 67:93bec0baf1de 196 * @}
Wolfgang Betz 67:93bec0baf1de 197 */