cancel
Showing results for 
Search instead for 
Did you mean: 

bt_enable() fails with Zephyr/nucleo-WB55RG

Mau_Martin
Visitor


I try to initialize bt, with bt_enable() in zephyr. So far, no success,it returns me a -19 error ( not found )
Any help would be very appreciated.
Note: I am using Zephyr ( not Cube/HAL ).

Context:
- Zephyr 4.1.99
- Board stm32 nucleo-wb55rg

- FUS version 1.2.0.0
- stm32wb5x_BLE_HCILayer_extended_fw.bin v1.22.0 flashed at 0x080DA000 flashed with Cube programmer

- Flashing the ble stack seems to work fine, as well as starting it.

- When I build I point to the provided nucleo_wb55rg board definition found in the zephyr install.

My prj.conf contains:

################################
CONFIG_CPP=y
CONFIG_NEWLIB_LIBC=y
CONFIG_PINCTRL=y
CONFIG_ASSERT=y

# uart
CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_PRINTK=y

# Logging
CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_LOG_DEFAULT_LEVEL=4
CONFIG_BT_LOG_LEVEL_DBG=y
CONFIG_BT_HCI_CORE_LOG_LEVEL_DBG=y
CONFIG_DEBUG_OPTIMIZATIONS=y

# Bluetooth
CONFIG_BT=y
CONFIG_BT_HCI=y

CONFIG_BT_PERIPHERAL=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_EXT_ADV=y

# memory
CONFIG_BT_HCI_ACL_FLOW_CONTROL=y
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_BT_RX_STACK_SIZE=3072
CONFIG_HEAP_MEM_POOL_SIZE=10240
CONFIG_STACK_CANARIES=y

# io
CONFIG_GPIO=y
#######################################

I also added a dts overlay ( not sure I need it )
##############################################
&sram0 {
status = "okay";
};

&sram1 {
status = "okay";
};

&sram2 {
status = "okay";
};

&ble_rf {
status = "okay";
};
###############################################


And the app i have is minimal, it contains:
####################################
#include <zephyr/logging/log.h>
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/kernel.h>
#include <stdio.h>

LOG_MODULE_REGISTER(my_app, LOG_LEVEL_DBG);
#define LED0_NODE DT_ALIAS(led0)

static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);

int main(void) {

printk("Starting\n");
LOG_INF("CONFIG_BT_STM32_IPM: %d", IS_ENABLED(CONFIG_BT_STM32_IPM));


k_msleep(1000);

int err = bt_enable(NULL);
if (err) {
printk("Bluetooth init failed with err:%d\n", err);
return 0;
}

if (!gpio_is_ready_dt(&led)) {
return 0;
}

err = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
if (err < 0) {
return 0;
}

bool led_state = true;

while (1) {
err = gpio_pin_toggle_dt(&led);
if (err < 0) {
printk("gpio_pin_toggle_dt with err:%d\n", err);
return 0;
}

led_state = !led_state;
printf("LED state: %s\n", led_state ? "ON" : "OFF");
k_msleep(200);
}

return 0;
}
##########################################

With this setting, I get the following log:

