MC1321X - BeeStack - Low Power Mode - Adjusting PA Level On-The-Fly

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

MC1321X - BeeStack - Low Power Mode - Adjusting PA Level On-The-Fly

1,413 Views
Ware
Contributor III
RE: Pre-Amp (Radio's Transmit Power) Level
 
Using Freescale MC13213 with BeeStack 1.04 I am able to adjust the PA level "on-the-fly" with my coord device that does NOT go to sleep.
 
Code:
        MC1319xDrv_ReadSpi(ABEL_reg12, &abel_reg_val);        abel_reg_val &= 0xFF00;        abel_reg_val |= pa_lvl;  // <------------- new value of PA Level        MC1319xDrv_WriteSpi(ABEL_reg12, abel_reg_val);

 
But when I try to use the same code to adjust the PA level "on the fly" with a my end device that is going to sleep, it doesn't work...  I believe what is happening is that the Phy_InitOnStartup() function (called by PWR_RunAgain() every time the device wakes up) is setting ABEL_reg12 to a hardcoded PA Level in setupValueTable[].
 
But even when I force ABEL_reg12 back to the variable PA Level inside Phy_InitOnStartup(), it seems to remain at the hardcoded value.
 
By-the-way, this is all an assumption based on SNA/Sniffer "LQI readings", since I cannot use the BDM to debug this, since I would have to turn off the sleep mode to use BDM interface.
 
Any ideas on how to force the PA Level (in the ABEL_reg12) on a device that goes to sleep?
 
Thanks,
 - Ware
 
Labels (1)
0 Kudos
3 Replies

348 Views
Ware
Contributor III
 
PROBLEM SOLVED.
 
Posting this for closure (in case anyone else needs to do this).
 
In the PhyPlmeSetCurrentChannelRequest() function in "...\MacPhy\Phy\Primitives\GetSet.c" you need to change the following line:
  PowerLevel |= tmpLevel;
to
  PowerLevel |= extGlobalNewPaLevel;
 
Code:
    // Write PA level for the channel.  MC1319xDrv_ReadSpiSync(ABEL_reg12, &PowerLevel);  PowerLevel &= 0xFF00;  PowerLevel |= extGlobalNewPaLevel; // VARIBALE PA_LVL -- for some reason they hardcode PA_LVL  MC1319xDrv_WriteSpiSync(ABEL_reg12, PowerLevel);

 
I guess PhyPlmeSetCurrentChannelRequest() is called from somewhere inside the compiled Library part of BeeStack (when using low power modes) every time the device wakes up...  and this was resetting my variable PA_LVL with the hardcoded "tmpLevel" PA_LVL.
 
Regards,
 - Ware
 
0 Kudos

348 Views
Mads
Contributor V
Ware,
you should reall not write directly to the radio using this function.
you should used the appropiate API:  Asp_SetPowerLevel() which is documented in the 802.15.4 reference manual.
 
Br,
Mads

 

 
0 Kudos

348 Views
Ware
Contributor III
 
Good.  It is a different scale than what is used everywhere else, but it also works.
 
Thank you,
 - Ware
 


Message Edited by Ware on 2008-03-25 08:57 AM
0 Kudos