What is the speed of updating TXP

Hi

I am wondering when I use this function, how much time do I need between I set a TXP and a TXP has been successfully updated. I am developing an application that needs to quickly change the TXP, maybe 5 times per second.

static void set_tx_power(uint8_t handle_type, 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) {
		 printk("Unable to allocate command buffer\n");
		 return;
	 }
 
	 cp = net_buf_add(buf, sizeof(*cp));
	 cp->handle = sys_cpu_to_le16(handle);
	 cp->handle_type = handle_type;
	 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) {
		 printk("Set Tx power err: %d\n", err);
		 return;
	 }
 
	 rp = (void *)rsp->data;
	 printk("Actual Tx Power: %d\n", rp->selected_tx_power);
 
	 net_buf_unref(rsp);
 }

In other words, after using this function, can I get a return to verify that the TXP has been successfully updated? Or do you have any information on the time? How can I test the required time. 

Thank you so much

Parents
  • Hi,

    The RADIO.TXPOWER is configured before every connection event by the softdevice controller and should therefore be applied immediately if the hci command was completed before the scheduled connection event. You can use hci_vs_sdc_zephyr_read_tx_power() if you want to read back the current TXPOWER configuration. And if you have a PPK2, you can verify based on the peak current whether your TX power updates are applied in time.

    Best regards,

    Vidar

Reply
  • Hi,

    The RADIO.TXPOWER is configured before every connection event by the softdevice controller and should therefore be applied immediately if the hci command was completed before the scheduled connection event. You can use hci_vs_sdc_zephyr_read_tx_power() if you want to read back the current TXPOWER configuration. And if you have a PPK2, you can verify based on the peak current whether your TX power updates are applied in time.

    Best regards,

    Vidar

Children
Related