2024-08-12 10:52 AM - edited 2024-08-12 11:03 AM
Hi, I am working on a project that involves, among other things, BLE communication. The host side of the BLE runs on an STM32F091RC, and for the controller, I am using the BLUENRG-M2SP. As a starting point, I used a Nucleo board with the X-Nucleo shield and flashed a zephyr BLE peripheral example on the STM32. The application starts correctly, the initialization passes, and it begins advertising.
The first problem I encountered is when I try to connect a phone. Among other logs, I am getting the following:
[00:01:31.465,000] <wrn> bt_hci_core: opcode 0x2016 status 0x3a
[00:01:31.465,000] <err> bt_hci_core: Failed read remote features (-16)
Besides this log, I am able to connect to the phone, read characteristics, etc. However, what is strange is that when I read the connection destination address, I am getting FF:FF:FF:FF:FF:FF. Also, bonding fails, which is necessary for my project. I have done a lot of investigation on the host app to find what might be missing, but nothing caught my attention. I checked the SPI communication with a logic analyzer, but there is nothing suspicious there, except that the destination address transmitted from the controller is 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF. Do you have any idea what I might be missing? By the way, I ran the same example with the nRF controller connected via UART without any problems.
My zephyr app configuration:
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_BT=y
CONFIG_LOG=y
CONFIG_BT_SMP=y
CONFIG_BT_SIGNING=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DIS=y
CONFIG_BT_ATT_PREPARE_COUNT=5
CONFIG_BT_BAS=y
CONFIG_BT_HRS=y
CONFIG_BT_IAS=y
CONFIG_BT_PRIVACY=y
CONFIG_BT_DEVICE_NAME="Zephyr Peripheral Sample Long Name"
CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_DEVICE_NAME_MAX=65
CONFIG_BT_KEYS_OVERWRITE_OLDEST=y
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_SETTINGS=y
CONFIG_BT_HCI_CORE_LOG_LEVEL_INF=y
CONFIG_BT_CONN_LOG_LEVEL_INF=y
CONFIG_SPI=y
CONFIG_BT_SPI=y
CONFIG_BT_BLUENRG_ACI=y
CONFIG_BT_HCI_ACL_FLOW_CONTROL=n
CONFIG_FCB=y
CONFIG_SETTINGS_FCB=y
And overlay:
/ {
chosen {
zephyr,console = &usart2;
zephyr,shell-uart = &usart2;
zephyr,bt-hci = &hci_spi;
};
};
&arduino_spi {
cs-gpios = <&arduino_header 1 GPIO_ACTIVE_LOW>; /* A1 */
hci_spi: bluenrg-2@0 {
compatible = "st,hci-spi-v2";
reg = <0>;
reset-gpios = <&gpiob 5 GPIO_ACTIVE_LOW>; /* D4 */
irq-gpios = <&gpiob 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* D6 */
spi-cpha; /* CPHA=1 */
spi-hold-cs;
spi-max-frequency = <DT_FREQ_M(1)>;
reset-assert-duration-ms = <6>;
};
};
Thanks
Szymon