How to change the power level on the SPIRI1 sub GHz transceiver?
I have Contiki Coap server and client running on our two prototype boards with SPSGRF-915 module mounted on it. One node is on roof inside HVAC unit and second one is in the lab. The node on roof is not able to send data to the node in lab (in lab both nodes are communicating). I want to configure SPIRIT1 (SPSGRF-915) to maximum output power level.
This is how it is done currently;
#define POWER_DBM 11.6
st_lib_spirit_radio_set_pa_level_dbm(0,POWER_DBM);
st_lib_spirit_radio_set_pa_level_max_index(0);
/**
* @brief Sets a specific PA_LEVEL register, with a value given in dBm.
* @param cIndex PA_LEVEL to set. This parameter shall be in the range [0:7].
* @param fPowerdBm PA value to write expressed in dBm . Be sure that this values is in the
* correct range [-PA_LOWER_LIMIT: PA_UPPER_LIMIT] dBm.
* @retval None.
* @note This function makes use of the @ref SpiritRadioGetdBm2Reg fcn to interpolate the
* power value.
*/
void SpiritRadioSetPALeveldBm(uint8_t cIndex, float fPowerdBm)
{
uint8_t address, paLevelValue;
/* Check the parameters */
s_assert_param(IS_PA_MAX_INDEX(cIndex));
s_assert_param(IS_PAPOWER_DBM(fPowerdBm));
/* interpolate the power level */
paLevelValue=SpiritRadioGetdBm2Reg(SpiritRadioGetFrequencyBase(),fPowerdBm);
/* Sets the base address */
address=PA_POWER8_BASE+7-cIndex;
/* Configures the PA_LEVEL register */
g_xStatus = SpiritSpiWriteRegisters(address, 1, &paLevelValue);
}
/**
* @brief Sets a specific PA_LEVEL_MAX_INDEX.
* @param cIndex PA_LEVEL_MAX_INDEX to set. This parameter shall be in the range [0:7].
* @retval None
*/
void SpiritRadioSetPALevelMaxIndex(uint8_t cIndex)
{
uint8_t tempRegValue;
/* Check the parameters */
s_assert_param(IS_PA_MAX_INDEX(cIndex));
/* Reads the PA_POWER_0 register */
SpiritSpiReadRegisters(PA_POWER0_BASE, 1, &tempRegValue);
/* Mask the PA_LEVEL_MAX_INDEX[1:0] field and write the new value */
tempRegValue &= 0xF8;
tempRegValue |= cIndex;
/* Configures the PA_POWER_0 register */
g_xStatus = SpiritSpiWriteRegisters(PA_POWER0_BASE, 1, &tempRegValue);
}
Is that configuring maximum power out of SPIRIT1? If not, please suggest correct way. Thanks!
-Anesh