Switch between Bluetooth mesh and constant carrier

Hi,

As part of our production test, we perform a constant carrier test (from Bluetooth DTM sample). But this test is performed after the casing is put on, which means that we are unable to reprogram the device and this test will be part of the application firmware (instead of the test firmware). This test is started by a special command over the communication lines.

Our application initializes Bluetooth mesh (GATT proxy is enabled) directly at boot. And while the constant carrier test does work in the application firmware, it only works when it starts before Bluetooth (mesh) is initialized.

Is there a way to disable Bluetooth (and reset the radio) to start the constant carrier test?
Could we add something to our radio-reset or start function to properly start the constant carrier?

System Information:

  • SOC: nRF52833
  • NCS version: v2.1.0

Constant Carrier library:

#include <hal/nrf_radio.h>

/* Devicetree node identifier for the radio node. */
#define RADIO_NODE DT_NODELABEL(radio)

static void radio_reset(void)
{
	nrf_radio_shorts_set(NRF_RADIO, 0);
	nrf_radio_event_clear(NRF_RADIO, NRF_RADIO_EVENT_DISABLED);

	nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_DISABLE);
	while (!nrf_radio_event_check(NRF_RADIO, NRF_RADIO_EVENT_DISABLED)) {
		/* Do nothing */
	}
	nrf_radio_event_clear(NRF_RADIO, NRF_RADIO_EVENT_DISABLED);
}

void carrier_stop(void)
{
	radio_reset();
}

void carrier_start(void)
{
	/* Turn off radio before configuring it */
	radio_reset();

	nrf_radio_frequency_set(NRF_RADIO, 2442);
	nrf_radio_txpower_set(NRF_RADIO, NRF_RADIO_TXPOWER_POS8DBM);

	/* Setting packet pointer will start the radio */

	nrf_radio_event_clear(NRF_RADIO, NRF_RADIO_EVENT_READY);

	/* Set shortcuts:
	 * between READY event and START task and
	 * between END event and DISABLE task
	 */
	nrf_radio_shorts_set(NRF_RADIO,
			     NRF_RADIO_SHORT_READY_START_MASK |
			     NRF_RADIO_SHORT_END_DISABLE_MASK);


    nrf_radio_modecnf0_set(NRF_RADIO, false,
                           RADIO_MODECNF0_DTX_Center);

    /* Shortcut between READY event and START task */
    nrf_radio_shorts_set(NRF_RADIO,
                         NRF_RADIO_SHORT_READY_START_MASK);

    /* Shortcut will start radio in Tx mode when it is ready */
    nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_TXEN);
}

Kind regards,

Tim

Parents
  • Hi,

    For the upcoming NCS v2.2.0 release we have this in the changelog:

    Bluetooth LE

    • Added:

      • Support for hci_driver_close(), so bt_disable() can now be used to disable the SoftDevice Controller.

      • The Kconfig option CONFIG_BT_UNINIT_MPSL_ON_DISABLE that, when enabled, uninitializes the MPSL when bt_disable() is used. This releases all peripherals used by the MPSL.

  • Hello Sigurd

    Luckily I found this topic because I have the exact same question as Tim. I do understand the idea behind the bt_disable feature. My concern is the MCU family that I'm using from Nordic...

    Our product uses a nRF5340, so it has two cores, one for the application, the second one is the netcore. If I call bt_disable, this should disable the bt stack on the netcore, but how can I call the required functions on the netcore to start a constant carrier test? My production firmware contains two separate projects, one for the appcore and one for the netcore where I start and stop the carrier test with some "events" over shared memory. But when I use the BT Mesh stack, the netcore contains the child image with that stack, so no idea how I should be able to launch the carrier test with the BT Mesh stack already on the netcore part of the nRF5340...

    Thanks in advance for your assistance...

Reply
  • Hello Sigurd

    Luckily I found this topic because I have the exact same question as Tim. I do understand the idea behind the bt_disable feature. My concern is the MCU family that I'm using from Nordic...

    Our product uses a nRF5340, so it has two cores, one for the application, the second one is the netcore. If I call bt_disable, this should disable the bt stack on the netcore, but how can I call the required functions on the netcore to start a constant carrier test? My production firmware contains two separate projects, one for the appcore and one for the netcore where I start and stop the carrier test with some "events" over shared memory. But when I use the BT Mesh stack, the netcore contains the child image with that stack, so no idea how I should be able to launch the carrier test with the BT Mesh stack already on the netcore part of the nRF5340...

    Thanks in advance for your assistance...

Children
Related