Version of easy-connect with the u-blox cellular platforms C027 and C030 added.

Dependents:   HelloMQTT

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SPIRIT_Calibration.h Source File

SPIRIT_Calibration.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003  * @file    SPIRIT_Calibration.h
00004   * @author  VMA division - AMS
00005   * @version 3.2.2
00006   * @date    08-July-2015
00007  * @brief   Configuration and management of SPIRIT VCO-RCO calibration.
00008   *
00009  * @details
00010  *
00011  * This module allows the user to set some parameters which deal
00012  * with the oscillators calibration.
00013  * The state machine of Spirit contemplates some optional calibrating operations
00014  * in the transition between the READY and the LOCK state.
00015  * The user is allowed to enable or disable the automatic RCO/VCO calibration
00016  * by calling the functions <i>@ref SpiritCalibrationVco()</i> and <i>@ref SpiritCalibrationRco()</i>.
00017  * The following example shows how to do an initial calibration of VCO.
00018  *
00019  * <b>Example:</b>
00020  * @code
00021  *  uint8_t calData;
00022  *
00023  *  SpiritCalibrationVco(S_ENABLE);
00024  *  SpiritCmdStrobeLockTx();
00025  *
00026  *  while(g_xStatus.MC_STATE != MC_STATE_LOCK){
00027  *      SpiritRefreshStatus();
00028  *  }
00029  *
00030  *  calData = SpiritCalibrationGetVcoCalDataTx();
00031  *  SpiritCalibrationSetVcoCalDataTx(calData);
00032  *
00033  *  SpiritCmdStrobeReady();
00034  *  SpiritCalibrationVco(S_DISABLE);
00035  *
00036  * @endcode
00037  *
00038  * Similar operations can be done for the RCO calibrator.
00039  *
00040   * @attention
00041   *
00042   * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
00043   *
00044   * Redistribution and use in source and binary forms, with or without modification,
00045   * are permitted provided that the following conditions are met:
00046   *   1. Redistributions of source code must retain the above copyright notice,
00047   *      this list of conditions and the following disclaimer.
00048   *   2. Redistributions in binary form must reproduce the above copyright notice,
00049   *      this list of conditions and the following disclaimer in the documentation
00050   *      and/or other materials provided with the distribution.
00051   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00052   *      may be used to endorse or promote products derived from this software
00053   *      without specific prior written permission.
00054   *
00055   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00056   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00057   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00058   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00059   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00060   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00061   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00062   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00063   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00064   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00065  *
00066   ******************************************************************************
00067  */
00068 
00069 /* Define to prevent recursive inclusion -------------------------------------*/
00070 #ifndef __SPIRIT_CALIBRATION_H
00071 #define __SPIRIT_CALIBRATION_H
00072 
00073 
00074 /* Includes ------------------------------------------------------------------*/
00075 
00076 #include "SPIRIT_Regs.h"
00077 #include "SPIRIT_Types.h"
00078 
00079 
00080 #ifdef __cplusplus
00081  extern "C" {
00082 #endif
00083 
00084 
00085 /**
00086  * @addtogroup SPIRIT_Libraries
00087  * @{
00088  */
00089 
00090 
00091 /**
00092  * @defgroup SPIRIT_Calibration Calibration
00093  * @brief Configuration and management of SPIRIT VCO-RCO calibration.
00094  * @details See the file <i>@ref SPIRIT_Calibration.h</i> for more details.
00095  * @{
00096  */
00097 
00098 /**
00099  * @defgroup Calibration_Exported_Types Calibration Exported Types
00100  * @{
00101  */
00102 
00103 
00104 /**
00105  * @brief  VCO / RCO calibration window.
00106  */
00107 typedef enum
00108 {
00109 
00110   CALIB_TIME_7_33_US_24MHZ = 0x00,  /*!< calibration window of 7.33 us with XTAL=24MHz */
00111   CALIB_TIME_14_67_US_24MHZ,        /*!< calibration window of 14.67 us with XTAL=24MHz */
00112   CALIB_TIME_29_33_US_24MHZ,        /*!< calibration window of 29.33 us with XTAL=24MHz */
00113   CALIB_TIME_58_67_US_24MHZ,        /*!< calibration window of 58.67 us with XTAL=24MHz */
00114 
00115   CALIB_TIME_6_77_US_26MHZ = 0x00,  /*!< calibration window of 6.77 us with XTAL=26MHz */
00116   CALIB_TIME_13_54_US_26MHZ,        /*!< calibration window of 13.54 us with XTAL=26MHz */
00117   CALIB_TIME_27_08_US_26MHZ,        /*!< calibration window of 27.08 us with XTAL=26MHz */
00118   CALIB_TIME_54_15_US_26MHZ     /*!< calibration window of 54.15 us with XTAL=26MHz */
00119 
00120 } VcoWin;
00121 
00122 
00123 #define IS_VCO_WIN(REF)   (REF == CALIB_TIME_7_33_US_24MHZ  ||\
00124                            REF == CALIB_TIME_14_67_US_24MHZ ||\
00125                            REF == CALIB_TIME_29_33_US_24MHZ ||\
00126                            REF == CALIB_TIME_58_67_US_24MHZ ||\
00127                            REF == CALIB_TIME_6_77_US_26MHZ  ||\
00128                            REF == CALIB_TIME_13_54_US_26MHZ ||\
00129                            REF == CALIB_TIME_27_08_US_26MHZ ||\
00130                            REF == CALIB_TIME_54_15_US_26MHZ \
00131                            )
00132 
00133 /**
00134  * @brief  VCO_H / VCO_L selection.
00135  */
00136 typedef enum
00137 {
00138 
00139   VCO_L = 0x00,         /*!< VCO lower */
00140   VCO_H,        /*!< VCO higher */
00141 } VcoSel;
00142 
00143 
00144 #define IS_VCO_SEL(REF)   (REF == VCO_L  ||\
00145                            REF == VCO_H \
00146                            )
00147 
00148 
00149 /**
00150  * @}
00151  */
00152 
00153 
00154 /**
00155  * @defgroup Calibration_Exported_Constants     Calibration Exported Constants
00156  * @{
00157  */
00158 
00159 /**
00160  * @}
00161  */
00162 
00163 
00164 
00165 /** @defgroup VCO_Calibration   VCO Calibration
00166  * @{
00167  */
00168 
00169 /**
00170  * @}
00171  */
00172 
00173 
00174 
00175 
00176 /**
00177  * @defgroup Calibration_Exported_Macros        Calibration Exported Macros
00178  * @{
00179  */
00180 
00181 
00182 /**
00183  * @}
00184  */
00185 
00186 
00187 /**
00188  * @defgroup Calibration_Exported_Functions     Calibration Exported Functions
00189  * @{
00190  */
00191 
00192 void SpiritCalibrationRco(SpiritFunctionalState xNewState);
00193 void SpiritCalibrationVco(SpiritFunctionalState xNewState);
00194 void SpiritCalibrationSetRcoCalWords(uint8_t cRwt, uint8_t cRfb);
00195 void SpiritCalibrationGetRcoCalWords(uint8_t* pcRwt, uint8_t* pcRfb);
00196 uint8_t SpiritCalibrationGetVcoCalData(void);
00197 void SpiritCalibrationSetVcoCalDataTx(uint8_t cVcoCalData);
00198 uint8_t SpiritCalibrationGetVcoCalDataTx(void);
00199 void SpiritCalibrationSetVcoCalDataRx(uint8_t cVcoCalData);
00200 uint8_t SpiritCalibrationGetVcoCalDataRx(void);
00201 void SpiritCalibrationSetVcoWindow(VcoWin xRefWord);
00202 VcoWin SpiritCalibrationGetVcoWindow(void);
00203 VcoSel SpiritCalibrationGetVcoSelecttion(void);
00204 void SpiritCalibrationSelectVco(VcoSel xVco);
00205 
00206 /**
00207  * @}
00208  */
00209 
00210 
00211 /**
00212  * @}
00213  */
00214 
00215 
00216 /**
00217  * @}
00218  */
00219 
00220 #ifdef __cplusplus
00221 }
00222 #endif
00223 
00224 #endif
00225 
00226 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/