Skip to content
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

Add BLE support for MCXW71 frdm board #79432

Merged
merged 3 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions boards/nxp/frdm_mcxw71/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,18 @@ The ``frdm_mcxw71`` board target in Zephyr currently supports the following feat
+-----------+------------+-------------------------------------+
| LPTMR | on-chip | counter |
+-----------+------------+-------------------------------------+
| BLE | on-chip | Bluetooth |
+-----------+------------+-------------------------------------+

Fetch Binary Blobs
******************

To support Bluetooth, frdm_mcxw71 requires fetching binary blobs, which can be
achieved by running the following command:

.. code-block:: console

west blobs fetch hal_nxp

Programming and Debugging
*************************
Expand Down Expand Up @@ -142,6 +153,44 @@ should see the following message in the terminal:
*** Booting Zephyr OS build v3.7.0-xxx-xxxx ***
Hello World! frdm_mcxw71/mcxw716c

Bluetooth
=========

BLE functionality requires to fetch binary blobs, so make sure to follow
the ``Fetch Binary Blobs`` section first.

Two images must be written to the board: one for the host (CM33) and one for the NBU (CM3).
- To flash the application (CM33) refer to the ``Flashing`` section above.
- To flash the NBU, follow the instructions below:

* Install ``blhost`` from NXP's website. This is the tool that will allow you to flash the NBU.
* Enter ISP mode. To boot the MCU in ISP mode, follow these steps:
- Disconnect the ``FRDM-MCXW71`` board from all power sources.
- Keep the ``SW3`` (ISP) button on the board pressed, while connecting the board to the host computer USB port.
- Release the ``SW3`` (ISP) button. The MCXW71 MCU boots in ISP mode.
- Reconnect any external power supply, if needed.
* Use the following command to flash NBU file:

.. code-block:: console

# On Windows
blhost.exe -p COMxx -- receive-sb-file mcxw71_nbu_ble.sb3

# On Linux
./blhost -p /dev/ttyxx -- receive-sb-file mcxw71_nbu_ble.sb3

Please consider changing ``COMxx`` on Windows or ``ttyxx`` on Linux to the serial port used by your board.

The NBU file can be found in : ``<zephyr workspace>/modules/hal/nxp/zephyr/blobs/mcxw71/mcxw71_nbu_ble.sb3``

For more details:

.. _MCXW71 In-System Programming Utility:
https://docs.nxp.com/bundle/AN14427/page/topics/introduction.html

.. _blhost Website:
https://www.nxp.com/search?keyword=blhost&start=0

References
**********

Expand Down
8 changes: 8 additions & 0 deletions boards/nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
#include <nxp/mcx/MCXW716CMFTA-pinctrl.h>

&pinctrl {
pinmux_lpuart0: pinmux_lpuart0 {
group0 {
pinmux = <LPUART0_RX_PTA16>, <LPUART0_TX_PTA17>;
drive-strength = "low";
slew-rate = "fast";
};
};

pinmux_lpuart1: pinmux_lpuart1 {
group0 {
pinmux = <LPUART1_RX_PTC2>, <LPUART1_TX_PTC3>;
Expand Down
8 changes: 8 additions & 0 deletions boards/nxp/frdm_mcxw71/frdm_mcxw71.dts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
zephyr,sram = &stcm0;
zephyr,console = &lpuart1;
zephyr,shell-uart = &lpuart1;
zephyr,uart-pipe = &lpuart0;
};

user_led {
Expand Down Expand Up @@ -52,6 +53,13 @@
status = "okay";
};

&lpuart0 {
current-speed = <115200>;
status = "okay";
pinctrl-0 = <&pinmux_lpuart0>;
pinctrl-names = "default";
};

&lpuart1 {
current-speed = <115200>;
status = "okay";
Expand Down
1 change: 1 addition & 0 deletions drivers/bluetooth/hci/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ config BT_DRV_RX_STACK_SIZE
default 640 if (BT_SPI || BT_AMBIQ_HCI)
default BT_RX_STACK_SIZE if (BT_H4 || BT_HCI_RAW_H4)
default BT_STM32_IPM_RX_STACK_SIZE if BT_STM32_IPM
default HCI_NXP_RX_STACK_SIZE if HCI_NXP_RX_THREAD
default 256
help
Stack size for the HCI driver's RX thread.
Expand Down
26 changes: 25 additions & 1 deletion drivers/bluetooth/hci/Kconfig.nxp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,29 @@ config HCI_NXP_SET_CAL_DATA_ANNEX100
If enabled, the Host will send calibration data annex 100 to the BLE Controller during HCI
init.

config HCI_NXP_RX_THREAD
bool "Process RX buffers in a dedicated thread"
help
Some platforms receive the HCI RX buffers in ISR context.
If enabled, the HCI RX message is queued by the ISR, and the message is processed
in a dedicated thread.

if HCI_NXP_RX_THREAD

config HCI_NXP_RX_STACK_SIZE
int "HCI RX stack size"
default 512

config HCI_NXP_RX_MSG_QUEUE_SIZE
int "HCI RX message queue size"
default 4

config HEAP_MEM_POOL_ADD_SIZE_BT_NXP_RX_THREAD
int
default 768

endif

if BT_NXP

config BT_DIS_MANUF
Expand All @@ -34,7 +57,8 @@ config BT_HCI_ACL_FLOW_CONTROL
config BT_BUF_EVT_DISCARDABLE_SIZE
default 84

config HEAP_MEM_POOL_SIZE
config HEAP_MEM_POOL_ADD_SIZE_BT_NXP
int
default 256

config FLASH
Expand Down
Loading
Loading