This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC1120 analog FM modulation mode

Other Parts Discussed in Thread: CC1120

Good evening , I want to use CC1120 in "analog FM" modulation mode.

It looks that this modulation setting is not supported from any tool like Smart RF Studio .

I am searching some application note or example that show how to set CC1120 internal registers for analog FM modulation.

Any idea ?

Many Thanks Riccardo.

  • I wrote a simple TX example last summer for this. We don't have a RX example. Note that effort was used to make an example that works and not on good coding.

    /******************************************************************************
      Filename:   main_link_test.c
     
      Description: Link test example
     
      Notes:
     
    ******************************************************************************/

    /******************************************************************************
     * INCLUDES
     */

    #include  <msp430.h>
    #include "hal_board.h"
    #include "hal_led.h"
    #include "hal_button.h"
    #include "hal_lcd.h"   
    #include "trxeb_rf_spi.h"
    #include "cc112x_spi.h"
    #include "chip_detect.h"
    #include "hal_timer_32k.h"
    #include "main_graphics.c"

    /******************************************************************************
     * TYPEDEFS
     */

    typedef struct
    {
      uint16  addr;
      uint8   data;
    } radioSetting_t;

    /******************************************************************************
     * LOCAL FUNCTIONS
     */
    static void AFMISR(void);

    /******************************************************************************
    * GLOBAL VARIABLES
    */
    uint8  mclkFrequency;
    uint8  writeByte,chipStatus,mode;

    uint8  arrayCounter = 1;
    uint8  randCounter = 1;

    uint8  freqArray0[16];
    uint8  freqArray1[16];
    uint8  randArray[] = {0x0, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x0, 0x1, 0x0, 0x1,0x0, 0x0};

    static const radioSetting_t cc112xTestRfSettings[] =
    {
      /***************************************************************
     *  SmartRF Studio(tm) Export
     *
     *  Radio register settings specifed with C-code
     *  compatible #define statements.
     *
     ***************************************************************/

      {CC112X_IOCFG3             ,0x08},
      {CC112X_IOCFG2             ,0x09},
      {CC112X_IOCFG1             ,0xB0},
      {CC112X_IOCFG0             ,0xB0},
      {CC112X_SYNC_CFG1          ,0x08},
      {CC112X_MODCFG_DEV_E       ,0x03},
      {CC112X_DCFILT_CFG         ,0x1C},
      {CC112X_PREAMBLE_CFG1      ,0x14},
      {CC112X_IQIC               ,0xC4},
      {CC112X_CHAN_BW            ,0x28},
      {CC112X_MDMCFG1            ,0x06},
      {CC112X_MDMCFG0            ,0x0A},
      {CC112X_DRATE2             ,0x43},
      {CC112X_DRATE1             ,0xA9},
      {CC112X_DRATE0             ,0x2A},
      {CC112X_AGC_REF            ,0x20},
      {CC112X_AGC_CS_THR         ,0x19},
      {CC112X_AGC_CFG1           ,0xAF},
      {CC112X_AGC_CFG0           ,0xCF},
      {CC112X_FIFO_CFG           ,0x00},
      {CC112X_FS_CFG             ,0x12},
      {CC112X_PKT_CFG2           ,0x05},
      {CC112X_PKT_CFG1           ,0x00},
      {CC112X_PKT_CFG0           ,0x20},
      {CC112X_PA_CFG2            ,0x78},
      {CC112X_PA_CFG0            ,0x7C},
      {CC112X_IF_MIX_CFG         ,0x04},
      {CC112X_FREQOFF_CFG        ,0x22},
      {CC112X_FREQ2              ,0xD8},
      {CC112X_FREQ1              ,0x80},
      {CC112X_IF_ADC0            ,0x04},
      {CC112X_FS_DIG0            ,0x5F},
      {CC112X_FS_CAL2            ,0x20},
      {CC112X_FS_CAL0            ,0x0F},
      {CC112X_FS_CHP             ,0x16},
      {CC112X_FS_DIVTWO          ,0x01},
      {CC112X_FS_DSM1            ,0x0B},
      {CC112X_FS_DSM0            ,0x30},
      {CC112X_FS_DVC1            ,0xFF},
      {CC112X_FS_DVC0            ,0x1F},
      {CC112X_FS_PFD             ,0x51},
      {CC112X_FS_PRE             ,0x1F},
      {CC112X_FS_REG_DIV_CML     ,0x1D},
      {CC112X_FS_VCO0            ,0x81},
      {CC112X_XOSC3              ,0xC7},
      {CC112X_XOSC1              ,0x0F},
      {CC112X_RSSI1              ,0x80},
      {CC112X_MARCSTATE          ,0x41},
      {CC112X_PQT_SYNC_ERR       ,0xFF},
      {CC112X_AGC_GAIN2          ,0xD1},
      {CC112X_AGC_GAIN0          ,0x3F},
      {CC112X_ASK_SOFT_RX_DATA   ,0x30},
      {CC112X_RNDGEN             ,0x7F},
      {CC112X_CHFILT_I2          ,0x08},
      {CC112X_FSCAL_CTRL         ,0x01},
      {CC112X_PARTNUMBER         ,0x58},
      {CC112X_PARTVERSION        ,0x10},
      {CC112X_RX_STATUS          ,0x10},
      {CC112X_DVC_TEST           ,0x0B},
      {CC112X_XOSC_TEST1         ,0x0C},
      {CC112X_FIFO_NUM_TXBYTES   ,0x0F},

    };


    /******************************************************************************
     * @fn          main
     *
     * @brief       Main handles all application menus
     *                
     * @param       none
     *
     * @return      none
     ******************************************************************************/
    uint8 chipState;
    int16 rssiComp;
    volatile int8 rssi;
    int8 rssi1;
    uint8 rssi_readout;
    volatile uint8 pqtSyncError;
    uint8 pqtSyncError1;
    uint8 cc112xRssiOffset = 101;
    void main( void )
    {
      // Set freqArray0
      freqArray0[0] =0xFF;
      freqArray0[1] =0xFD;
      freqArray0[2] =0xF9;
      freqArray0[3] =0xF2;
      freqArray0[4] =0xE7;
      freqArray0[5] =0xDB;
      freqArray0[6] =0xCE;
      freqArray0[7] =0xC4;
      freqArray0[8] =0xC4;
      freqArray0[9] =0xCE;
      freqArray0[10]=0xDB;
      freqArray0[11]=0xE7;
      freqArray0[12]=0xF2;
      freqArray0[13]=0xF9;
      freqArray0[14]=0xFD;
      freqArray0[15]=0xFF;

      // Set freqArray1
      freqArray1[0] =0x01;
      freqArray1[1] =0x03;
      freqArray1[2] =0x07;
      freqArray1[3] =0x0E;
      freqArray1[4] =0x19;
      freqArray1[5] =0x25;
      freqArray1[6] =0x32;
      freqArray1[7] =0x3C;
      freqArray1[8] =0x3C;
      freqArray1[9] =0x32;
      freqArray1[10]=0x25;
      freqArray1[11]=0x19;
      freqArray1[12]=0x0E;
      freqArray1[13]=0x07;
      freqArray1[14]=0x03;
      freqArray1[15]=0x01;  

      // Stop watchdog timer to prevent time out reset
      WDTCTL = WDTPW + WDTHOLD;
      /* Settingcapacitor values for XT1, 32768 Hz */
      halBoardStartXT1();
     
      //Enable global interrupt
      _BIS_SR(GIE);
     
      /* Clocks:
       * mclk  = mclkFrequency
       * smclk = mclkFrequency
       * aclk  = 32768 Hz
       */
      mclkFrequency = SYSCLK_16MHZ;
      halBoardSetSystemClock(mclkFrequency);
     
      /* Care must be taken when handling power modes
       * - Peripheral units can request clocks and have them granted even if
       *   the system is in a power mode. Peripheral clock request is enabled
       *   as default.
       * - Per test only needs ACLK to be enabled to timers
       *   during power mode operation
       */
      halBoardDisablePeripheralClockRequest((MCLKREQEN+SMCLKREQEN));
     
     
      // SPI flash uses same SPI interface as LCD -- we'll disable the SPI flash
      P8SEL &= BIT6; //ioflash_csn = gp.        
      P8DIR |= BIT6; //tpflash_csn = ouut.      
      P8OUT |= BIT6; //flash_csn = 1.         
     
        // Initialize buttons
      halButtonsInit();
     
      // Enable button interrupt
      halButtonsInterruptEnable();
     
      // Initialize LED's
      halLedInit();
     
      // Initialize LCD
      halLcdInit();
     
      //Clear display
      halLcdClear(0);
      halLcdSendBuffer(0);
        
      /* Issue trxeb tranceiver RF spi interface */
      trxRfSpiInterfaceInit(mclkFrequency);
     
      //chipType        = trxDetectChipType();
      // Read version id to determine which settings to be used
      //cc112xSpiReadReg(CC112X_PARTVERSION, &chipVersion,1);
     
      halLcdClear(0);
      halLcdPrintString(0,"     Analog FM    ",0,1);
      halLcdPrintString(0,"   Demonstration  ",0,2);
      halLcdPrintString(0,"                  ",0,3);
      halLcdPrintString(0," Press button for ",0,4);
      halLcdPrintString(0,"  continuous TX   ",0,5);
     
      /* Display choices */
      halLcdSendBuffer(0);
      /* sleep...*/
      __low_power_mode_3();       
      mode = halButtonsPushed();    
     
      /* Configure Radio */
      for(uint16 i = 0; i < (sizeof  cc112xTestRfSettings/sizeof(radioSetting_t));i++)
          {
            writeByte =  cc112xTestRfSettings[i].data;
            cc112xSpiWriteReg( cc112xTestRfSettings[i].addr,&writeByte,1);
          }
        // Calibrate             
        trxSpiCmdStrobe(SCAL);
        
        //Enable analog AM
        writeByte = 0x01;
        cc112xSpiWriteReg(CC112X_SOFT_TX_DATA_CFG, &writeByte,1);
        
        // Make sure the radio is in IDLE
        trxSpiCmdStrobe(SIDLE);
        // Set radio in continuous TX
        trxSpiCmdStrobe(STX);
        
        //Interrupt function
        trxIsrConnect(&AFMISR);
        trxEnableInt();
          // Display state of radio
          halLcdClear(0);
          halLcdPrintString(0,"    Radio in TX    ",0,2);
          halLcdPrintString(0,"                   ",0,3);
          halLcdPrintString(0,"  (Continuous mode)",0,4);
          halLcdPrintString(0,"                   ",0,5);
          halLcdSendBuffer(0);   
          while(1);
    }

    /***********************************************************************************
    * @fn          radioRXISR
    *
    * @brief       ISR for packet handling in RX
    *
    * @param       none
    *
    * @return      none
    */
    static void AFMISR(void)
    {
      trxClearIntFlag();
      if (randArray[randCounter] == 0 )
      {
        writeByte = freqArray0[arrayCounter];
        cc112xSpiWriteReg(CC112X_SOFT_TX_DATA_IN, &writeByte,1);
      }
      else
      {
        writeByte = freqArray1[arrayCounter];
        cc112xSpiWriteReg(CC112X_SOFT_TX_DATA_IN, &writeByte,1);
      }
      arrayCounter++;
      if (arrayCounter == 16 )
      {
        arrayCounter = 1;
        randCounter++;
        if (randCounter == 16)
        {
          randCounter = 1;
        }
      }
    }


    /***********************************************************************************
      Copyright 2011 Texas Instruments Incorporated. All rights reserved.

      IMPORTANT: Your use of this Software is limited to those specific rights
      granted under the terms of a software license agreement between the user
      who downloaded the software, his/her employer (which must be your employer)
      and Texas Instruments Incorporated (the "License").  You may not use this
      Software unless you agree to abide by the terms of the License. The License
      limits your use, and you acknowledge, that the Software may not be modified,
      copied or distributed unless embedded on a Texas Instruments microcontroller
      or used solely and exclusively in conjunction with a Texas Instruments radio
      frequency transceiver, which is integrated into your product.  Other than for
      the foregoing purpose, you may not use, reproduce, copy, prepare derivative
      works of, modify, distribute, perform, display or sell this Software and/or
      its documentation for any purpose.

      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
      TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
      NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
      LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
      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.

      Should you have any questions regarding your right to use this Software,
      contact Texas Instruments Incorporated at www.TI.com.
    ***********************************************************************************/