Skip to content

Enable WiFi on C33 and BLE on C33/Giga #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: arduino
Choose a base branch
from

Conversation

facchinm
Copy link
Member

Giga still not working, investigation in progress.
As always, refer to https://github.com/facchinm/ArduinoBLE/tree/zephyr_hci to test BLE

@mjs513
Copy link

mjs513 commented May 23, 2025

@facchinm
just checked out PR and tried rebuilding for the giga and got a bunch of undefined references:

/home/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4_ifx_cyw43xxx.c.obj): in function `bt_h4_vnd_setup':
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:255: undefined reference to `bt_hci_cmd_send_sync'
/home/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4_ifx_cyw43xxx.c.obj): in function `bt_firmware_download':
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:160: undefined reference to `bt_hci_cmd_send_sync'
/home/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:175: undefined reference to `bt_hci_cmd_create'
/home/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:185: undefined reference to `bt_hci_cmd_send_sync'
/home/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/bluetooth/libdrivers__bluetooth.a(h4_ifx_cyw43xxx.c.obj): in function `bt_h4_vnd_setup':
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:221: undefined reference to `brcm_patch_ram_length'
/home/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:221: undefined reference to `brcm_patchram_buf'
/home/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:286: undefined reference to `bt_hci_cmd_send_sync'

@mjs513
Copy link

mjs513 commented May 23, 2025

Quick update - did a west update and managed to get it to build but then:

