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.

CC2500: CC2500: The flash can be received normally at the beginning of shooting, but suddenly it cannot receive the flash. Switching to sending can still trigger the flash of other cameras.

Part Number: CC2500

Hi Team,

I have a machine here using the CC2500 module that can receive normally at first, but cannot receive after a while.

I switch the mode to transmit, and the module can work normally, but it just cannot receive, and the software reset and initialization does not work.

It must be Just power off and on again. After the RF receiver crashed,

I used a normal machine to compare it with a logic analyzer and found that the RF after the crash could receive data, but the data was wrong and the number of bytes did not match.

I have re-initialized the RF when switching modes, but it doesn't work. I can still only send but not receive. The CC2500 module must be powered off and on again.

This is the vedio.

Best Regards,

Galaxy

  • Hello Galaxy,

    I hope you are doing well. Could you provide CCS version and SDK version (as well as what baseline example project you used). Is it possible to enter debug mode with the problem devices in question or not? 

    software reset and initialization does not work.

    It must be Just power off and on again.

    Is it possible to check if the program is hanging anywhere in the code to confirm this case?

    Thanks,
    Alex F

  • Hi Alex F,

    It is not a simulation program and cannot locate the location in the program. Other functions are OK. RF can also send data.

    He don’t use upper computersoftware.

    I have asked him about the version numbers of the SDK and CCS and taught him how to read them.

    He did not answer the question and only answered the above.

    I will continue to ask, and I hope you can take the next step based on the existing information.

    B&R,

    Galaxy

  • Hello Galaxy,

    Since we have limited debugging support I would recommend looking over available c2500 threads:

    https://e2e.ti.com/f/1/t/614553/

    https://e2e.ti.com/f/1/t/781086/

    Thanks,
    Alex F

  • Hi Alex F,

    He gave this file and hope that you can have a try.

    m_cc2500.c
    /********************************************************************
    ;* @author  GVD Application Team
    ;* @version V1.1.1
    ;* @date    28-August-2020
    ;********************************************************************
    ;*
    */
    
    #include "m_include.h"
    
    #define RF_SPI_TimeOut 2000
    #define RF_Wait_TimeOut 6000
    
    u16 CC2500_RSSI_Array[32];
    CC2500RamStructType CC2500Ram;
    CC2500FlagStructType CC2500Flag;
    
    u16 CC2500_Get_ChipId(void);
    void CC2500_Set_UserId(u08 id);
    u08 CC2500_Read_RSSI_Prog(void);
    void CC2500_Set_ChFreq(u08 chfr);
    void CC2500_Set_TxPower(u08 power);
    void CC2500_RSSI_Bubble(u08 ByteCnt);
    
    u08 CC2500_ReadReg(u08 addr);
    void CC2500_WriteReg(u08 addr, u08 value);
    void CC2500_TransmitReceive(u08 *TxData, u08 *RxData, u08 Cnt);
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_Init_Prog(void)
    {
      disableInterrupts();
      LL_SPI_Enable(SPI3);
      RF_CSN_WriteL;
      Delay_1ms(1);
      RF_CSN_WriteH;
      Delay_1ms(1);
      CC2500_Strobe_Cmd(Cmd_SRES);
      Delay_1ms(1);
    
      // GDO2-GDO0 Output Pin Configuration
      CC2500_WriteReg(CC2500_00_IOCFG2, Val_00_IOCFG2);
      // CC2500_WriteReg(CC2500_01_IOCFG1, Val_01_IOCFG1);
      CC2500_WriteReg(CC2500_02_IOCFG0, Val_02_IOCFG0);
    
      // Frequency Control(Set 2413MHz)
      CC2500_WriteReg(CC2500_0B_FSCTRL1, Val_0B_FSCTRL1);
      CC2500_WriteReg(CC2500_0C_FSCTRL0, Val_0C_FSCTRL0);
      CC2500_WriteReg(CC2500_0D_FREQ2, Val_0D_FREQ2);
      CC2500_WriteReg(CC2500_0E_FREQ1, Val_0E_FREQ1);
      CC2500_WriteReg(CC2500_0F_FREQ0, Val_0F_FREQ0);
    
      // Modem Configuration(MSK)
      CC2500_WriteReg(CC2500_10_MDMCFG4, Val_10_MDMCFG4);
      CC2500_WriteReg(CC2500_11_MDMCFG3, Val_11_MDMCFG3);
      CC2500_WriteReg(CC2500_12_MDMCFG2, Val_12_MDMCFG2);
      CC2500_WriteReg(CC2500_13_MDMCFG1, Val_13_MDMCFG1);
      CC2500_WriteReg(CC2500_14_MDMCFG0, Val_14_MDMCFG0);
    
      // Channel Number
      CC2500_WriteReg(CC2500_0A_CHANNR, Val_0A_CHANNR);
      CC2500_WriteReg(CC2500_15_DEVIATN, Val_15_DEVIATN);
      // CC2500_WriteReg(CC2500_16_MCSM2, Val_16_MCSM2);
      // CC2500_WriteReg(CC2500_17_MCSM1, Val_17_MCSM1);
      // CC2500_WriteReg(CC2500_1E_WOREVT1, Val_1E_WOREVT1);
      // CC2500_WriteReg(CC2500_1F_WOREVT0, Val_1F_WOREVT0);
      // CC2500_WriteReg(CC2500_20_WORCTRL, Val_20_WORCTRL);
      CC2500_WriteReg(CC2500_21_FREND1, Val_21_FREND1);
      CC2500_WriteReg(CC2500_22_FREND0, Val_22_FREND0);
    
      CC2500_WriteReg(CC2500_18_MCSM0, Val_18_MCSM0);
      CC2500_WriteReg(CC2500_19_FOCCFG, Val_19_FOCCFG);
      CC2500_WriteReg(CC2500_1A_BSCFG, Val_1A_BSCFG);
    
      // AGC Control
      CC2500_WriteReg(CC2500_1B_AGCCTRL2, Val_1B_AGCCTRL2);
      CC2500_WriteReg(CC2500_1C_AGCCTRL1, Val_1C_AGCCTRL1);
      CC2500_WriteReg(CC2500_1D_AGCCTRL0, Val_1D_AGCCTRL0);
    
      // Frequency Synthesizer Calibration
      CC2500_WriteReg(CC2500_23_FSCAL3, Val_23_FSCAL3);
      CC2500_WriteReg(CC2500_24_FSCAL2, Val_24_FSCAL2);
      CC2500_WriteReg(CC2500_25_FSCAL1, Val_25_FSCAL1);
      CC2500_WriteReg(CC2500_26_FSCAL0, Val_26_FSCAL0);
      CC2500_WriteReg(CC2500_29_FSTEST, Val_29_FSTEST);
    
      // RC Oscillator Configuration
      // CC2500_WriteReg(CC2500_27_RCCTRL1, Val_27_RCCTRL1);
      // CC2500_WriteReg(CC2500_28_RCCTRL0, Val_28_RCCTRL0);
      // CC2500_WriteReg(CC2500_2A_PTEST, Val_2A_PTEST);
      // CC2500_WriteReg(CC2500_2B_AGCTEST, Val_2B_AGCTEST);
    
      // Various Test Settings
      CC2500_WriteReg(CC2500_2C_TEST2, Val_2C_TEST2);
      CC2500_WriteReg(CC2500_2D_TEST1, Val_2D_TEST1);
      CC2500_WriteReg(CC2500_2E_TEST0, Val_2E_TEST0);
    
      // TX FIFO = 33byte  RX FIFO = 32byte
      CC2500_WriteReg(CC2500_03_FIFOTHR, Val_03_FIFOTHR);
    
      // User ID
      CC2500_WriteReg(CC2500_04_SYNC1, Val_04_SYNC1);
      CC2500_WriteReg(CC2500_05_SYNC0, Val_05_SYNC0);
    
      // Packet Automation Control
      CC2500_WriteReg(CC2500_07_PKTCTRL1, Val_07_PKTCTRL1);
      // Variable packet length mode
      // Packet length configured by the first byte after sync word
      CC2500_WriteReg(CC2500_08_PKTCTRL0, Val_08_PKTCTRL0);
      // Address
      CC2500_WriteReg(CC2500_09_ADDR, Val_09_ADDR);
      // Maximum length packets
      CC2500_WriteReg(CC2500_06_PKTLEN, Val_06_PKTLEN);
    
      CC2500_Strobe_Cmd(Cmd_SIDLE);
      CC2500_WriteReg(CC2500_22_FREND0, Val_22_FREND0);
      CC2500_Strobe_Cmd(Cmd_SCAL);
      CC2500_Strobe_Cmd(Cmd_SFRX);
      enableInterrupts();
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_Scan_Stauts(void)
    {
      if ((CC2500Ram.NewFunMode != NormalRam.FunMode) ||
          (CC2500Ram.NtChannel != CC2500Ram.RFChannel) ||
          (CC2500Ram.NextIDNum != CC2500Ram.UserIDNum))
      {
        CC2500Ram.SetRefTime = 0;
        CC2500Ram.NewFunMode = NormalRam.FunMode;
        CC2500Ram.NtChannel = CC2500Ram.RFChannel;
        CC2500Ram.NextIDNum = CC2500Ram.UserIDNum;
      }
    
      if (NormalRam.FunMode == Remote_Fun)
      {
        if (CC2500Ram.RFidleTime)
        {
          CC2500Ram.RFidleTime--;
          if (CC2500Ram.RFidleTime == 1)
          { // Clear SFRx
            CC2500_Strobe_Cmd(Cmd_SFRX);
            CC2500_Strobe_Cmd(Cmd_SRX);
          }
        }
      }
    
      if (CC2500Ram.SetRefTime < 500)
        CC2500Ram.SetRefTime++;
    
      if (CC2500Ram.SetRefTime == 498)
      {
        CC2500_Init_Prog();
        Delay_1ms(1);
        CC2500_Set_ChFreq(CC2500Ram.RFChannel - 1);
        Delay_1ms(1);
        CC2500_Enter_StbyMode();
        Delay_1ms(1);
        CC2500_Set_UserId(CC2500Ram.UserIDNum - 1);
        Delay_1ms(1);
        if (MenuFlag.bit.DIST == Dist10m)
          CC2500_Set_TxPower(0);
        if (MenuFlag.bit.DIST == Dist100m)
          CC2500_Set_TxPower(7);
        Delay_1ms(1);
    
        // HAL_NVIC_DisableIRQ(EXTI4_15_IRQn);
        if (NormalRam.FunMode == Remote_Fun)
        {
          CC2500_Enter_RxMode();
          CC2500Ram.RFStatus = RF_RxMode;
          HAL_NVIC_SetPriority(EXTI4_15_IRQn, 0, 1);
        }
        else if (NormalRam.FunMode == Master_Fun)
        {
          CC2500_Enter_StbyMode();
          CC2500Ram.RFStatus = RF_StbyMode;
          HAL_NVIC_SetPriority(EXTI4_15_IRQn, 2, 0);
        }
        else
        {
          CC2500_Enter_SleepMode();
          CC2500Ram.RFStatus = RF_SleepMode;
          HAL_NVIC_SetPriority(EXTI4_15_IRQn, 2, 0);
        }
        // HAL_NVIC_EnableIRQ(EXTI4_15_IRQn);
      }
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_Set_Scan_RSSI(void)
    {
      if (CC2500Flag.bit.ScanRSSI == 0)
      {
        CC2500Flag.bit.ScanRSSI = 1;
    
        CC2500Ram.RSSIPercent = 0;
        CC2500Ram.RSSIScanCnt = 0;
        memset(CC2500_RSSI_Array, 0, sizeof(CC2500_RSSI_Array));
      }
      else
      {
        CC2500Ram.RSSIPercent = 0;
        CC2500Ram.RSSIScanCnt = 0;
        CC2500Flag.bit.ScanRSSI = 0;
        MenuFlag.bit.SCAN = ScanOFF;
        NormalRam.MenuMode = Menu_51;
      }
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_Scan_CH_RSSI(void)
    {
      u08 i, k;
    
      if (CC2500Flag.bit.ScanRSSI)
      {
        disableInterrupts();
        if (CC2500Ram.RSSIScanCnt < 160)
        {
          k = (CC2500Ram.RSSIScanCnt / 5);
          CC2500_Strobe_Cmd(Cmd_SIDLE);
          CC2500_WriteReg(CC2500_18_MCSM0, 0x18);
          CC2500_Set_ChFreq(k);
          Delay_1us(30);
          CC2500_Strobe_Cmd(Cmd_SRX);
          Delay_1ms(1);
    
          for (i = 0; i < 64; i++)
          {
            CC2500_RSSI_Array[k] += CC2500_Read_RSSI_Prog() >> 1;
          }
    
          LCD_RenewSet_Prog(1);
          CC2500Ram.RSSIScanCnt++;
          CC2500Ram.RSSIPercent = (CC2500Ram.RSSIScanCnt >> 3) * 5;
        }
        else if (CC2500Ram.RSSIScanCnt == 160)
        {
          CC2500_RSSI_Bubble(32);
          CC2500Ram.RSSIScanCnt++;
        }
        else
        {
          if (CC2500Ram.RSSIScanCnt < 200)
          {
            LCD_RenewSet_Prog(1);
            CC2500Ram.RSSIScanCnt++;
          }
        }
        enableInterrupts();
      }
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    u08 CC2500_Read_RSSI_Prog(void)
    {
      u08 TxBuf[2], RxBuf[2];
    
      TxBuf[0] = (Access_Read_Single | CC2500_34_RSSI | 0x40);
      TxBuf[1] = 0xFF;
      CC2500_TransmitReceive(TxBuf, RxBuf, 2);
    
      return RxBuf[1];
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_RSSI_Bubble(u08 ByteCnt)
    {
      u08 i, j;
      u16 tData;
      bool SwapFlag;
    
      for (i = 0; i < ByteCnt; i++)
      {
        if (i < 9)
          CC2500Ram.RSSIChannel[i] = (i + 1);
        else if (i < 19)
          CC2500Ram.RSSIChannel[i] = 0x10 | (i - 9);
        else if (i < 29)
          CC2500Ram.RSSIChannel[i] = 0x20 | (i - 19);
        else if (i < 39)
          CC2500Ram.RSSIChannel[i] = 0x30 | (i - 29);
      }
    
      for (i = 1; i < (ByteCnt + 1); i++)
      {
        SwapFlag = 0;
    
        for (j = 0; j < (ByteCnt - i); j++)
        {
          if (CC2500_RSSI_Array[j] > CC2500_RSSI_Array[j + 1])
          { // Swap
            SwapFlag = 1;
            tData = CC2500_RSSI_Array[j];
            CC2500_RSSI_Array[j] = CC2500_RSSI_Array[j + 1];
            CC2500_RSSI_Array[j + 1] = tData;
    
            tData = CC2500Ram.RSSIChannel[j];
            CC2500Ram.RSSIChannel[j] = CC2500Ram.RSSIChannel[j + 1];
            CC2500Ram.RSSIChannel[j + 1] = tData;
          }
        }
    
        if (!SwapFlag)
          break;
      }
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_Enter_StbyMode(void)
    {
      CC2500_Strobe_Cmd(Cmd_SIDLE);
      Delay_1us(60);
      CC2500_Strobe_Cmd(Cmd_SCAL);
      CC2500_Strobe_Cmd(Cmd_SIDLE);
      Delay_1us(10);
      CC2500_Strobe_Cmd(Cmd_SCAL);
      Delay_1us(10);
    
      RF_TxEN_WriteL;
      RF_RxEN_WriteL;
      CC2500_IRQ_Input();
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_Enter_RxMode(void)
    {
      CC2500_Strobe_Cmd(Cmd_SIDLE);
      Delay_1us(60);
      CC2500_Strobe_Cmd(Cmd_SCAL);
      CC2500_Strobe_Cmd(Cmd_SIDLE);
      Delay_1us(10);
      CC2500_Strobe_Cmd(Cmd_SCAL);
      Delay_1us(10);
      CC2500_Strobe_Cmd(Cmd_SFRX);
      CC2500_Strobe_Cmd(Cmd_SRX);
    
      RF_TxEN_WriteL;
      RF_RxEN_WriteH;
      CC2500_IRQ_Exti_Input();
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_Enter_MasterRx(void)
    {
      CC2500_Strobe_Cmd(Cmd_SIDLE);
      Delay_1us(60);
      CC2500_Strobe_Cmd(Cmd_SCAL);
      CC2500_Strobe_Cmd(Cmd_SIDLE);
      Delay_1us(10);
      CC2500_Strobe_Cmd(Cmd_SCAL);
      Delay_1us(10);
      CC2500_Strobe_Cmd(Cmd_SFRX);
      CC2500_Strobe_Cmd(Cmd_SRX);
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_Enter_WorMode(void)
    {
      CC2500_Strobe_Cmd(Cmd_SWORRST);
      CC2500_Strobe_Cmd(Cmd_SWOR);
    
      RF_TxEN_WriteL;
      RF_RxEN_WriteL;
      CC2500_IRQ_Input();
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_Enter_SleepMode(void)
    {
      CC2500_Strobe_Cmd(Cmd_SIDLE);
      CC2500_Strobe_Cmd(Cmd_SPWD);
    
      RF_TxEN_WriteL;
      RF_RxEN_WriteL;
      // CC2500_IRQ_Input();
      CC2500_IRQ_Output();
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_TransmitData_Prog(u08 size)
    {
      u16 tout;
    
      RF_TxEN_WriteH;
      RF_RxEN_WriteL;
    
      CC2500_WriteReg_Multi(CC2500_TXFIFO, CC2500Ram.TxDataBuf, size);
      CC2500_Strobe_Cmd(Cmd_STX);
    
      tout = RF_Wait_TimeOut;
      while (!RF_IRQ_Read && tout)
        tout--;
    
      tout = RF_Wait_TimeOut;
      while (RF_IRQ_Read && tout)
        tout--;
    
      CC2500_Strobe_Cmd(Cmd_SFTX);
      CC2500_Strobe_Cmd(Cmd_SIDLE);
      CC2500_Strobe_Cmd(Cmd_SCAL);
    
      RF_TxEN_WriteL;
      RF_RxEN_WriteL;
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_Strobe_Cmd(u08 cmd)
    {
      u16 tout;
      u08 rData;
    
      tout = RF_Wait_TimeOut;
      while (RF_MISO_Read & tout)
        tout--;
    
      CC2500_TransmitReceive(&cmd, &rData, 1);
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    u08 CC2500_ReadReg(u08 addr)
    {
      u16 tout;
      u08 TxBuf[2], RxBuf[2];
    
      tout = RF_Wait_TimeOut;
      while (RF_MISO_Read & tout)
        tout--;
    
      TxBuf[0] = (Access_Read_Single | addr);
      TxBuf[1] = 0xFF;
      CC2500_TransmitReceive(TxBuf, RxBuf, 2);
    
      return RxBuf[1];
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_ReadReg_Multi(u08 addr, u08 *pBuf, u08 cnt)
    {
      u08 i;
      u16 tout;
      u08 TxBuf[20];
    
      tout = RF_Wait_TimeOut;
      while (RF_MISO_Read & tout)
        tout--;
    
      TxBuf[0] = (Access_Read_Burst | addr);
      for (i = 1; i < cnt; i++)
        TxBuf[i] = 0xFF;
    
      CC2500_TransmitReceive(TxBuf, pBuf, cnt);
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    u08 CC2500_Read_RxBytes_Prog(void)
    {
      u08 TxBuf[2], RxBuf[2];
    
      TxBuf[0] = (Access_Read_Single | CC2500_3B_RXBYTES | 0x04);
      TxBuf[1] = 0xFF;
      CC2500_TransmitReceive(TxBuf, RxBuf, 2);
    
      return RxBuf[0];
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_WriteReg(u08 addr, u08 value)
    {
      u16 tout;
      u08 TxBuf[2], RxBuf[2];
    
      tout = RF_Wait_TimeOut;
      while (RF_MISO_Read & tout)
        tout--;
    
      TxBuf[0] = (Access_Write_Single | addr);
      TxBuf[1] = value;
    
      CC2500_TransmitReceive(TxBuf, RxBuf, 2);
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_WriteReg_Multi(u08 addr, u08 *pBuf, u08 cnt)
    {
      u16 tout;
      u08 RxBuf[20];
    
      tout = RF_Wait_TimeOut;
      while (RF_MISO_Read & tout)
        tout--;
    
      *pBuf = (Access_Write_Burst | addr);
    
      CC2500_TransmitReceive(pBuf, RxBuf, cnt);
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    u16 CC2500_Get_ChipId(void)
    {
      u08 TxBuf[3], RxBuf[3];
    
      TxBuf[0] = (CC2500_30_PARTNUM | 0xC0);
      TxBuf[1] = 0xFF;
      TxBuf[2] = 0xFF;
      CC2500_TransmitReceive(TxBuf, RxBuf, 3);
    
      return (RxBuf[2] << 8) + RxBuf[1];
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_Set_TxPower(u08 power)
    {
      const u08 Tx_PA_Table[8] = {
          0xC5, 0x97, 0x6E, 0x7F,  // -12 -10 -8 -6dbm
          0xA9, 0xBB, 0xFE, 0xFF}; // -4 -2 0 1dbm
    
      CC2500_WriteReg(CC2500_3E_PATABLE, Tx_PA_Table[power & 0x07]);
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_Set_UserId(u08 id)
    {
      const u16 RfId[100] = {
          0xC368, 0x61B4, 0x4122, 0x30DA, 0x2714, 0x2091, 0x1BEA, 0x186D, 0x15B6, 0x138A,  // ID 0-9
          0x11C3, 0x1048, 0x0F08, 0x0DF5, 0x0D06, 0x0C36, 0x087E, 0x0ADB, 0x0A48, 0x09C5,  // ID 10-19
          0x094E, 0x08E1, 0x087E, 0x0824, 0x07D0, 0x0784, 0x073C, 0x06FA, 0x06BC, 0x0683,  // ID 20-29
          0x0640, 0x061B, 0x05EB, 0x05BF, 0x0595, 0x056D, 0x0548, 0x0524, 0x0502, 0x04E2,  // ID 30-39
          0x04C4, 0x04A7, 0x048B, 0x0470, 0x0457, 0x043F, 0x0428, 0x0412, 0x03FC, 0x03E8,  // ID 40-49
          0x03D4, 0x03C2, 0x03AF, 0x039E, 0x038D, 0x037D, 0x036D, 0x035E, 0x034F, 0x0341,  // ID 50-59
          0x0334, 0x0326, 0x031A, 0x030D, 0x0301, 0x02F5, 0x02EA, 0x02DF, 0x02D4, 0x02CA,  // ID 60-69
          0x02C0, 0x02B6, 0x02AD, 0x02A4, 0x029A, 0x0292, 0x0289, 0x0281, 0x0279, 0x0271,  // ID 70-79
          0x0269, 0x0262, 0x025A, 0x0253, 0x024C, 0x0245, 0x023E, 0x0238, 0x0232, 0x022B,  // ID 80-89
          0x0225, 0x021F, 0x0219, 0x0214, 0x020E, 0x0209, 0x0203, 0x01FE, 0x01F9, 0x01F4}; // ID 90-99
    
      CC2500_WriteReg(CC2500_04_SYNC1, RfId[id] >> 8);
      CC2500_WriteReg(CC2500_05_SYNC0, RfId[id] & 0x00FF);
      Delay_1us(30);
      CC2500_Strobe_Cmd(Cmd_SCAL);
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_Set_ChFreq(u08 chfr)
    {
      u32 SetFreq;
    
      const u32 RfChFreq[32] = {
          0x5CCEC4, 0x5CDD89, 0x5CEC4E, 0x5D0000, 0x5D0EC4, 0x5D1D89, 0x5D313B, 0x5D4000,  // CH00-08
          0x5D5627, 0x5D6276, 0x5D713B, 0x5D8762, 0x5D93B1, 0x5DA276, 0x5DB3B1, 0x5DC4EC,  // CH09-16
          0x5DD3B1, 0x5DE9D8, 0x5DF627, 0x5E04EC, 0x5E1B13, 0x5E2762, 0x5E3627, 0x5E4C4E,  // CH17-24
          0x5E589D, 0x5E6762, 0x5E7D89, 0x5E89D8, 0x5E989D, 0x5EAEC4, 0x5EBB13, 0x5EC9D8}; // CH25-32
    
      SetFreq = RfChFreq[chfr];
      CC2500_WriteReg(CC2500_0D_FREQ2, SetFreq >> 16);
      CC2500_WriteReg(CC2500_0E_FREQ1, SetFreq >> 8);
      CC2500_WriteReg(CC2500_0F_FREQ0, SetFreq & 0x0000FF);
      Delay_1us(30);
      CC2500_Strobe_Cmd(Cmd_SCAL);
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_IRQ_Input(void)
    {
      GPIO_InitTypeDef GPIO_InitStruct = {0};
    
      GPIO_InitStruct.Pin = RF_IRQ_Pin;
      GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
      GPIO_InitStruct.Pull = GPIO_PULLUP;
      HAL_GPIO_Init(RF_IRQ_GPIO_Port, &GPIO_InitStruct);
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_IRQ_Output(void)
    {
      GPIO_InitTypeDef GPIO_InitStruct = {0};
    
      GPIO_InitStruct.Pin = RF_IRQ_Pin;
      GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
      GPIO_InitStruct.Pull = GPIO_NOPULL;
      HAL_GPIO_Init(RF_IRQ_GPIO_Port, &GPIO_InitStruct);
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_IRQ_Exti_Input(void)
    {
      GPIO_InitTypeDef GPIO_InitStruct = {0};
    
      GPIO_InitStruct.Pin = RF_IRQ_Pin;
      GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
      GPIO_InitStruct.Pull = GPIO_PULLUP;
      HAL_GPIO_Init(RF_IRQ_GPIO_Port, &GPIO_InitStruct);
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    void CC2500_TransmitReceive(u08 *TxData, u08 *RxData, u08 Cnt)
    {
      u08 i;
      u16 Tout;
    
      RF_CSN_WriteL;
      for (i = 0; i < Cnt; i++)
      {
        Tout = RF_SPI_TimeOut;
        while (!LL_SPI_IsActiveFlag_TXE(SPI3) && Tout)
          Tout--;
        if (Tout)
          LL_SPI_TransmitData8(SPI3, *TxData++);
        Tout = RF_SPI_TimeOut;
        while (LL_SPI_IsActiveFlag_BSY(SPI3) && Tout)
          Tout--;
    
        Tout = RF_SPI_TimeOut;
        while (!LL_SPI_IsActiveFlag_RXNE(SPI3) && Tout)
          Tout--;
        if (Tout)
          *RxData++ = LL_SPI_ReceiveData8(SPI3);
        Tout = RF_SPI_TimeOut;
        while (LL_SPI_IsActiveFlag_BSY(SPI3) && Tout)
          Tout--;
      }
      RF_CSN_WriteH;
    }
    
    /**
     * @brief Sub
     * @param None
     * @retval None
     */
    // void CC2500_REnter_WorMode(void)
    // {
    //   CC2500_Strobe_Cmd(Cmd_SIDLE);
    //   CC2500_WriteReg(CC2500_20_WORCTRL, 0x08);
    //   CC2500_WriteReg(CC2500_1E_WOREVT1, 0x2B); // 43B5 500ms, 28A0 300ms 1B15 200ms
    //   CC2500_WriteReg(CC2500_1F_WOREVT0, 0x15); // 876B 1S
    //   CC2500_WriteReg(CC2500_16_MCSM2, 0x03);   // RX_TIME // RX_TIME_RSSI= 1  RX_TIME_QUAL = 0
    //   // 0:12.5%, 1:6.25%, 2:3.125%, 3:1.563%, 4:0.781%
    //   CC2500_WriteReg(CC2500_18_MCSM0, 0x38); // 频率校准方式,每4次从IDLE模式到RX模式进行一次频率合成器校准
    //   CC2500_Strobe_Cmd(Cmd_SWORRST);
    //   CC2500_Strobe_Cmd(Cmd_SWOR);
    // }
    
    /**************** (C) COPYRIGHT Green Vision Design ****************/
    

    Thanks for your support!

    B&R,

    Galaxy

  • Hello Galaxy, 

    Since the CC2500 is a transceiver the host setup is quite important, best case is for the customer to try and replicate using TI-provided software (CC2500 data sheet, product information and support | TI.com); but we would still have trouble replicating the customers exact setup. You can try and leverage the Errata (CC2500 Errata Notes (Rev. E) (ti.com)). Otherwise, if the customer can, try to enable debug on the host setup to debug the device, since we have limited support from our end. 

    Thanks,
    Alex F

  • Hi Alex F,

    How long does it take to delay after the software issues the Chip Reset command? #define Cmd_SRES 0x30 // Reset chip I am now delayed by 1ms

    B&R,

    Galaxy

  • Hello Galaxy

    A way of checking the delay could be by making use of LEDs or GPIO ports, you can try setting an LED (or GPIO) high right before Chip Reset, then low right after, and check the delta (time) between them to confirm the specific delay. Since the CC2500 is a transceiver what is controlling it? 

    From the datasheet, it seems like you may need to wait for the SO to go low again before the next command can be issued. 

    Thanks,
    Alex F