[00:00:00.000,000] <dbg> os: setup_thread_stack: stack 0x20005d40 for thread 0x200012e8: obj_size=1088 buf_start=0x20005d80 buf_size 1024 stack_ptr=0x20006180
[00:00:00.015,000] <dbg> mpu: mpu_configure_region: Configure MPU region at index 0x2
[00:00:00.023,000] <dbg> mpu: region_allocate_and_init: Program MPU region at index 0x2
[00:00:00.032,000] <dbg> mpu: region_init: [2] 0x20005d40 0x150b000a
[00:00:00.038,000] <dbg> mpu: mpu_configure_region: Configure MPU region at index 0x2
[00:00:00.047,000] <dbg> mpu: region_allocate_and_init: Program MPU region at index 0x2
[00:00:00.055,000] <dbg> mpu: region_init: [2] 0x20003d00 0x150b000a
[00:00:00.062,000] <dbg> hci_ipm: transport_init: BleCmdBuffer: 0x200300d8
[00:00:00.069,000] <dbg> hci_ipm: transport_init: HciAclDataBuffer: 0x200301f4
[00:00:00.077,000] <dbg> hci_ipm: transport_init: SystemCmdBuffer: 0x20030514
[00:00:00.084,000] <dbg> hci_ipm: transport_init: EvtPool: 0x20030620
[00:00:00.091,000] <dbg> hci_ipm: transport_init: SystemSpareEvtBuffer: 0x20030408
[00:00:00.099,000] <dbg> hci_ipm: transport_init: BleSpareEvtBuffer: 0x200302fc
[00:00:00.107,000] <dbg> hci_ipm: syscmd_status_not: status:1
[00:00:00.113,000] <dbg> mpu: mpu_configure_region: Configure MPU region at index 0x2
[00:00:00.121,000] <dbg> mpu: region_allocate_and_init: Program MPU region at index 0x2
[00:00:00.130,000] <dbg> mpu: region_init: [2] 0x20003b80 0x150b000a
[00:00:00.137,000] <dbg> mpu: mpu_configure_region: Configure MPU region at index 0x2
[00:00:00.145,000] <dbg> mpu: region_allocate_and_init: Program MPU region at index 0x2
[00:00:00.153,000] <dbg> mpu: region_init: [2] 0x20003d00 0x150b000a
[00:00:00.160,000] <dbg> hci_ipm: c2_reset: C2 unlocked
[00:00:00[00:00:00.000,000] <dbg> os: setup_thread_stack: stack 0x20005d40 for thread 0x200012e8: obj_size=1088 buf_start=0x20005d80 buf_size 1024 stack_ptr=0x20006180
[00:00:00.015,000] <dbg> mpu: mpu_configure_region: Configure MPU region at index 0x2
[00:00:00.023,000] <dbg> mpu: region_allocate_and_init: Program MPU region at index 0x2
[00:00:00.032,000] <dbg> mpu: region_init: [2] 0x20005d40 0x150b000a
[00:00:00.038,000] <dbg> mpu: mpu_configure_region: Configure MPU region at index 0x2
[00:00:00.047,000] <dbg> mpu: region_allocate_and_init: Program MPU region at index 0x2
[00:00:00.055,000] <dbg> mpu: region_init: [2] 0x20003d00 0x150b000a
[00:00:00.062,000] <dbg> hci_ipm: transport_init: BleCmdBuffer: 0x200300d8
[00:00:00.069,000] <dbg> hci_ipm: transport_init: HciAclDataBuffer: 0x200301f4
[00:00:00.077,000] <dbg> hci_ipm: transport_init: SystemCmdBuffer: 0x20030514
[00:00:00.084,000] <dbg> hci_ipm: transport_init: EvtPool: 0x20030620
[00:00:00.091,000] <dbg> hci_ipm: transport_init: SystemSpareEvtBuffer: 0x20030408
[00:00:00.099,000] <dbg> hci_ipm: transport_init: BleSpareEvtBuffer: 0x200302fc
[00:00:00.107,000] <dbg> hci_ipm: syscmd_status_not: status:1
[00:00:00.113,000] <dbg> mpu: mpu_configure_region: Configure MPU region at index 0x2
[00:00:00.121,000] <dbg> mpu: region_allocate_and_init: Program MPU region at index 0x2
[00:00:00.130,000] <dbg> mpu: region_init: [2] 0x20003b80 0x150b000a
[00:00:00.137,000] <dbg> mpu: mpu_configure_region: Configure MPU region at index 0x2
[00:00:00.145,000] <dbg> mpu: region_allocate_and_init: Program MPU region at index 0x2
[00:00:00.153,000] <dbg> mpu: region_init: [2] 0x20003d00 0x150b000a
[00:00:00.160,000] <dbg> hci_ipm: c2_reset: C2 unlocked
[00:00:00.166,000] <dbg> hci_ipm: syscmd_status_not: status:0
[00:00:00.172,000] <dbg> mpu: mpu_configure_region: Configure MPU region at index 0x2
[00:00:00.180,000] <dbg> mpu: region_allocate_and_init: Program MPU region at index 0x2
[00:00:00.188,000] <dbg> mpu: region_init: [2] 0x20003b80 0x150b000a
[00:00:00.195,000] <dbg> mpu: mpu_configure_region: Configure MPU region at index 0x2
[00:00:00.204,000] <dbg> mpu: region_allocate_and_init: Program MPU region at index 0x2
[00:00:00.212,000] <dbg> mpu: region_init: [2] 0x20003d00 0x150b000a
[00:00:00.219,000] <dbg> hci_ipm: syscmd_status_not: status:1
[00:00:00.225,000] <dbg> os: setup_thread_stack: stack 0x20001f40 for thread 0x20000e40: obj_size=1408 buf_start=0x20001f80 buf_size 1344 stack_ptr=0x200024c0
*** Booting Zephyr OS build v4.1.0-3062-g29197ac9633c ***
[00:00:00.245,000] <dbg> os: k_sched_unlock: scheduler unlocked (0x20001268:0)
Starting
[00:00:00.253,000] <inf> my_app: CONFIG_BT_STM32_IPM: 1
[00:00:00.259,000] <dbg> os: z_tick_sleep: thread 0x20001268 for 8000 ticks
[00:00:00.266,000] <dbg> mpu: mpu_configure_region: Configure MPU region at index 0x2
[00:00:00.274,000] <dbg> mpu: region_allocate_and_init: Program MPU region at index 0x2
[00:00:00.283,000] <dbg> mpu: region_init: [2] 0x20001f40 0x150b000a
[00:00:00.289,000] <dbg> mpu: mpu_configure_region: Configure MPU region at index 0x2
[00:00:00.298,000] <dbg> mpu: region_allocate_and_init: Program MPU region at index 0x2
[00:00:00.306,000] <dbg> mpu: region_init: [2] 0x20003b80 0x150b000a
[00:00:01.266,000] <dbg> mpu: mpu_configure_region: Configure MPU region at index 0x2
[00:00:01.274,000] <dbg> mpu: region_allocate_and_init: Program MPU region at index 0x2
[00:00:01.283,000] <dbg> mpu: region_init: [2] 0x20003d00 0x150b000a
[00:00:01.289,000] <err> bt_hci_core: HCI driver is not ready
Bluetooth init failed with err:-19
[00:00:01.299,000] <dbg> mpu: mpu_configure_region: Configure MPU region at index 0x2
[00:00:01.307,000] <dbg> mpu: region_allocate_and_init: Program MPU region at index 0x2
[00:00:01.315,000] <dbg> mpu: region_init: [2] 0x20003b80 0x150b000a

Did anybody find the right config in Zephyr for a stm32wb55rg ?

Thansk in advance.

 

 

 

0 REPLIES 0