MC13213 Internal T/R Antenna Switch (using BeeStack)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MC13213 Internal T/R Antenna Switch (using BeeStack)

3,021 Views
Ware
Contributor III
 
NOTE: I am using one antenna, one balun, and one matching ckt connected to the RFIN+/RFIN- pins with nothing connected to the PAO+/PAO- pins... Just like the "SINGLE PORT MODE" demo board FSL564-1 SED.  So without this feature enabled, my radio will not transmit (only receives).
 
 
 
I asked a similar question regarding the Internal TR Antenna Switch in late 2006:
 
Mads (FSL Specialist) was nice enough to inform me that the internal TR antenna switch can be enabled in the NV_Data.c (for SMAC / 802.15.4 MAC codebases) at the same location (after the MAC Address) where it was in Z-Stack.
 
Now I am using the BeeStack codebase (with BeeKit) and I have discovered that "NV_Data.c" is using a different format.  It looks like from all of the low level ABEL drivers that the internal TR antenna switch was not considered for the BeeStack codebase.
 
Even where "MC1319XREG.H" defines ABEL_CONTROL2_REG (which is the regsiter that enables this feature in the radio...  ABEL_reg7) bit 12 (RF_switch_mode) is not defined anymore.  (see section 3.9.2 of MC1321x_RefManual)
 
Will I be able to skip over all the BeeStack layers and directly write to this register to enable this and pray that the invisible depths of the BeeStack libraries will not overwrite this?  :smileyhappy:
 
By using:  
Code:
MC1319xDrv_WriteSpiSync(ABEL_CONTROL2_REG, (ctrl2val | 0x1000) );

 
If not, any plans on supporting the "Internal T/R Antenna Switch" feature of the MC1321x in future versions of the BeeStack codebase?
 
Thanks,
 - Ware
 
Labels (1)
0 Kudos
6 Replies

527 Views
Spell
Contributor I
Hi Ware,
I'm using a custom board with MC13213 and a single port mode...

This is my method to set the internal T/R antenna switch:
Code:
FILE: Mc1319xReg.h/**  Register 0x07 aka ABEL_CONTROL2_REG*/#define ABEL_CONTROL2_REG ABEL_reg7#define cTMR_LOAD       (1<<15)#define cCT_BiasEn      (1<<14)#define cRF_SwitchMode  (1<<12)#define cCLKO_DOZE_EN   (1<<9)#define cABEL2SPI_MASK  (1<<8)#define cTX_DONE_MASK   (1<<7)#define cRX_DONE_MASK   (1<<6)#define cUSE_STRM_MODE  (1<<5)#define cHG_BIAS_EN     (1<<4)#define cHG_EN          (1<<2)#define cHIB_EN         (1<<1)#define cDOZE_EN        (1<<0)FILE: Mc1319xHandler.cMC1319xDrv_ReadSpiSync(ABEL_CONTROL2_REG, &ctrl2val);    ctrl2val = ctrl2val & ~(  (uint16_t)cDOZE_EN | (uint16_t)cCLKO_DOZE_EN
       | (uint16_t)cHIB_EN | (uint16_t)cCT_BiasEn
                            | (uint16_t)cRF_SwitchMode);#if USE_INTERRUPT_TXEOF    ctrl2val = ctrl2val | (uint16_t) cTX_DONE_MASK;#endif  #if USE_INTERRUPT_RXEOF    ctrl2val = ctrl2val | (uint16_t) cRX_DONE_MASK;#endif      MC1319xDrv_WriteSpiSync(ABEL_CONTROL2_REG, ctrl2val);

 However if you create a new project using BeeKit codebase you can simply edit the user defined target settings and uncheck the 'Use External Antenna Switch' option.

Regards,
Filippo

0 Kudos

527 Views
Ware
Contributor III
 
