Decreased TX power and RSSI

Hello

I have 2 devices ,a central and a peripheral on a custom nRF52840 board

Using Zephyr SDK 2.5.0

The distance between the devices is 10.9 meters.
When  TX power on the peripheral is set to 0 the central receives packets with RSSI around -65 dBM

When the power on the peripheral is set to a negative value  -4, -8, -20 and even -40 the RSSI  received by the central does not change much - still hovers around -65

The function that sets the tx power is below. - taken from a Zephyr sample. The function succeeds
It is invoked as follows
set_tx_power(1,-8); where 1  is the advertising set handle

Any ideas why the RSSI is not affected even at very low TX?
Thank you

Andy
-------------------------------------------------------------------------

static int set_tx_power(uint16_t handle, int8_t tx_pwr_lvl)
{
    struct bt_hci_cp_vs_write_tx_power_level *cp;
    struct bt_hci_rp_vs_write_tx_power_level *rp;
    struct net_buf *buf, *rsp = NULL;
    int err;

    buf = bt_hci_cmd_create(BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL,sizeof(*cp));

    if (!buf) {
        LOG_ERR("Unable to allocate command buffer");
        return -1;
    }
    cp = net_buf_add(buf, sizeof(*cp));
    cp->handle = sys_cpu_to_le16(handle);
    cp->handle_type = BT_HCI_VS_LL_HANDLE_TYPE_ADV;
    cp->tx_power_level = tx_pwr_lvl;

    err = bt_hci_cmd_send_sync(BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL, buf, &rsp);

    if (!err) {
        rp = (void *)rsp->data;
        // Zephyr implementation returns no error if the tx power is invalid. Instead it just sets it to 0
        // We need to propagate the error up the call chain
        if(rp->selected_tx_power == tx_pwr_lvl){
            LOG_INF("Actual Tx Power: %d", rp->selected_tx_power);
        }else{
            LOG_ERR("Tx power not set! Value %d not supported by the radio, actual tx power:%d",tx_pwr_lvl,rp->selected_tx_power);
            errno = EINVAL; // so the caller can use strerror();
            err = -EINVAL; // Zephyr uses negative error codes
        }
    }else{
         uint8_t reason = (rsp ?    ((struct bt_hci_rp_vs_write_tx_power_level *) rsp->data)->status : 0);
        LOG_ERR("Set Tx power err: %d reason 0x%02x", err, reason);      
    }
    if(rsp){
        net_buf_unref(rsp);
    }
    return err;
}
Related