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.

how do I configure the CC2530 with PA and LNA

Other Parts Discussed in Thread: CC2530, CC2590, Z-STACK, CC2591, CC2592, CSD

Hi Guys,

I´m working to configure Ebyte Module E18-MS1PA2 CC2530 (w/ PA and LNA inside), but I didn´t have success to setting it correctly. According the Ebyte datasheet is necessary to change those files hal_board_cfg.h, mac_radio_defs.c and mac_pib.c.  Even after setting up it nothing is happaning!

Note: I tryng to incluse HAL_PA_LNA or HAL_PA_LNA_CC2590, one at time, on IAR compiler option, but I saw erros on mac_pib.c. I dodn´t know if it is necessary to do!

I using at this moment the Z-Stack Home 1.2.2a.44539.

I did tE18-MS1PA2-PCB_UserManual_EN_v1.0.pdfhose configurations on files:

on HAL_board_cfg.c - on global variables.

/* ------------------------------------------------------------------------------------------------
 *                                       CC2590/CC2591 support
 *
 *                        Define HAL_PA_LNA_CC2590 if CC2530+CC2590EM is used
 *                        Define HAL_PA_LNA if CC2530+CC2591EM is used
 *                        Note that only one of them can be defined
 * ------------------------------------------------------------------------------------------------
 */
#define HAL_PA_LNA
#define xHAL_PA_LNA_CC2590

on mac_radio_defs.c - insite the macRadioTurnOnPower(void) function