To me, it looks like your MODs of the "Mc1319xHandler.c" file would actually clear the "cRF_SwitchMode" bit (putting it in dual port mode...  and only when waking up from a low power mode.
 
I thought it would be something like this:
Code:
// | Group\Sub-Group\Filename      | Line(s)    // |-------------------------------|-----------// | MacPhy\Phy\PhyMain.c          | 170-177    // Setup default antenna switch mode  if (useDualAntenna == TRUE){    MC1319xDrv_ReadSpiAsync(ABEL_CONTROL2_REG, &retReg);    retReg &= 0x8FFF;    retReg |= 0x4000; // Dual antenna setup at boot, CT_Bias_en = 1, RF_switch_mode = 0, CT_Bias_inv = 0    MC1319xDrv_WriteSpiAsync(ABEL_CONTROL2_REG, retReg);  }  else   {   // Single antenna setup at boot, CT_Bias_en = 1, RF_switch_mode = 1, CT_Bias_inv = 0    MC1319xDrv_ReadSpiAsync(ABEL_CONTROL2_REG, &retReg);    retReg &= 0x8FFF;    retReg |= ((uint16_t)cCT_BiasEn | (uint16_t)cRF_SwitchMode);    MC1319xDrv_WriteSpiAsync(ABEL_CONTROL2_REG, retReg);  }

 
This would set the set the "cRF_SwitchMode" during the radio's initialization (as long as the "useDualAntenna" N.V. parameter was not set to TRUE)...  see lines 153-159 of "NV_Data.c" and line 167 of "PortConfig.h".
 
But then again, my code isn't working yet.  :smileysad:
 
Regards,
 - Ware
 
0 Kudos

527 Views
Spell
Contributor I
At the beginning I had a similar problem because I didn't able to set correctly the modem register.

Take a look to this topic for more details:
http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&message.id=6490#M6490

regards,
Filippo
0 Kudos

527 Views
Ware
Contributor III
 
I have the SINGLE PORT MODE working on my hardware (using BeeStack v1.0.2 (April '07) codebase)... after working out a few hardware issues.
 
For future reference see the following:
 - Freescale AN3248 (for hardware and peripheral background info).
 - Like SPELL / Flippo says, edit the FILE: "Mc1319xReg.h" (lines 141-143)
Code:
/**  Register 0x07 aka ABEL_CONTROL2_REG*/#define ABEL_CONTROL2_REG ABEL_reg7#define cTMR_LOAD       (1<<15)#define cCT_BiasEn      (1<<14)#define cRF_SwitchMode  (1<<12)#define cCLKO_DOZE_EN   (1<<9)#define cABEL2SPI_MASK  (1<<8)#define cTX_DONE_MASK   (1<<7)#define cRX_DONE_MASK   (1<<6)#define cUSE_STRM_MODE  (1<<5)#define cHG_BIAS_EN     (1<<4)#define cHG_EN          (1<<2)#define cHIB_EN         (1<<1)#define cDOZE_EN        (1<<0)

 
- Then modify "MacPhy\Phy\PhyMain.c" (lines 170-177)
Code:
    // Setup default antenna switch mode  if (useDualAntenna == TRUE){    MC1319xDrv_ReadSpiAsync(ABEL_CONTROL2_REG, &retReg);    retReg &= 0x8FFF;    retReg |= 0x4000; // Dual antenna setup at boot, CT_Bias_en = 1, RF_switch_mode = 0, CT_Bias_inv = 0    MC1319xDrv_WriteSpiAsync(ABEL_CONTROL2_REG, retReg);  }  else   {   // Single antenna setup at boot, CT_Bias_en = 1, RF_switch_mode = 1, CT_Bias_inv = 0    MC1319xDrv_ReadSpiAsync(ABEL_CONTROL2_REG, &retReg);    retReg &= 0x8FFF;    retReg |= ((uint16_t)cCT_BiasEn | (uint16_t)cRF_SwitchMode);    MC1319xDrv_WriteSpiAsync(ABEL_CONTROL2_REG, retReg);  }

- Lastly, check lines 153-159 of "NV_Data.c" and line 167 of "PortConfig.h" to ensure "useDualAntenna" is defined as FALSE 

NOTE: My "PhyMain.c" mod could be re-writen/optimized (I purposely left it like this to help people find the original code).
NOTE 2:  When Freescale updates their BeeStack codebase in BeeKit, this may not apply.
Regards,
 - Ware
 
0 Kudos

527 Views
mou
Contributor III
Hi,
I am using Beekit SMAC Codebase to program Develco modules.Can anyone suggest me how to set the "useDualAntenna" parameter to false in NV_Data.c file in the SMAC Codebase? The NV_Data.c file in SMAC codebase doesnot contain any parameter named useDualAntenna.

Regards,
Maumita Chakraborty




































0 Kudos

527 Views
Ware
Contributor III
 
SMAC has a few differences from BeeStack...  The instructions above have only been verfied with BeeStack... but it might work.  You want to make sure the pre-compiler options work out so that the "useDualAntenna" location in "NV_Data.c" works out to false (see code below).
 
 
Code:
 /*useDualAntenna*///#ifdef TARGET_TOROWEAP#if (defined(TARGET_TOROWEAP))   TRUE,#elif (defined(TARGET_USER_DEFINED) )    #include "PortConfig.h"  #if(gUserTransceiverType_d == MC1321x)    TRUE,    #else    FALSE,  #endif  #else  FALSE,#endif /* TARGET_TOROWEAP */

 
 
NOTE:  The pre-compiler options are changed by "-D" command line parameters for the "Compiler for HC08" in the Target Settings window AND in header files like SMAC's "AppToPlatformConfig.h".
 
- Ware
0 Kudos