Customising a bluetooth Zephyr sample

Hi,

I am currently developing with the nRF52 DK (nRF52832 SoC) and the nRF52833 DK (nRf52833 SoC). I have built and flashed the Bluetooth: Peripheral HT sample from Zephyr to both boards successfully. I have tested the application with an Android mobile phone and receive temperature measurements as expected. I would like to customise the source code of this sample application in 2 specific ways:

1. How do I change the TX power?

2. How do I change the PHY to use Coded PHY (S = 8)? I know that this can only be done for the nRF52833.

Thanks,

Adam

Parents
  • Hi

    1. Okay, to just set the TX power statically to +8dBm you can add the CONFIG_BT_CTLR_TX_PWR_PLUS_8 to the Kconfig file of your project.

    2. You can set up a Coded PHY advertising with something like this snippet from the peripheral_hr_coded sample:

    static int create_advertising_coded(void)
    {
    	int err;
    	struct bt_le_adv_param param =
    		BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_CONNECTABLE |
    				     BT_LE_ADV_OPT_EXT_ADV |
    				     BT_LE_ADV_OPT_CODED,
    				     BT_GAP_ADV_FAST_INT_MIN_2,
    				     BT_GAP_ADV_FAST_INT_MAX_2,
    				     NULL);
    
    	err = bt_le_ext_adv_create(&param, NULL, &adv);
    	if (err) {
    		printk("Failed to create advertiser set (%d)\n", err);
    		return err;
    	}
    
    	printk("Created adv: %p\n", adv);
    
    	err = bt_le_ext_adv_set_data(adv, ad, ARRAY_SIZE(ad), NULL, 0);
    	if (err) {
    		printk("Failed to set advertising data (%d)\n", err);
    		return err;
    	}
    
    	return 0;
    }

    Yes, the Coded PHY sample should be possible to build for the nRF52833 as well, we've just not set it up and tested it on our end, so we can't add it to the sample page.

    Best regards,

    Simon

  • Thanks Simon,

    1. I did try that and it doesn't seem to change the TX power value when I tested it. I added the following line into the prj.conf file: CONFIG_BT_CTLR_TX_PWR_PLUS_8=y. I get the following message next to this line: In build_833: n.

    Furthermore, I get the following problem message in VS Code: CONFIG_BT_CTLR_TX_PWR_PLUS_8 was assigned the value y, but got the value n. Missing dependencies: HAS_HW_NRF_RADIO_TX_PWR_HIGH.

    2. Can I add this function into the source code in addition to the existing advertising functions in the Bluetooth: Peripheral HT sample

    Thanks very much,

    Adam

Reply
  • Thanks Simon,

    1. I did try that and it doesn't seem to change the TX power value when I tested it. I added the following line into the prj.conf file: CONFIG_BT_CTLR_TX_PWR_PLUS_8=y. I get the following message next to this line: In build_833: n.

    Furthermore, I get the following problem message in VS Code: CONFIG_BT_CTLR_TX_PWR_PLUS_8 was assigned the value y, but got the value n. Missing dependencies: HAS_HW_NRF_RADIO_TX_PWR_HIGH.

    2. Can I add this function into the source code in addition to the existing advertising functions in the Bluetooth: Peripheral HT sample

    Thanks very much,

    Adam

Children
No Data
Related