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:
Tue Nov 22 11:40:10 2016 +0100
Revision:
34:edda6a7238ec
Child:
67:93bec0baf1de
Perform re-naming

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wolfgang Betz 34:edda6a7238ec 1 /**
Wolfgang Betz 34:edda6a7238ec 2 ******************************************************************************
Wolfgang Betz 34:edda6a7238ec 3 * @file SPIRIT_Calibration.h
Wolfgang Betz 34:edda6a7238ec 4 * @author VMA division - AMS
Wolfgang Betz 34:edda6a7238ec 5 * @version 3.2.2
Wolfgang Betz 34:edda6a7238ec 6 * @date 08-July-2015
Wolfgang Betz 34:edda6a7238ec 7 * @brief Configuration and management of SPIRIT VCO-RCO calibration.
Wolfgang Betz 34:edda6a7238ec 8 *
Wolfgang Betz 34:edda6a7238ec 9 * @details
Wolfgang Betz 34:edda6a7238ec 10 *
Wolfgang Betz 34:edda6a7238ec 11 * This module allows the user to set some parameters which deal
Wolfgang Betz 34:edda6a7238ec 12 * with the oscillators calibration.
Wolfgang Betz 34:edda6a7238ec 13 * The state machine of Spirit contemplates some optional calibrating operations
Wolfgang Betz 34:edda6a7238ec 14 * in the transition between the READY and the LOCK state.
Wolfgang Betz 34:edda6a7238ec 15 * The user is allowed to enable or disable the automatic RCO/VCO calibration
Wolfgang Betz 34:edda6a7238ec 16 * by calling the functions <i>@ref SpiritCalibrationVco()</i> and <i>@ref SpiritCalibrationRco()</i>.
Wolfgang Betz 34:edda6a7238ec 17 * The following example shows how to do an initial calibration of VCO.
Wolfgang Betz 34:edda6a7238ec 18 *
Wolfgang Betz 34:edda6a7238ec 19 * <b>Example:</b>
Wolfgang Betz 34:edda6a7238ec 20 * @code
Wolfgang Betz 34:edda6a7238ec 21 * uint8_t calData;
Wolfgang Betz 34:edda6a7238ec 22 *
Wolfgang Betz 34:edda6a7238ec 23 * SpiritCalibrationVco(S_ENABLE);
Wolfgang Betz 34:edda6a7238ec 24 * SpiritCmdStrobeLockTx();
Wolfgang Betz 34:edda6a7238ec 25 *
Wolfgang Betz 34:edda6a7238ec 26 * while(g_xStatus.MC_STATE != MC_STATE_LOCK){
Wolfgang Betz 34:edda6a7238ec 27 * SpiritRefreshStatus();
Wolfgang Betz 34:edda6a7238ec 28 * }
Wolfgang Betz 34:edda6a7238ec 29 *
Wolfgang Betz 34:edda6a7238ec 30 * calData = SpiritCalibrationGetVcoCalDataTx();
Wolfgang Betz 34:edda6a7238ec 31 * SpiritCalibrationSetVcoCalDataTx(calData);
Wolfgang Betz 34:edda6a7238ec 32 *
Wolfgang Betz 34:edda6a7238ec 33 * SpiritCmdStrobeReady();
Wolfgang Betz 34:edda6a7238ec 34 * SpiritCalibrationVco(S_DISABLE);
Wolfgang Betz 34:edda6a7238ec 35 *
Wolfgang Betz 34:edda6a7238ec 36 * @endcode
Wolfgang Betz 34:edda6a7238ec 37 *
Wolfgang Betz 34:edda6a7238ec 38 * Similar operations can be done for the RCO calibrator.
Wolfgang Betz 34:edda6a7238ec 39 *
Wolfgang Betz 34:edda6a7238ec 40 * @attention
Wolfgang Betz 34:edda6a7238ec 41 *
Wolfgang Betz 34:edda6a7238ec 42 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Wolfgang Betz 34:edda6a7238ec 43 *
Wolfgang Betz 34:edda6a7238ec 44 * Redistribution and use in source and binary forms, with or without modification,
Wolfgang Betz 34:edda6a7238ec 45 * are permitted provided that the following conditions are met:
Wolfgang Betz 34:edda6a7238ec 46 * 1. Redistributions of source code must retain the above copyright notice,
Wolfgang Betz 34:edda6a7238ec 47 * this list of conditions and the following disclaimer.
Wolfgang Betz 34:edda6a7238ec 48 * 2. Redistributions in binary form must reproduce the above copyright notice,
Wolfgang Betz 34:edda6a7238ec 49 * this list of conditions and the following disclaimer in the documentation
Wolfgang Betz 34:edda6a7238ec 50 * and/or other materials provided with the distribution.
Wolfgang Betz 34:edda6a7238ec 51 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Wolfgang Betz 34:edda6a7238ec 52 * may be used to endorse or promote products derived from this software
Wolfgang Betz 34:edda6a7238ec 53 * without specific prior written permission.
Wolfgang Betz 34:edda6a7238ec 54 *
Wolfgang Betz 34:edda6a7238ec 55 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Wolfgang Betz 34:edda6a7238ec 56 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Wolfgang Betz 34:edda6a7238ec 57 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Wolfgang Betz 34:edda6a7238ec 58 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Wolfgang Betz 34:edda6a7238ec 59 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Wolfgang Betz 34:edda6a7238ec 60 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Wolfgang Betz 34:edda6a7238ec 61 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Wolfgang Betz 34:edda6a7238ec 62 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Wolfgang Betz 34:edda6a7238ec 63 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Wolfgang Betz 34:edda6a7238ec 64 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Wolfgang Betz 34:edda6a7238ec 65 *
Wolfgang Betz 34:edda6a7238ec 66 ******************************************************************************
Wolfgang Betz 34:edda6a7238ec 67 */
Wolfgang Betz 34:edda6a7238ec 68
Wolfgang Betz 34:edda6a7238ec 69 /* Define to prevent recursive inclusion -------------------------------------*/
Wolfgang Betz 34:edda6a7238ec 70 #ifndef __SPIRIT_CALIBRATION_H
Wolfgang Betz 34:edda6a7238ec 71 #define __SPIRIT_CALIBRATION_H
Wolfgang Betz 34:edda6a7238ec 72
Wolfgang Betz 34:edda6a7238ec 73
Wolfgang Betz 34:edda6a7238ec 74 /* Includes ------------------------------------------------------------------*/
Wolfgang Betz 34:edda6a7238ec 75
Wolfgang Betz 34:edda6a7238ec 76 #include "SPIRIT_Regs.h"
Wolfgang Betz 34:edda6a7238ec 77 #include "SPIRIT_Types.h"
Wolfgang Betz 34:edda6a7238ec 78
Wolfgang Betz 34:edda6a7238ec 79
Wolfgang Betz 34:edda6a7238ec 80 #ifdef __cplusplus
Wolfgang Betz 34:edda6a7238ec 81 extern "C" {
Wolfgang Betz 34:edda6a7238ec 82 #endif
Wolfgang Betz 34:edda6a7238ec 83
Wolfgang Betz 34:edda6a7238ec 84
Wolfgang Betz 34:edda6a7238ec 85 /**
Wolfgang Betz 34:edda6a7238ec 86 * @addtogroup SPIRIT_Libraries
Wolfgang Betz 34:edda6a7238ec 87 * @{
Wolfgang Betz 34:edda6a7238ec 88 */
Wolfgang Betz 34:edda6a7238ec 89
Wolfgang Betz 34:edda6a7238ec 90
Wolfgang Betz 34:edda6a7238ec 91 /**
Wolfgang Betz 34:edda6a7238ec 92 * @defgroup SPIRIT_Calibration Calibration
Wolfgang Betz 34:edda6a7238ec 93 * @brief Configuration and management of SPIRIT VCO-RCO calibration.
Wolfgang Betz 34:edda6a7238ec 94 * @details See the file <i>@ref SPIRIT_Calibration.h</i> for more details.
Wolfgang Betz 34:edda6a7238ec 95 * @{
Wolfgang Betz 34:edda6a7238ec 96 */
Wolfgang Betz 34:edda6a7238ec 97
Wolfgang Betz 34:edda6a7238ec 98 /**
Wolfgang Betz 34:edda6a7238ec 99 * @defgroup Calibration_Exported_Types Calibration Exported Types
Wolfgang Betz 34:edda6a7238ec 100 * @{
Wolfgang Betz 34:edda6a7238ec 101 */
Wolfgang Betz 34:edda6a7238ec 102
Wolfgang Betz 34:edda6a7238ec 103
Wolfgang Betz 34:edda6a7238ec 104 /**
Wolfgang Betz 34:edda6a7238ec 105 * @brief VCO / RCO calibration window.
Wolfgang Betz 34:edda6a7238ec 106 */
Wolfgang Betz 34:edda6a7238ec 107 typedef enum
Wolfgang Betz 34:edda6a7238ec 108 {
Wolfgang Betz 34:edda6a7238ec 109
Wolfgang Betz 34:edda6a7238ec 110 CALIB_TIME_7_33_US_24MHZ = 0x00, /*!< calibration window of 7.33 us with XTAL=24MHz */
Wolfgang Betz 34:edda6a7238ec 111 CALIB_TIME_14_67_US_24MHZ, /*!< calibration window of 14.67 us with XTAL=24MHz */
Wolfgang Betz 34:edda6a7238ec 112 CALIB_TIME_29_33_US_24MHZ, /*!< calibration window of 29.33 us with XTAL=24MHz */
Wolfgang Betz 34:edda6a7238ec 113 CALIB_TIME_58_67_US_24MHZ, /*!< calibration window of 58.67 us with XTAL=24MHz */
Wolfgang Betz 34:edda6a7238ec 114
Wolfgang Betz 34:edda6a7238ec 115 CALIB_TIME_6_77_US_26MHZ = 0x00, /*!< calibration window of 6.77 us with XTAL=26MHz */
Wolfgang Betz 34:edda6a7238ec 116 CALIB_TIME_13_54_US_26MHZ, /*!< calibration window of 13.54 us with XTAL=26MHz */
Wolfgang Betz 34:edda6a7238ec 117 CALIB_TIME_27_08_US_26MHZ, /*!< calibration window of 27.08 us with XTAL=26MHz */
Wolfgang Betz 34:edda6a7238ec 118 CALIB_TIME_54_15_US_26MHZ /*!< calibration window of 54.15 us with XTAL=26MHz */
Wolfgang Betz 34:edda6a7238ec 119
Wolfgang Betz 34:edda6a7238ec 120 } VcoWin;
Wolfgang Betz 34:edda6a7238ec 121
Wolfgang Betz 34:edda6a7238ec 122
Wolfgang Betz 34:edda6a7238ec 123 #define IS_VCO_WIN(REF) (REF == CALIB_TIME_7_33_US_24MHZ ||\
Wolfgang Betz 34:edda6a7238ec 124 REF == CALIB_TIME_14_67_US_24MHZ ||\
Wolfgang Betz 34:edda6a7238ec 125 REF == CALIB_TIME_29_33_US_24MHZ ||\
Wolfgang Betz 34:edda6a7238ec 126 REF == CALIB_TIME_58_67_US_24MHZ ||\
Wolfgang Betz 34:edda6a7238ec 127 REF == CALIB_TIME_6_77_US_26MHZ ||\
Wolfgang Betz 34:edda6a7238ec 128 REF == CALIB_TIME_13_54_US_26MHZ ||\
Wolfgang Betz 34:edda6a7238ec 129 REF == CALIB_TIME_27_08_US_26MHZ ||\
Wolfgang Betz 34:edda6a7238ec 130 REF == CALIB_TIME_54_15_US_26MHZ \
Wolfgang Betz 34:edda6a7238ec 131 )
Wolfgang Betz 34:edda6a7238ec 132
Wolfgang Betz 34:edda6a7238ec 133 /**
Wolfgang Betz 34:edda6a7238ec 134 * @brief VCO_H / VCO_L selection.
Wolfgang Betz 34:edda6a7238ec 135 */
Wolfgang Betz 34:edda6a7238ec 136 typedef enum
Wolfgang Betz 34:edda6a7238ec 137 {
Wolfgang Betz 34:edda6a7238ec 138
Wolfgang Betz 34:edda6a7238ec 139 VCO_L = 0x00, /*!< VCO lower */
Wolfgang Betz 34:edda6a7238ec 140 VCO_H, /*!< VCO higher */
Wolfgang Betz 34:edda6a7238ec 141 } VcoSel;
Wolfgang Betz 34:edda6a7238ec 142
Wolfgang Betz 34:edda6a7238ec 143
Wolfgang Betz 34:edda6a7238ec 144 #define IS_VCO_SEL(REF) (REF == VCO_L ||\
Wolfgang Betz 34:edda6a7238ec 145 REF == VCO_H \
Wolfgang Betz 34:edda6a7238ec 146 )
Wolfgang Betz 34:edda6a7238ec 147
Wolfgang Betz 34:edda6a7238ec 148
Wolfgang Betz 34:edda6a7238ec 149 /**
Wolfgang Betz 34:edda6a7238ec 150 * @}
Wolfgang Betz 34:edda6a7238ec 151 */
Wolfgang Betz 34:edda6a7238ec 152
Wolfgang Betz 34:edda6a7238ec 153
Wolfgang Betz 34:edda6a7238ec 154 /**
Wolfgang Betz 34:edda6a7238ec 155 * @defgroup Calibration_Exported_Constants Calibration Exported Constants
Wolfgang Betz 34:edda6a7238ec 156 * @{
Wolfgang Betz 34:edda6a7238ec 157 */
Wolfgang Betz 34:edda6a7238ec 158
Wolfgang Betz 34:edda6a7238ec 159 /**
Wolfgang Betz 34:edda6a7238ec 160 * @}
Wolfgang Betz 34:edda6a7238ec 161 */
Wolfgang Betz 34:edda6a7238ec 162
Wolfgang Betz 34:edda6a7238ec 163
Wolfgang Betz 34:edda6a7238ec 164
Wolfgang Betz 34:edda6a7238ec 165 /** @defgroup VCO_Calibration VCO Calibration
Wolfgang Betz 34:edda6a7238ec 166 * @{
Wolfgang Betz 34:edda6a7238ec 167 */
Wolfgang Betz 34:edda6a7238ec 168
Wolfgang Betz 34:edda6a7238ec 169 /**
Wolfgang Betz 34:edda6a7238ec 170 * @}
Wolfgang Betz 34:edda6a7238ec 171 */
Wolfgang Betz 34:edda6a7238ec 172
Wolfgang Betz 34:edda6a7238ec 173
Wolfgang Betz 34:edda6a7238ec 174
Wolfgang Betz 34:edda6a7238ec 175
Wolfgang Betz 34:edda6a7238ec 176 /**
Wolfgang Betz 34:edda6a7238ec 177 * @defgroup Calibration_Exported_Macros Calibration Exported Macros
Wolfgang Betz 34:edda6a7238ec 178 * @{
Wolfgang Betz 34:edda6a7238ec 179 */
Wolfgang Betz 34:edda6a7238ec 180
Wolfgang Betz 34:edda6a7238ec 181
Wolfgang Betz 34:edda6a7238ec 182 /**
Wolfgang Betz 34:edda6a7238ec 183 * @}
Wolfgang Betz 34:edda6a7238ec 184 */
Wolfgang Betz 34:edda6a7238ec 185
Wolfgang Betz 34:edda6a7238ec 186
Wolfgang Betz 34:edda6a7238ec 187 /**
Wolfgang Betz 34:edda6a7238ec 188 * @defgroup Calibration_Exported_Functions Calibration Exported Functions
Wolfgang Betz 34:edda6a7238ec 189 * @{
Wolfgang Betz 34:edda6a7238ec 190 */
Wolfgang Betz 34:edda6a7238ec 191
Wolfgang Betz 34:edda6a7238ec 192 void SpiritCalibrationRco(SpiritFunctionalState xNewState);
Wolfgang Betz 34:edda6a7238ec 193 void SpiritCalibrationVco(SpiritFunctionalState xNewState);
Wolfgang Betz 34:edda6a7238ec 194 void SpiritCalibrationSetRcoCalWords(uint8_t cRwt, uint8_t cRfb);
Wolfgang Betz 34:edda6a7238ec 195 void SpiritCalibrationGetRcoCalWords(uint8_t* pcRwt, uint8_t* pcRfb);
Wolfgang Betz 34:edda6a7238ec 196 uint8_t SpiritCalibrationGetVcoCalData(void);
Wolfgang Betz 34:edda6a7238ec 197 void SpiritCalibrationSetVcoCalDataTx(uint8_t cVcoCalData);
Wolfgang Betz 34:edda6a7238ec 198 uint8_t SpiritCalibrationGetVcoCalDataTx(void);
Wolfgang Betz 34:edda6a7238ec 199 void SpiritCalibrationSetVcoCalDataRx(uint8_t cVcoCalData);
Wolfgang Betz 34:edda6a7238ec 200 uint8_t SpiritCalibrationGetVcoCalDataRx(void);
Wolfgang Betz 34:edda6a7238ec 201 void SpiritCalibrationSetVcoWindow(VcoWin xRefWord);
Wolfgang Betz 34:edda6a7238ec 202 VcoWin SpiritCalibrationGetVcoWindow(void);
Wolfgang Betz 34:edda6a7238ec 203 VcoSel SpiritCalibrationGetVcoSelecttion(void);
Wolfgang Betz 34:edda6a7238ec 204 void SpiritCalibrationSelectVco(VcoSel xVco);
Wolfgang Betz 34:edda6a7238ec 205
Wolfgang Betz 34:edda6a7238ec 206 /**
Wolfgang Betz 34:edda6a7238ec 207 * @}
Wolfgang Betz 34:edda6a7238ec 208 */
Wolfgang Betz 34:edda6a7238ec 209
Wolfgang Betz 34:edda6a7238ec 210
Wolfgang Betz 34:edda6a7238ec 211 /**
Wolfgang Betz 34:edda6a7238ec 212 * @}
Wolfgang Betz 34:edda6a7238ec 213 */
Wolfgang Betz 34:edda6a7238ec 214
Wolfgang Betz 34:edda6a7238ec 215
Wolfgang Betz 34:edda6a7238ec 216 /**
Wolfgang Betz 34:edda6a7238ec 217 * @}
Wolfgang Betz 34:edda6a7238ec 218 */
Wolfgang Betz 34:edda6a7238ec 219
Wolfgang Betz 34:edda6a7238ec 220 #ifdef __cplusplus
Wolfgang Betz 34:edda6a7238ec 221 }
Wolfgang Betz 34:edda6a7238ec 222 #endif
Wolfgang Betz 34:edda6a7238ec 223
Wolfgang Betz 34:edda6a7238ec 224 #endif
Wolfgang Betz 34:edda6a7238ec 225
Wolfgang Betz 34:edda6a7238ec 226 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/