STMicroelectronics / STM32CubeWL

STM32Cube MCU Full FW Package for the STM32WL series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on boards provided by ST (Nucleo boards)
Other
99 stars 52 forks source link

SUBGRF_SetTxParams Pa config #82

Open dbanello opened 2 months ago

dbanello commented 2 months ago

I'm working on STM32CubeWL 1.3.0. I've seen that SUBGRF_SetTxParams function seems to set Pa config and power setting in according to Table 27. "PA optimal setting and operating mode of RM0461". But I think the implementation in STM32CubeWL 1.1.0 is more correct beacause it use power instead of max_power to select the right configuration of PA.

Version 1.3.0: `

if (paSelect == RFO_LP)
{
    max_power = RBI_GetRFOMaxPowerConfig(RBI_RFO_LP_MAXPOWER);
    if (power >  max_power)
    {
      power = max_power;
    }
    if (max_power == 14)
    {
        SUBGRF_SetPaConfig(0x04, 0x00, 0x01, 0x01);
        power = 0x0E - (max_power - power);
    }
    else if (max_power == 10)
    {
        SUBGRF_SetPaConfig(0x01, 0x00, 0x01, 0x01);
        power = 0x0D - (max_power - power);
    }
    else /*default 15dBm*/
    {
        SUBGRF_SetPaConfig(0x07, 0x00, 0x01, 0x01);
        power = 0x0E - (max_power - power);
    }
    if (power < -17)
    {
        power = -17;
    }
    SUBGRF_WriteRegister(REG_OCP, 0x18);   /* current max is 80 mA for the whole device*/
}

`

Version 1.1.0 `

if( paSelect == RFO_LP )
{
    if( power == 15 )
    {
        SUBGRF_SetPaConfig( 0x06, 0x00, 0x01, 0x01 );
    }
    else
    {
        SUBGRF_SetPaConfig( 0x04, 0x00, 0x01, 0x01 );
    }
    if( power >= 14 )
    {
        power = 14;
    }
    else if( power < -17 )
    {
        power = -17;
    }
    SUBGRF_WriteRegister( REG_OCP, 0x18 ); // current max is 80 mA for the whole device
}

`

Example In version 1.3.0 if the input power is 10dbm and max_power in LP is 15dbm the settings will be this: SUBGRF_SetPaConfig(0x07, 0x00, 0x01, 0x01); power = 0x0E - (max_power - power) = 0x0E - (15-10) = 14-5 = 9 These values are not what I'm expecting reading the RM0461

RJMSTM commented 2 months ago

ST Internal Reference: 179540