, I have set up the P1.1 and P1.0 settings at the end of function (from lines #46 to #52).

note: I have nothing connected physically on CC2530 on those pins.

MAC_INTERNAL_API void macRadioTurnOnPower(void)
{
  /* Enable RF error trap */
  MAC_MCU_RFERR_ENABLE_INTERRUPT();

#if defined MAC_RUNTIME_CC2591 || defined MAC_RUNTIME_CC2590 || \
    defined MAC_RUNTIME_SE2431L || defined MAC_RUNTIME_CC2592
  /* table ID is referenced only when runtime configuration is enabled */
  if (macRadioDefsRefTableId & 0xf0)
#endif /* defined MAC_RUNTIME_CC2591 || defined MAC_RUNTIME_CC2590 */

#if defined MAC_RUNTIME_CC2591 || defined MAC_RUNTIME_CC2590 || \
    defined MAC_RUNTIME_SE2431L || defined MAC_RUNTIME_CC2592 || \
    defined HAL_PA_LNA || defined HAL_PA_LNA_CC2590 || \
    defined HAL_PA_LNA_SE2431L || defined HAL_PA_LNA_CC2592
  { /* either if compound statement or non-conditional compound statement */
    
    /* (Re-)Configure PA and LNA control signals to RF frontend chips.
    * Note that The register values are not retained during sleep.
    */
    
    if (paLnaChip == PA_LNA_SE2431L)
    {
      /* CPS or P0_7 maps closely to the HGM line */
      HAL_PA_LNA_RX_HGM(); 
  
      /* EN or CSD line is controlled via software so setting it high here to start the SE2431L frontend */
      HAL_PA_LNA_RX_CSD_HIGH();
      
      /* CTX or P1_1 maps closely to PAEN */
      RFC_OBS_CTRL0 = RFC_OBS_CTRL_PA_PD_INV;
      OBSSEL1       = OBSSEL_OBS_CTRL0;
    }
    else if(paLnaChip == PA_LNA_CC2592)
    {
      /* P1_1 -> PAEN */
      RFC_OBS_CTRL0 = RFC_OBS_CTRL_PA_PD_INV;
      OBSSEL1       = OBSSEL_OBS_CTRL0;
      
      /* P1_0 -> EN (LNA control) */
      RFC_OBS_CTRL1 = RFC_OBS_CTRL_LNAMIX_PD_INV;
      OBSSEL0       = OBSSEL_OBS_CTRL1;
    }  
    else 
    {   
      /* P1_1 -> PAEN */
      RFC_OBS_CTRL0 = RFC_OBS_CTRL_PA_PD_INV;
      OBSSEL1       = OBSSEL_OBS_CTRL0;
      
      /* P1_0 -> EN (LNA control) */
      RFC_OBS_CTRL1 = RFC_OBS_CTRL_LNAMIX_PD_INV;
      OBSSEL0       = OBSSEL_OBS_CTRL1;
    }
    
    /* For any RX, change CCA settings for CC2591 compression workaround.
    * This will override LNA control if CC2591_COMPRESSION_WORKAROUND
    * flag is defined.
    */
  }

on mac_pib.c - inside the macPib_t macPibDefaults local variables

/* ------------------------------------------------------------------------------------------------
 *                                           Local Variables
 * ------------------------------------------------------------------------------------------------
 */

/* PIB default values */
static CODE const macPib_t macPibDefaults =
{
  54,                                         /* ackWaitDuration */
  FALSE,                                      /* associationPermit */
  TRUE,                                       /* autoRequest */
  FALSE,                                      /* battLifeExt */
  #if defined (HAL_PA_LNA)					  /*Proprietary Ebyte*/
  20,
  #elif defined (HAL_PA_LNA_CC2590)
  11,
  #else
  #endif 
  6,                                          /* battLifeExtPeriods */
  NULL,                                       /* *pMacBeaconPayload */
  0,                                          /* beaconPayloadLength */
  MAC_BO_NON_BEACON,                          /* beaconOrder */
  0,                                          /* beaconTxTime */
  0,                                          /* bsn */

  {0, SADDR_MODE_EXT},                        /* coordExtendedAddress */
  MAC_SHORT_ADDR_NONE,                        /* coordShortAddress */
  0,                                          /* dsn */
  FALSE,                                      /* gtsPermit */
  4,                                          /* maxCsmaBackoffs */

  3,                                          /* minBe */
  0xFFFF,                                     /* panId */
  FALSE,                                      /* promiscuousMode */
  FALSE,                                      /* rxOnWhenIdle */
  MAC_SHORT_ADDR_NONE,                        /* shortAddress */

  MAC_SO_NONE,                                /* superframeOrder */
  0x01F4,                                     /* transactionPersistenceTime */
  FALSE,                                      /* assocciatedPanCoord */
  5,                                          /* maxBe */
  1220,                                       /* maxFrameTotalWaitTime */

  3,                                          /* maxFrameRetries */
  32,                                         /* ResponseWaitTime */
  0,                                          /* syncSymbolOffset */
  TRUE,                                       /* timeStampSupported */
  FALSE,                                      /* securityEnabled */

  /* Proprietary */
  0,                                          /* phyTransmitPower */
  MAC_CHAN_11,                                /* logicalChannel */
  {0, SADDR_MODE_EXT},                        /* extendedAddress */
  1,                                          /* altBe */
  MAC_BO_NON_BEACON,                          /* deviceBeaconOrder */
  0,                                          /* power savings for rf4ce */
  0,                                          /* default is frame Ver is always 0, 
                                                 except for security enabled packets */
  0,                                          /* diagsRxCrcPass */
  0,                                          /* diagsRxCrcFail */
  0,                                          /* diagsRxBcast */
  0,                                          /* diagsTxBcast */
  0,                                          /* diagsRxUcast */
  0,                                          /* diagsTxUcast */
  0,                                          /* diagsTxUcastRetry */
  0                                           /* diagsTxUcastFail */
};

  • Hi Alexander,

    What do you mean by "nothing is happening"?  What errors do you see when defining HAL_PA_LNA and what version of IAR EWARM are you using? Have you removed HOLD_AUTO_START, set up a sniffer to view over-the-air packets, and used a logic analyzer to monitor the PA_EN/LNA_EN lines?  What sample application have you loaded into the CC2530?  You should contact the module developers for further information regarding intended operation.

    I highly recommend that you consider the SimpleLink CC13X2 & CC26X2 devices, LaunchPads, and third-party EVMs for a more robust Zigbee solution, quarterly updated software, and internal-PA device options.

    Regards,
    Ryan

  • Hi Ryan, Thanks for your reply!

    I´ll answer you bellow.

    Firstly for you understanding better my environment, I have a custom board that supports two Ebyte radio models, 1st E18-MS1PA2 (LNA inside) and E18-MS1 (without LNA). My reference is E18-MS1, that works very with my App/Code, I men that the last one starting and attaching in the gateway. Because of this I didn´t use protocol analyzer to inspect the e!8-MS1PA2 behavior.

    1. When I said "nothing is happening", - Sorry for that I didn´t included details here. My custom board with MS1-PA2 don´t attach on the gateway!

    2. I removed HOLD_AUTO_START before, as I said the MS1 Board connecting on the gateway.

    3. My application is based on sampleLight, but I have made a few changes, but I have preserved hal_board_cfg.c 

    4. I have contacted Ebyte to check if I need to do something additional, but they told me that I need check the datasheet attached, and that I need to pay attention on P1.0 and P1.1.

     I included one of them HAL_PA_LNA or HAL_PA_LNA_CC2590 on IAR compiler options. But When I included and started to rebuild all on IAR, I have those errors:

    BR,

    Alex

  • In Z-Stack home 1.2.2a, I don't think you need to add those codes in macPibDefaults of mac_pib.c. Only define HAL_PA_LNA to test E18-MS1PA2 to see if it works.

  • It's good that your environment has a working setup to test against.  I agree with YK, for Z-Stack HA 1.2.2a it should not be necessary to make changes to macPibDefaults.  And as Ebyte noted you should further evaluate P1.0/1.1 if you continue to experience issues.

    Regards,
    Ryan

  • Hi Ryan and Mr. YK, 

    Thanks for all!

    I got success to configure the Ebyte MS1PA2 Radio Module. 

    I did two settings, acoording Mr YK told me, I have include HAL_PA_LNA on compiler options and keep those code lines bellow , at the end (else) of  macRadioTurnOnPower function, on mac_radio_defs.c. As they can see on code:

    MAC_INTERNAL_API void macRadioTurnOnPower(void)
    {
      /* Enable RF error trap */
      MAC_MCU_RFERR_ENABLE_INTERRUPT();
    
    #if defined MAC_RUNTIME_CC2591 || defined MAC_RUNTIME_CC2590 || \
        defined MAC_RUNTIME_SE2431L || defined MAC_RUNTIME_CC2592
      /* table ID is referenced only when runtime configuration is enabled */
      if (macRadioDefsRefTableId & 0xf0)
    #endif /* defined MAC_RUNTIME_CC2591 || defined MAC_RUNTIME_CC2590 */
    
    #if defined MAC_RUNTIME_CC2591 || defined MAC_RUNTIME_CC2590 || \
        defined MAC_RUNTIME_SE2431L || defined MAC_RUNTIME_CC2592 || \
        defined HAL_PA_LNA || defined HAL_PA_LNA_CC2590 || \
        defined HAL_PA_LNA_SE2431L || defined HAL_PA_LNA_CC2592
      { /* either if compound statement or non-conditional compound statement */
        
        /* (Re-)Configure PA and LNA control signals to RF frontend chips.
        * Note that The register values are not retained during sleep.
        */
        
        if (paLnaChip == PA_LNA_SE2431L)
        {
          /* CPS or P0_7 maps closely to the HGM line */
          HAL_PA_LNA_RX_HGM(); 
      
          /* EN or CSD line is controlled via software so setting it high here to start the SE2431L frontend */
          HAL_PA_LNA_RX_CSD_HIGH();
          
          /* CTX or P1_1 maps closely to PAEN */
          RFC_OBS_CTRL0 = RFC_OBS_CTRL_PA_PD_INV;
          OBSSEL1       = OBSSEL_OBS_CTRL0;
        }
        else if(paLnaChip == PA_LNA_CC2592)
        {
          /* P1_1 -> PAEN */
          RFC_OBS_CTRL0 = RFC_OBS_CTRL_PA_PD_INV;
          OBSSEL1       = OBSSEL_OBS_CTRL0;
          
          /* P1_0 -> EN (LNA control) */
          RFC_OBS_CTRL1 = RFC_OBS_CTRL_LNAMIX_PD_INV;
          OBSSEL0       = OBSSEL_OBS_CTRL1;
        }  
        else 
        {   
    		// proprietary for Ebyte MS1APA2-PCB
          /* P1_1 -> PAEN */
          RFC_OBS_CTRL0 = RFC_OBS_CTRL_PA_PD_INV;
          OBSSEL1       = OBSSEL_OBS_CTRL0;
          
          /* P1_0 -> EN (LNA control) */
          RFC_OBS_CTRL1 = RFC_OBS_CTRL_LNAMIX_PD_INV;
          OBSSEL0       = OBSSEL_OBS_CTRL1;
        }
        
        /* For any RX, change CCA settings for CC2591 compression workaround.
        * This will override LNA control if CC2591_COMPRESSION_WORKAROUND
        * flag is defined.
        */
      }

    Thanks Guys.

    BR

    Alex