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 3 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

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.

3 participants