Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Maximum Switch Pattern Length (Direction Finding Example)

Hi

I am working on direction finding examples, based on CTE feature that is introduced in BLE v5..

I have build and run both "tx" and "rx" examples successfully as described here:

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/direction_finding_connectionless_tx/README.html

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/direction_finding_connectionless_rx/README.html

My Configuration:

Using nRf Connect SDK v1.6.0

Both tx and rx running on nRF52833-DK

Both tx and rx are used in AoA mode.

Then I tried to change the antenna pattern (main.c of the rx project) from:

static const uint8_t ant_patterns[] = { 0x2, 0x0, 0x5, 0x6, 0x1, 0x4,
					0xC, 0x9, 0xE, 0xD, 0x8, 0xA };

to this pattern (one item has appended):

static const uint8_t ant_patterns[] = { 0x2, 0x0, 0x5, 0x6, 0x1, 0x4,
					0xC, 0x9, 0xE, 0xD, 0x8, 0xA, 0x8 };

which causes an error at the run time (printed to the terminal by rx device):

.
.
.
success. Periodic sync established.
Enable receiving of CTE...
failed (err -22)
.
.
.

By investigating the source code, I found the problem has raised from "validate_cte_rx_params" function, implemented in "/ncs/zephyr/subsys/bluetooth/host/direction.c"

static int validate_cte_rx_params(const struct bt_df_per_adv_sync_cte_rx_param *params)
{
	...
		if (params->num_ant_ids < BT_HCI_LE_SWITCH_PATTERN_LEN_MIN ||
		    params->num_ant_ids > df_ant_info.max_switch_pattern_len || !params->ant_ids) {
			return -EINVAL;
		}
	...

	return 0;
}

Somewhere in lower layers, the maximum number of antenna pattern has been set to 12. so appending a new item to antenna pattern raises an error when it is higher than this predefined maximum number.

This "df_ant_info.max_switch_pattern_len" has been initialized in "int le_df_init(void)" function and reads the lower layer values by "hci_df_read_ant_info" function.

-------------------------------------------------

Now my question is:

Is this limitation a software issue or a hardware one? How can I use an antenna pattern that has more than 12 elements?

Thanks

Related