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.

CC1120EM-420-470-RD: no feedback on GPIO2 after STX command

Part Number: CC1120EM-420-470-RD

I would like to porting driver to STM32 and found that will block on GPIO2 no response after STX command.

I set "CC112X_SETTLING_CFG = 0x00B" and my partversion is 0x23 no run manual calibration.

my initial register setting as below: (all hex value)

CC112X_IOCFG3 b0
CC112X_IOCFG2 6
CC112X_IOCFG1 b0
CC112X_IOCFG0 40
CC112X_SYNC_CFG1 b
CC112X_DCFILT_CFG 1c
CC112X_PREAMBLE_CFG1 18
CC112X_IQIC c6
CC112X_CHAN_BW 8
CC112X_MDMCFG0 5
CC112X_AGC_REF 20
CC112X_AGC_CS_THR 19
CC112X_AGC_CFG1 a9
CC112X_AGC_CFG0 cf
CC112X_FIFO_CFG 0
CC112X_SETTLING_CFG b
CC112X_FS_CFG 14
CC112X_PKT_CFG0 20
CC112X_PA_CFG2 77
CC112X_PKT_LEN ff
CC112X_IF_MIX_CFG 0
CC112X_FREQOFF_CFG 22
CC112X_FREQ2 69
CC112X_FREQ1 F8
CC112X_FS_DIG1 0
CC112X_FS_DIG0 5f
CC112X_FS_CAL1 40
CC112X_FS_CAL0 e
CC112X_FS_DIVTWO 3
CC112X_FS_DSM0 33
CC112X_FS_DVC0 17
CC112X_FS_PFD 50
CC112X_FS_PRE 6e
CC112X_FS_REG_DIV_CML 14
CC112X_FS_SPARE ac
CC112X_FS_VCO0 b4
CC112X_XOSC5 e
CC112X_XOSC1 3
CC112X_PARTNUMBER 48
CC112X_PARTVERSION 23
CC112X_SYNC3 93
CC112X_SYNC2 b
CC112X_SYNC1 51
CC112X_SYNC0 de



Q1.the same register setting value can run on Arduino UNO(also polled GPIO2), but failed on STM32, anything need to beware for the setting?

Q2.How to confirm issue STX successfully? read MARCSTATE = 0x34? or....?

Q3.if Tx can be confirmed works (Q2.), Tx and Rx both run the same register setting, Does it mean after Rx set to SRX  that can read data from Rx FIFO? (refer to my sample Rx code as below)?

I listed my code snippet again to show more clear information.
/*******************    TX  main procedure*********************/

  while (1)
  { 
      trxSpiCmdStrobe(CC112X_SFTX);
      set_idle();

      cc112xSpiWriteTxFifo(sendData, strlen(sendData));
      do{
            trxSpiCmdStrobe(CC112X_SFSTXON);
      } while(v != 0x12);

      do{
            trxSpiCmdStrobe(CC112X_STX);
      } while(v != 0x34);

      while (!HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_1)); // it will block on this point (GPIO2)!!

      while (HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_1)); //GPIO2 PIN

      HAL_Delay(500);
  }

/*******************    RX  main procedure*********************/

#define RX_FIFO_ERROR       0x11

  while (1)
  {
      trxSpiCmdStrobe(CC112X_SIDLE);          //sets to idle first. must be in

      do {
        cc112xSpiReadReg(CC112X_MARCSTATE, &marcstate, 1);
    } while (marcstate != 0x41);
    trxSpiCmdStrobe(CC112X_SCAL);
    trxSpiCmdStrobe(CC112X_SRX);

      cc112xSpiReadReg(CC112X_NUM_RXBYTES, &v, 1);

      // Check that we have bytes in FIFO
      if(v != 0)
      {
        // Read MARCSTATE to check for RX FIFO error
        cc112xSpiReadReg(CC112X_MARCSTATE, &marcstate, 1);

        // Mask out MARCSTATE bits and check if we have a RX FIFO error
        if((marcstate & 0x1F) == RX_FIFO_ERROR)
        {
          // Flush RX FIFO
          trxSpiCmdStrobe(CC112X_SFRX);
        }
        else
        {
          // Read n bytes from RX FIFO
          cc112xSpiReadRxFifo(rxBuffer, v);

          char *msg2 = "Receive data: ";
          HAL_UART_Transmit(&huart2, (uint8_t*)msg2, strlen(msg2), 0xFFFF);
          for(int i=0;i<=strlen(rxBuffer);i++)
          {
             //read rxBuffer data
          }
        }
      }
      trxSpiCmdStrobe(CC112X_SRX);

      HAL_Delay(500);
  }

Thanks in advance

  • The settings are the settings taken from Smart RF Studio and they are OK. Since you have already tested the settings, you know that they are fine, and the same settings can be used for both RX and TX.

    If they do not work when you are configuring them from the STM32, you need to confirm that the SPI is according to spec when it comes to the polarity, phase, rise time, fall time etc.

    To do TX you need the following steps:

    1. Reset device
    2. Configure all the registers
    3. Write the packet to the TX FIFO (read back the NUM_TXBYTES to see that the packet is in the FIFO)
    4. Strobe STX
    5. Wait for falling edge interrupt on GPIO2 (need to verify that this work on the STM32)
    6. After the falling edge interrupt you can read back NUM_TXBYTES (should now be 0). MARCSTATE should be IDLE

    1. Strobe SRX (assume the device has been reset and configured, and are not in an error state)
    2. Wait for falling edge interrupt on GPIO2 (need to verify that this work on the STM32)
    3. After the falling edge interrupt you can read back NUM_RXBYTES  to see how many bytes are in the RX FIFO, and then
    4. Read the RX FIFO

    Siri