warning: HW_STACK_PROTECTION (defined at soc/nxp/s32/s32k1/Kconfig.defconfig:20, arch/Kconfig:285)
was assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies:
((SOC_SERIES_S32K1 && SOC_FAMILY_NXP_S32) || ARCH_HAS_STACK_PROTECTION) (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_HW_STACK_PROTECTION and/or look up
HW_STACK_PROTECTION in the menuconfig/guiconfig interface. The Application Development Primer,
Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
helpful too.


warning: BT_HCI_TX_STACK_SIZE (defined at subsys/bluetooth/host/Kconfig:46) was assigned the value
'4096' but got the value '512'. See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_BT_HCI_TX_STACK_SIZE and/or look up
BT_HCI_TX_STACK_SIZE in the menuconfig/guiconfig interface. The Application Development Primer,
Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
helpful too.


warning: BT_CTLR_ADV_EXT (defined at subsys/bluetooth/controller/Kconfig:739) was assigned the value
'y' but got the value 'n'. Check these unsatisfied dependencies: BT_CTLR_ADV_EXT_SUPPORT (=n),
HAS_BT_CTLR (=n). See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_BT_CTLR_ADV_EXT
and/or look up BT_CTLR_ADV_EXT in the menuconfig/guiconfig interface. The Application Development
Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual
might be helpful too.


warning: BT_CTLR_ADV_PERIODIC (defined at subsys/bluetooth/controller/Kconfig:779) was assigned the
value 'y' but got the value 'n'. Check these unsatisfied dependencies: BT_CTLR_ADV_PERIODIC_SUPPORT
(=n), BT_CTLR_ADV_EXT (=n), HAS_BT_CTLR (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_BT_CTLR_ADV_PERIODIC and/or look up
BT_CTLR_ADV_PERIODIC in the menuconfig/guiconfig interface. The Application Development Primer,
Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
helpful too.


warning: BT_CTLR_DTM_HCI (defined at subsys/bluetooth/controller/Kconfig.dtm:14) was assigned the
value 'y' but got the value 'n'. Check these unsatisfied dependencies: BT_CTLR_DTM_HCI_SUPPORT (=n),
HAS_BT_CTLR (=n). See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_BT_CTLR_DTM_HCI
and/or look up BT_CTLR_DTM_HCI in the menuconfig/guiconfig interface. The Application Development
Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual
might be helpful too.

and

-- Zephyr version: 4.1.99 (/home/my_new_zephyr_folder/zephyr), build: v3.7.0-16675-g008d154d8bd8
[162/293] Building C object zephyr/drivers/bluetooth...les/drivers__bluetooth.dir/hci/h4_ifx_cyw43xxx.c.obj
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c: In function 'bt_h4_vnd_setup':
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:220:18: warning: unused variable fw_download_speed' [-Wunused-variable]
  220 |         uint32_t fw_download_speed = DT_INST_PROP_OR(0, fw_download_speed, default_uart_speed);
      |                  ^~~~~~~~~~~~~~~~~
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:219:18: warning: unused variable hci_operation_speed' [-Wunused-variable]
  219 |         uint32_t hci_operation_speed = DT_INST_PROP_OR(0, hci_operation_speed, default_uart_speed);
      |                  ^~~~~~~~~~~~~~~~~~~

Just to let you know :)

@mjs513
Copy link

mjs513 commented May 23, 2025

Tried giga with BLE lib:

starting Bluetooth® Low Energy module failed!

and in debug looks like its doing somthing:

uart:~$ sketch
[00:01:16.825,000] <inf> usb_cdc_acm: Device suspended
[00:01:17.068,000] <inf> usb_cdc_acm: Device configured
[00:01:17.217,000] <dbg> bt_driver: h4_open:
[00:01:17.222,000] <dbg> bt_driver: rx_thread: started
[00:01:17.227,000] <dbg> bt_driver: rx_thread: rx.buf 0
[00:01:17.233,000] <inf> bt_hci_raw: Lower HCI transport: H:4
[00:01:17.239,000] <inf> bt_hci_raw: Bluetooth enabled in RAW mode
[00:01:18.396,000] <dbg> bt_driver: h4_send: buf 0x24039f78 type 1 len 4
[00:01:18.404,000] <dbg> bt_driver: process_rx: remaining 0 discard 0 have_hdr 0 rx.buf 0 len 0
[00:01:18.413,000] <dbg> bt_driver: process_rx: remaining 2 discard 0 have_hdr 0 rx.buf 0 len 0
[00:01:18.422,000] <dbg> bt_driver: process_rx: remaining 1 discard 0 have_hdr 0 rx.buf 0 len 0
[00:01:18.431,000] <dbg> bt_driver: get_evt_hdr: Got event header. Payload 4 bytes
[00:01:18.439,000] <dbg> bt_driver: process_rx: remaining 4 discard 0 have_hdr 1 rx.buf 0 len 0
[00:01:18.448,000] <dbg> bt_driver: get_rx: type 0x04, evt 0x0e
[00:01:18.454,000] <dbg> bt_driver: read_payload: Allocated rx.buf 0x2403aa90
[00:01:18.462,000] <dbg> bt_driver: read_payload: got 1 bytes, remaining 3
[00:01:18.469,000] <dbg> bt_driver: read_payload: Payload (len 4): 040e0401
[00:01:18.476,000] <dbg> bt_driver: process_rx: remaining 3 discard 0 have_hdr 1 rx.buf 0x2403aa90 len 4
[00:01:18.486,000] <dbg> bt_driver: read_payload: got 1 bytes, remaining 2
[00:01:18.494,000] <dbg> bt_driver: read_payload: Payload (len 5): 040e040103
[00:01:18.501,000] <dbg> bt_driver: process_rx: remaining 2 discard 0 have_hdr 1 rx.buf 0x2403aa90 len 5
[00:01:18.511,000] <dbg> bt_driver: read_payload: got 1 bytes, remaining 1
[00:01:18.518,000] <dbg> bt_driver: read_payload: Payload (len 6): 040e0401030c
[00:01:18.526,000] <dbg> bt_driver: process_rx: remaining 1 discard 0 have_hdr 1 rx.buf 0x2403aa90 len 6
[00:01:18.536,000] <dbg> bt_driver: read_payload: got 1 bytes, remaining 0
[00:01:18.543,000] <dbg> bt_driver: read_payload: Payload (len 7): 040e0401030c00
[00:01:18.551,000] <dbg> bt_driver: read_payload: Putting buf 0x2403aa90 to rx fifo
[00:01:18.559,000] <dbg> bt_driver: rx_thread: Calling bt_recv(0x2403aa90)
[00:01:18.567,000] <dbg> bt_driver: rx_thread: rx.buf 0
[00:01:18.582,000] <dbg> bt_driver: h4_send: buf 0x24039f78 type 1 len 4

may look at over weekend

OH tried building for C33 and just fails

@KurtE
Copy link

KurtE commented May 24, 2025

quick note: I also tried building: giga does build, but I have not tried running it yet.

C33 does not build - get the same errors as shown in the failing check.

@mjs513
Copy link

mjs513 commented May 24, 2025

UPDATE: seems to be failing on HCI.readLocalVersion in begin. Some debug:

Command tx ->  0x1 0x3 0xC 0x0
HCI event: E
E ncmd:   0x1
E opcode: 0xC03
E status: 0x0
0
Command tx ->  0x1 0x1 0x10 0x0
-1
Result from send command
failing on HCI readlocal
starting Bluetooth® Low Energy module failed!

first command is from HCI.begin().

from the debug monitor:


[00:00:10.069,000] <inf> usb_cdc_acm: Device suspended
[00:00:10.289,000] <inf> usb_cdc_acm: Device configured
[00:00:15.089,000] <dbg> bt_driver: h4_open:
[00:00:15.094,000] <dbg> bt_driver: rx_thread: started
[00:00:15.099,000] <dbg> bt_driver: rx_thread: rx.buf 0
[00:00:15.105,000] <inf> bt_hci_raw: Lower HCI transport: H:4
[00:00:15.111,000] <inf> bt_hci_raw: Bluetooth enabled in RAW mode
[00:00:16.268,000] <dbg> bt_driver: h4_send: buf 0x24039f78 type 1 len 4
[00:00:16.276,000] <dbg> bt_driver: process_rx: remaining 0 discard 0 have_hdr 0 rx.buf 0 len 0
[00:00:16.285,000] <dbg> bt_driver: process_rx: remaining 2 discard 0 have_hdr 0 rx.buf 0 len 0
[00:00:16.294,000] <dbg> bt_driver: process_rx: remaining 1 discard 0 have_hdr 0 rx.buf 0 len 0
[00:00:16.303,000] <dbg> bt_driver: get_evt_hdr: Got event header. Payload 4 bytes
[00:00:16.311,000] <dbg> bt_driver: process_rx: remaining 4 discard 0 have_hdr 1 rx.buf 0 len 0
[00:00:16.320,000] <dbg> bt_driver: get_rx: type 0x04, evt 0x0e
[00:00:16.326,000] <dbg> bt_driver: read_payload: Allocated rx.buf 0x2403aa90
[00:00:16.334,000] <dbg> bt_driver: read_payload: got 1 bytes, remaining 3
[00:00:16.341,000] <dbg> bt_driver: read_payload: Payload (len 4): 040e0401
[00:00:16.348,000] <dbg> bt_driver: process_rx: remaining 3 discard 0 have_hdr 1 rx.buf 0x2403aa90 len 4
[00:00:16.358,000] <dbg> bt_driver: read_payload: got 1 bytes, remaining 2
[00:00:16.366,000] <dbg> bt_driver: read_payload: Payload (len 5): 040e040103
[00:00:16.373,000] <dbg> bt_driver: process_rx: remaining 2 discard 0 have_hdr 1 rx.buf 0x2403aa90 len 5
[00:00:16.383,000] <dbg> bt_driver: read_payload: got 1 bytes, remaining 1
[00:00:16.390,000] <dbg> bt_driver: read_payload: Payload (len 6): 040e0401030c
[00:00:16.398,000] <dbg> bt_driver: process_rx: remaining 1 discard 0 have_hdr 1 rx.buf 0x2403aa90 len 6
[00:00:16.408,000] <dbg> bt_driver: read_payload: got 1 bytes, remaining 0
[00:00:16.415,000] <dbg> bt_driver: read_payload: Payload (len 7): 040e0401030c00
[00:00:16.423,000] <dbg> bt_driver: read_payload: Putting buf 0x2403aa90 to rx fifo
[00:00:16.431,000] <dbg> bt_driver: rx_thread: Calling bt_recv(0x2403aa90)
[00:00:16.439,000] <dbg> bt_driver: rx_thread: rx.buf 0
[00:00:16.454,000] <dbg> bt_driver: h4_send: buf 0x24039f78 type 1 len 4

Oh did try to build a zephyr test sketch but received error:

In file included from D:\Users\Merli\Documents\Arduino\Giga_zephyr\zephyr_bt\zephyr_bt.ino:6:
C:\Users\Merli\AppData\Local\Arduino15\packages\arduino\hardware\zephyr\0.3.1\variants\arduino_giga_r1_stm32h747xx_m7/llext-edk/include/zephyr/include/zephyr/bluetooth/gatt.h:1021:34: error: 'CONFIG_BT_MAX_PAIRED' was not declared in this scope; did you mean 'CONFIG_BT_MAX_CONN'?
 1021 |         #define BT_GATT_CCC_MAX (CONFIG_BT_MAX_PAIRED + CONFIG_BT_MAX_CONN)
      |                                  ^~~~~~~~~~~~~~~~~~~~
C:\Users\Merli\AppData\Local\Arduino15\packages\arduino\hardware\zephyr\0.3.1\variants\arduino_giga_r1_stm32h747xx_m7/llext-edk/include/zephyr/include/zephyr/bluetooth/gatt.h:1021:34: note: in definition of macro 'BT_GATT_CCC_MAX'
 1021 |         #define BT_GATT_CCC_MAX (CONFIG_BT_MAX_PAIRED + CONFIG_BT_MAX_CONN)
      |                                  ^~~~~~~~~~~~~~~~~~~~
exit status 1

@KurtE
Copy link

KurtE commented May 25, 2025

@mjs513 @facchinm - Did a little more debugging on trying to get the GIGA to work.
I don't even now enough to be dangerous 😆

But what I have so far been able to deduce is: (It dosn't work ;) )

I have confirmed that your HCIVirtualTransportZephyrClass::begin is being called:
The define is defined:
#if defined(CONFIG_BT_HCI_SETUP)
It calls through to bt_h4_vnd_setup in the file h4_ifx_cyw43xxx.c

It finds that #if DT_INST_NODE_HAS_PROP(0, bt_reg_on_gpios) is true
And it does the code to turn on the bt_reg_on_gpios first going low and then going high,
which matches I think the code within the ArduinoBT for the GIGA when zephyr is not defined.

It then gets to the if:
#if CONFIG_BT_HCI_HOST
Which is NOT defined, and so it does not use any of the other properties that were read in at the start of the function:

	uint32_t default_uart_speed = DT_PROP(DT_INST_BUS(0), current_speed);
	uint32_t hci_operation_speed = DT_INST_PROP_OR(0, hci_operation_speed, default_uart_speed);
	uint32_t fw_download_speed = DT_INST_PROP_OR(0, fw_download_speed, default_uart_speed);

Which is why we get compile warning about these not being used:

/home/kurte/git/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c: In function 'bt_h4_vnd_setup':
/home/kurte/git/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:220:18: warning: unused variable 'fw_download_speed' [-Wunused-variable]
  220 |         uint32_t fw_download_speed = DT_INST_PROP_OR(0, fw_download_speed, default_uart_speed);
      |                  ^~~~~~~~~~~~~~~~~
/home/kurte/git/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:219:18: warning: unused variable 'hci_operation_speed' [-Wunused-variable]
  219 |         uint32_t hci_operation_speed = DT_INST_PROP_OR(0, hci_operation_speed, default_uart_speed);
      |                  ^~~~~~~~~~~~~~~~~~~
/home/kurte/git/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:218:18: warning: unused variable 'default_uart_speed' [-Wunused-variable]
  218 |         uint32_t default_uart_speed = DT_PROP(DT_INST_BUS(0), current_speed);
      |                  ^~~~~~~~~~~~~~~~~~
**[**

You can not define CONFIG_BT_HCI_HOST in the config files:
And from looking at:
https://bridle.tiac-systems.net/doc/3.0/kconfig/CONFIG_BT_HCI_HOST.html

I believe this will not be defined as long as BT_HCI_RAW is defined
and the GIGA config file has:

CONFIG_BT=y
CONFIG_BT_HCI_RAW=y
CONFIG_BT_HCI_RAW_H4=y
CONFIG_BT_HCI_RAW_H4_ENABLE=y
CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_CMD_TX_SIZE=255

Not sure what to do now.... Other than leave it to those who might know what this means!

@pillo79 pillo79 force-pushed the c33_wifi branch 4 times, most recently from cb8ec0f to 9462515 Compare May 26, 2025 12:22
@mjs513
Copy link

mjs513 commented May 26, 2025

@facchinm - @pillo79 - @KurtE
Well incorporated the changes to bootstrap and PortentaC33 now builds. Doesn't help with GIGA BLE working though.

@mjs513
Copy link

mjs513 commented May 26, 2025

Just as a quick update tried this on the PortentC33 and the scan example worked:


Reseting...
Command tx ->  0x1 0x3 0xC 0x0
HCI event: E
E ncmd:   0x5
E opcode: 0xC03
E status: 0x0
0
Reading local version...
Command tx ->  0x1 0x1 0x10 0x0
HCI event: E
E ncmd:   0x5
E opcode: 0x1001
E status: 0x0
0
Result from send command
Command tx ->  0x1 0x1 0xC 0x8 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x3F
HCI event: E
E ncmd:   0x5
E opcode: 0xC01
E status: 0x0
0
Command tx ->  0x1 0x1 0x20 0x8 0xFF 0x3 0x0 0x0 0x0 0x0 0x0 0x0
HCI event: E
E ncmd:   0x5
E opcode: 0x2001
E status: 0x0
0
Command tx ->  0x1 0x2 0x20 0x0
HCI event: E
E ncmd:   0x5
E opcode: 0x2002
E status: 0x0
0
Bluetooth® Low Energy Central scan
Command tx ->  0x1 0xC 0x20 0x2 0x0 0x1
HCI event: E
E ncmd:   0x5
E opcode: 0x200C
E status: 0x0
0
Command tx ->  0x1 0xB 0x20 0x7 0x1 0x20 0x0 0x20 0x0 0x0 0x0
HCI event: E
E ncmd:   0x5
E opcode: 0x200B
E status: 0x0
0
Command tx ->  0x1 0xC 0x20 0x2 0x1 0x1
HCI event: E
E ncmd:   0x5
E opcode: 0x200C
E status: 0x0
0
HCI event: 3E
	SubEvent: 0x2
Discovered a peripheral
-----------------------
Address: c0:6d:b4:76:5b:d4
RSSI: -99


Sorry all my debug code is still in.

UPDATE:
On the off chance it was something with config differences I changed the giga to the c33 and the giga still failed in the same place.

@KurtE
Copy link

KurtE commented May 26, 2025

Quick update/Side notes:

I also verified that the C33 worked with BT on my Ubuntu machine.

As part of this, I was curious if I could update the ArduinoBLE code again to fix the issues I found a while ago when
I was working more with UNO R4. At that time was seeing if I could talk at all to XBOX controller over BLE.

First step was to get the Peripheral Explorer sketch to communicate. This Hangs and/or failswith the released code for a
couple of reasons. a) discover attributes failed. Did not handle long UUID.
More in: arduino-libraries/ArduinoBLE#276

Ported in some of the changes into the zephyr_hci branch...

It worked:

Found c8:3f:26:b3:ac:16 'Xbox Wireless Controller' 1812
Connecting ...
Connected
Discovering attributes ...
Attributes discovered

Device name: Xbox Wireless Controll
Appearance: 0x0

Service 1800    //Generic Access service
    Characteristic 2a00, properties 0x2, value 0x58626F7820576972656C65737320436F6E74726F6C6C    //Device Name
        Descriptor 2803, value 0x020300002A    //Characteristic
        Descriptor 00002a00-0000-0000-0000-000000000000, value 0x58626F7820576972656C65737320436F6E74726F6C6C
    Characteristic 2a01, properties 0x2, value 0xC403    //Appearance
        Descriptor 2803, value 0x020500012A    //Characteristic
        Descriptor 00002a01-0000-0000-0000-000000000000, value 0xC403
    Characteristic 2a04, properties 0x2, value 0x0600060000002C01    //Peripheral Preferred Connection Parameters
        Descriptor 2803, value 0x020700042A    //Characteristic
        Descriptor 00002a04-0000-0000-0000-000000000000, value 0x0600060000002C01
Service 1801    //Generic Attribute service
Service 180a    //Device Information service
    Characteristic 2a29, properties 0x2, value 0x4D6963726F736F6674    //Manufacturer Name String
        Descriptor 2803, value 0x020B00292A    //Characteristic
        Descriptor 00002a29-0000-0000-0000-000000000000, value 0x4D6963726F736F6674
    Characteristic 2a50, properties 0x2, value 0x025E04200B2305    //PnP ID
        Descriptor 2803, value 0x020D00502A    //Characteristic
        Descriptor 00002a50-0000-0000-0000-000000000000, value 0x025E04200B2305
    Characteristic 2a26, properties 0x2, value 0x352E32332E362E30    //Firmware Revision String
        Descriptor 2803, value 0x020F00262A    //Characteristic
        Descriptor 00002a26-0000-0000-0000-000000000000, value 0x352E32332E362E30
    Characteristic 2a25, properties 0x2, value 0x3033363030303332393035363234    //Serial Number String
        Descriptor 2803, value 0x021100252A    //Characteristic
        Descriptor 00002a25-0000-0000-0000-000000000000, value 0x3033363030303332393035363234
Service 180f    //Battery service
    Characteristic 2a19, properties 0x12, value 0x32    //Battery Level
        Descriptor 2803, value 0x121400192A    //Characteristic
        Descriptor 00002a19-0000-0000-0000-000000000000, value 0x32
        Descriptor 2902, value 0x0000    //Client Characteristic Configuration
Service 1812    //Human Interface Device service
    Characteristic 2a4a, properties 0x2    //HID Information
        Descriptor 2803, value 0x0218004A2A    //Characteristic
        Descriptor 00002a4a-0000-0000-0000-000000000000, value 0x
    Characteristic 2a4c, properties 0x4    //HID Control Point
        Descriptor 2803, value 0x041A004C2A    //Characteristic
        Descriptor 00002a4c-0000-0000-0000-000000000000, value 0x
    Characteristic 2a4b, properties 0x2    //Report Map
        Descriptor 2803, value 0x021C004B2A    //Characteristic
        Descriptor 00002a4b-0000-0000-0000-000000000000, value 0x
    Characteristic 2a4d, properties 0x12    //Report
        Descriptor 2803, value 0x121E004D2A    //Characteristic
        Descriptor 00002a4d-0000-0000-0000-000000000000, value 0x
        Descriptor 2902, value 0x0000    //Client Characteristic Configuration
        Descriptor 2908, value 0x0101    //Report Reference
    Characteristic 2a4d, properties 0xE    //Report
        Descriptor 2803, value 0x0E22004D2A    //Characteristic
        Descriptor 00002a4d-0000-0000-0000-000000000000, value 0x
        Descriptor 2908, value 0x0302    //Report Reference
Service 00000001-5f60-4c4f-9c83-a7953298d40d
    Characteristic 00000002-5f60-4c4f-9c83-a7953298d40d, properties 0x2
        Descriptor 2803, value 0x0226000DD4983295A7839C4F4C605F02000000    //Characteristic
        Descriptor 00000002-5f60-4c4f-9c83-a7953298d40d, value 0x
    Characteristic 00000003-5f60-4c4f-9c83-a7953298d40d, properties 0x2
        Descriptor 2803, value 0x0228000DD4983295A7839C4F4C605F03000000    //Characteristic
        Descriptor 00000003-5f60-4c4f-9c83-a7953298d40d, value 0x
    Characteristic 00000004-5f60-4c4f-9c83-a7953298d40d, properties 0x8
        Descriptor 2803, value 0x082A000DD4983295A7839C4F4C605F04000000    //Characteristic
        Descriptor 00000004-5f60-4c4f-9c83-a7953298d40d, value 0x

Disconnecting ...
Disconnected
** Press any key to scan again: <optional device name> **

Note: I also updated the Peripheral Explorer code to print out more information,
like names for the different Characteristics/properties...

If anyone is curious, about the changes into another fork/branch:
https://github.com/KurtE/ArduinoBLE/tree/zephyr_hci_xbox
Would take a little cleanup as I have debug output.

But trying to have some fun.

@mjs513
Copy link

mjs513 commented May 27, 2025

Was double checking stuff and set debug(Serial). Seems like the 1dx accepts the reset command and polls correctly but anyother HCI command fails. For read version:

rxbuf available
Available
rxbuf available
Available
rxbuf available
Available
rxbuf available
Available
HCI EVENT RX <- 040E0401030C00
HCI event: E
E ncmd:   0x1
E opcode: 0xC03
E status: 0x0
Buf empty
0
Reading local version...
HCI COMMAND TX -> 01011000
Command tx ->  0x1 0x1 0x10 0x0
Polling
Buf empty
Polling
Buf empty

And it just keeps polling without receiving and data back.

@KurtE
Copy link

KurtE commented May 27, 2025

Sorry out doing some other stuff.

Where I am getting confused on, is wondering if there is some glue missing somewhere.

That is, where is the code that processes USART interrupts and gets the callback for data available...

For example looking at the zephyr example:
\wsl.localhost\Ubuntu-24.04\home\kurte\git\zephyr\samples\bluetooth\hci_uart_async\src
There is a function:

static int hci_uart_init(void)
{
	int err;

	k_poll_signal_init(&uart_h2c_rx_sig);
	k_poll_signal_init(&uart_c2h_tx_sig);

	LOG_DBG("");

	if (!device_is_ready(hci_uart_dev)) {
		LOG_ERR("HCI UART %s is not ready", hci_uart_dev->name);
		return -EINVAL;
	}

	BUILD_ASSERT(IS_ENABLED(CONFIG_UART_ASYNC_API));
	err = uart_callback_set(hci_uart_dev, callback, NULL);

	/* Note: Asserts if CONFIG_UART_ASYNC_API is not enabled for `hci_uart_dev`. */
	__ASSERT(!err, "err %d", err);

	return 0;
}

And this function handles the events... I know there must be some where in the h4_cyw43xxx.c... code base
But I am missing where it is and who is setting it up. Probably obvious, but...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants