Skip to content

COEX (WIFI+BT) Enablement NXP IW416 SoC with RT1060EVKC Platform #86719

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 5 commits into
base: main
Choose a base branch
from
Open
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
16 changes: 16 additions & 0 deletions drivers/bluetooth/hci/Kconfig.nxp
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,19 @@ config BT_NXP_NW612
radio-solution:IW612.

endif # BT_H4_NXP_CTLR

if (BT_NXP_NW612 && NXP_IW61X) || (BT_NXP_IW416 && NXP_IW416)

config BT_NXP_CTRL_BSP_TRIGGER
bool "Trigger to Wakeup BSP enabled NXP BT CPU"
default y
select UART_LINE_CTRL
help
Enable/Disable Boot-Sleep-Patch(BSP) wakeup trigger for NXP BT IW414/NW612 BT FW.
In WIFI+BT Parallel FW Download, If FW is BSP enabled, Once WIFI CPU has valid
FW loaded (on CPU1), it puts BT CPU (CPU2) in Sleep due to which BT bootloader
stops sending out signature bytes for FW Load. To wakeup BT CPU from the sleep,
BT HCI UART RTS line needs to be de-asserted (high to low) before host hci-driver
begin FW load procedure on BT CPU.

endif # BT_NXP_NW612 || BT_NXP_IW416
17 changes: 17 additions & 0 deletions drivers/bluetooth/hci/hci_nxp_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,23 @@ static int bt_nxp_ctlr_init(void)
#endif /* DT_NODE_HAS_PROP(DT_DRV_INST(0), w_disable_gpios) */
#endif

#ifdef CONFIG_BT_NXP_CTRL_BSP_TRIGGER
/* this feature sends boot-sleep-patch trigger to BT CPU to wake up
* if BT CPU is put in sleep by WIFI CPU in coex (WIFI+BT) Scenario
*/
err = uart_line_ctrl_set(uart_dev, UART_LINE_CTRL_RTS, 0);
if (err) {
LOG_ERR("fail to set rts low, err %d", err);
return err;
}
k_sleep(K_MSEC(5));
err = uart_line_ctrl_set(uart_dev, UART_LINE_CTRL_RTS, 1);
if (err) {
LOG_ERR("fail to set rts high, err %d", err);
return err;
}
k_sleep(K_MSEC(5));
#endif /*CONFIG_BT_NXP_CTRL_BSP_TRIGGER*/
uart_irq_rx_disable(uart_dev);
uart_irq_tx_disable(uart_dev);

Expand Down
74 changes: 72 additions & 2 deletions drivers/wifi/nxp/nxp_wifi_drv.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2023-2024 NXP
* Copyright 2023-2025 NXP
* SPDX-License-Identifier: Apache-2.0
*
* @file nxp_wifi_drv.c
Expand Down Expand Up @@ -372,6 +372,73 @@ int nxp_wifi_wlan_event_callback(enum wlan_event_reason reason, void *data)
return 0;
}

static int nxp_wifi_cpu_reset(uint8_t enable)
{
int err = 0;
#if DT_NODE_HAS_PROP(DT_DRV_INST(0), sd_gpios) && \
DT_NODE_HAS_PROP(DT_DRV_INST(0), pwr_gpios)

struct gpio_dt_spec sdio_reset = GPIO_DT_SPEC_GET(DT_DRV_INST(0), sd_gpios);
struct gpio_dt_spec pwr_gpios = GPIO_DT_SPEC_GET(DT_DRV_INST(0), pwr_gpios);

if (!gpio_is_ready_dt(&sdio_reset)) {
LOG_ERR("Error: failed to configure sdio_reset %s pin %d", sdio_reset.port->name,
sdio_reset.pin);
return -EIO;
}

/* Configure sdio_reset as output */
err = gpio_pin_configure_dt(&sdio_reset, GPIO_OUTPUT);
if (err) {
LOG_ERR("Error %d: failed to configure sdio_reset %s pin %d", err,
sdio_reset.port->name, sdio_reset.pin);
return err;
}

if (!gpio_is_ready_dt(&pwr_gpios)) {
LOG_ERR("Error: failed to configure pwr_gpios %s pin %d", pwr_gpios.port->name,
pwr_gpios.pin);
return -EIO;
}

/* Configure wlan-power-io as an output */
err = gpio_pin_configure_dt(&pwr_gpios, GPIO_OUTPUT);
if (err) {
LOG_ERR("Error %d: failed to configure pwr_gpios %s pin %d", err,
pwr_gpios.port->name, pwr_gpios.pin);
return err;
}

if (enable) {
err = gpio_pin_set_dt(&sdio_reset, 1);
if (err) {
return err;
}
/* wait for reset done */
k_sleep(K_MSEC(100));

err = gpio_pin_set_dt(&pwr_gpios, 1);
if (err) {
return err;
}
} else {
err = gpio_pin_set_dt(&sdio_reset, 0);
if (err) {
return err;
}

err = gpio_pin_set_dt(&pwr_gpios, 0);
if (err) {
return err;
}
}
/* wait for reset done */
k_sleep(K_MSEC(100));
#endif

return err;
}

static int nxp_wifi_wlan_init(void)
{
int status = NXP_WIFI_RET_SUCCESS;
Expand All @@ -385,7 +452,9 @@ static int nxp_wifi_wlan_init(void)
k_event_init(&s_nxp_wifi_SyncEvent);
}

if (status == NXP_WIFI_RET_SUCCESS) {
ret = nxp_wifi_cpu_reset(true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why need to add this reset for all the NXP wifi case?

Copy link
Contributor Author

@nirav-agrawal nirav-agrawal Mar 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MaochenWang, this is with respect to enabling COEX (WIFI + BT) for IW416 and IW612 SoC where Controller Reset is must so that BT CPU goes in reset state and starts sending signature bytes to allow firmware load post WIFI Init.

In all other case where controller reset properties are not set by board overlay, the api nxp_wifi_cpu_reset() returns success as per below code in API definitions. You can see new coex overlay to work with iw416/iw612, the wifi properties are added here, https://github.com/zephyrproject-rtos/zephyr/pull/86719/files#diff-d4cf5dd6dea2a990e904c0ab6ffbf822b8cf81a0d14c12dc696db59a77fcb85c

static int nxp_wifi_cpu_reset(uint8_t enable) { int err = 0; #if DT_NODE_HAS_PROP(DT_DRV_INST(0), sd_gpios) && \ DT_NODE_HAS_PROP(DT_DRV_INST(0), pwr_gpios)

Regards,
Nirav


if ((status == NXP_WIFI_RET_SUCCESS) && (ret == 0)) {
ret = wlan_init(wlan_fw_bin, wlan_fw_bin_len);
if (ret != WM_SUCCESS) {
status = NXP_WIFI_RET_FAIL;
Expand All @@ -403,6 +472,7 @@ static int nxp_wifi_wlan_init(void)
return 0;
}


static int nxp_wifi_wlan_start(void)
{
int status = NXP_WIFI_RET_SUCCESS;
Expand Down
12 changes: 9 additions & 3 deletions dts/bindings/bluetooth/nxp,bt-hci-uart.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 NXP
# Copyright 2024-2025 NXP
# SPDX-License-Identifier: Apache-2.0

description: |
Expand All @@ -11,11 +11,17 @@ include: base.yaml
properties:
sdio-reset-gpios:
type: phandle-array
required: true
description: |
sd-card io to reset standalone BT CPU/WLAN CPU. If not defined
Coex (WIFI + BT use case) overlay uses the same IO
for CPU reset to avoid BT CPU reset post WLAN init.

w-disable-gpios:
type: phandle-array
required: true
description: |
wlan-power io to reset standalone BT CPU/WLAN CPU. If not defined
Coex (WIFI + BT use case) overlay uses the same IO
for CPU reset to avoid BT CPU reset post WLAN init.

hci-operation-speed:
type: int
Expand Down
19 changes: 18 additions & 1 deletion dts/bindings/wifi/nxp,wifi.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023-2024 NXP
# Copyright 2023-2025 NXP
#
# SPDX-License-Identifier: Apache-2.0

Expand All @@ -8,3 +8,20 @@ description: |
compatible: "nxp,wifi"

include: [sd-device.yaml, pinctrl-device.yaml]

properties:
pwr-gpios:
type: phandle-array
description: |
Power pin
This pin defaults to active high when consumed by the wlan cpu power.
The property value should ensure the flags properly describe the signal
that is presented to the driver.

sd-gpios:
type: phandle-array
description: |
SDIO Reset pin
This pin defaults to active high when consumed by the SD card. The
property value should ensure the flags properly describe the signal
that is presented to the driver.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright 2025 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

&m2_hci_bt_uart {
bt_hci_uart: bt_hci_uart {
m2_bt_module: m2_bt_module {
/delete-property/ sdio-reset-gpios;
/delete-property/ w-disable-gpios;
};
};
};

&usdhc1 {
nxp_wifi {
pwr-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>;
sd-gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>;
};
};
118 changes: 118 additions & 0 deletions tests/bluetooth/shell/overlay-wifi-nxp-rt-coex.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
##Optimized to support IW416, IW612 with RT1060EVKC
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you state here, most of these Kconfigs are specifc to the combination of R1060 with either IW416 or IW612. We should move HW-specific Kconfigs to those shield files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configurations here are very specific to platform and middleware which includes fine tuning middleware component configuration to let COEX works on RT platform with IW416 and NW612 SoC. The configs are not specific to hardware, but it enables/disables/configure various configurations to make wifi-shell works with bt-shell for coex support.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kconfigs like these listed below are dependent on the HW, and specifically on the HW module that is added to the EVK board. These should be configured in the shield files since they are specific to the shield connected for the build.

CONFIG_NXP_IW416=y
#CONFIG_NXP_IW61X=y
CONFIG_NXP_IW416_MURATA_1XK_M2=y
#CONFIG_NXP_IW612_MURATA_2EL_M2=y


#wifi
CONFIG_EARLY_CONSOLE=y
CONFIG_NETWORKING=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_MAIN_STACK_SIZE=5200
CONFIG_NET_TX_STACK_SIZE=2048
CONFIG_NET_RX_STACK_SIZE=2048
CONFIG_NET_MAX_CONTEXTS=10
CONFIG_NET_DHCPV4=y
CONFIG_NET_TCP=y
CONFIG_NET_LOG=y
CONFIG_INIT_STACKS=y
CONFIG_NET_SHELL=y
CONFIG_NET_STATISTICS=y
CONFIG_NET_STATISTICS_PERIODIC_OUTPUT=n
CONFIG_WIFI=y
CONFIG_WIFI_LOG_LEVEL_ERR=y
CONFIG_NET_L2_WIFI_SHELL=y
# printing of scan results puts pressure on queues in new locking
# design in net_mgmt. So, use a higher timeout for a crowded
# environment.
CONFIG_NET_MGMT_EVENT_QUEUE_TIMEOUT=5000
CONFIG_NET_MGMT_EVENT_QUEUE_SIZE=20
#board
CONFIG_WIFI_NXP=y
CONFIG_NXP_IW416=y
#CONFIG_NXP_IW61X=y
CONFIG_NXP_WIFI_SHELL=y
CONFIG_NXP_IW416_MURATA_1XK_M2=y
#CONFIG_NXP_IW612_MURATA_2EL_M2=y
#
# C Library
#
CONFIG_REQUIRES_FULL_LIBC=y
CONFIG_CBPRINTF_FP_SUPPORT=y
#CONFIG_IW416_MURATA_1XK_M2=y
#firmware
CONFIG_NXP_MONOLITHIC_WIFI=y
#CONFIG_NXP_FW_LOADER=y
# os
CONFIG_THREAD_CUSTOM_DATA=y
CONFIG_EVENTS=y
CONFIG_SYS_HEAP_AUTO=y
CONFIG_SCHED_MULTIQ=y
CONFIG_ASSERT=y
CONFIG_LOG_MODE_IMMEDIATE=y

# shell @coex
CONFIG_SHELL_CMD_BUFF_SIZE=512

# net
CONFIG_NET_L2_ETHERNET=y
CONFIG_NET_DHCPV4_SERVER_ADDR_COUNT=32
CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=y
CONFIG_ETH_MCUX=n
CONFIG_NET_ZPERF=y
CONFIG_NET_ZPERF_MAX_PACKET_SIZE=1500
CONFIG_ZPERF_WORK_Q_STACK_SIZE=4096
CONFIG_NET_BUF_LOG=y
CONFIG_NET_PKT_RX_COUNT=40
CONFIG_NET_PKT_TX_COUNT=40
CONFIG_NET_BUF_RX_COUNT=100
CONFIG_NET_BUF_TX_COUNT=100
CONFIG_NET_BUF_DATA_SIZE=1744
CONFIG_NET_TC_TX_COUNT=1
CONFIG_NET_TC_RX_COUNT=1
#CONFIG_NET_MGMT_EVENT_QUEUE_SIZE=20
CONFIG_NET_IF_MAX_IPV4_COUNT=4
CONFIG_NET_IF_MAX_IPV6_COUNT=3
CONFIG_DNS_RESOLVER=y
CONFIG_DNS_RESOLVER_MAX_SERVERS=2
CONFIG_NET_SOCKETS_POLL_MAX=14
CONFIG_NET_ZPERF_MAX_SESSIONS=6
CONFIG_NET_IPV4_FRAGMENT=y
CONFIG_NET_IPV4_FRAGMENT_MAX_COUNT=3
CONFIG_NET_IPV4_FRAGMENT_MAX_PKT=7
CONFIG_NET_IPV4_FRAGMENT_TIMEOUT=3
CONFIG_NET_IPV6_FRAGMENT=y
CONFIG_NET_IPV6_FRAGMENT_MAX_COUNT=3
CONFIG_NET_IPV6_FRAGMENT_MAX_PKT=8
CONFIG_NET_IPV6_FRAGMENT_TIMEOUT=3
CONFIG_NET_MAX_CONN=10
CONFIG_NET_DHCPV4_SERVER_ICMP_PROBE_TIMEOUT=100
CONFIG_ETH_DRIVER=n

# net threads priority
CONFIG_NET_TC_THREAD_PRIO_CUSTOM=y
CONFIG_NET_TC_THREAD_PREEMPTIVE=y
CONFIG_NET_TCP_WORKER_PRIO=-16
CONFIG_NET_TC_TX_THREAD_BASE_PRIO=3
CONFIG_NET_TC_RX_THREAD_BASE_PRIO=3
CONFIG_ZPERF_WORK_Q_THREAD_PRIORITY=3
CONFIG_NET_SOCKETS_SERVICE_THREAD_PRIO=3
CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO=y
CONFIG_NET_CONTEXT_PRIORITY=y
CONFIG_NET_MGMT_THREAD_PRIO_CUSTOM=y
CONFIG_NET_MGMT_THREAD_PRIORITY=3
CONFIG_IDLE_STACK_SIZE=2048

# power management
CONFIG_PM_LOG_LEVEL_OFF=y
#CONFIG_IDLE_STACK_SIZE=2048

# stack size
CONFIG_SHELL_STACK_SIZE=6144
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_NET_MGMT_EVENT_STACK_SIZE=4608
CONFIG_NET_TCP_WORKQ_STACK_SIZE=2048
#CONFIG_MAIN_STACK_SIZE=4096 @wifi
CONFIG_NET_SOCKETS_SERVICE_STACK_SIZE=4096
# optimization level
# refer to Kconfig.zephyr for Optimizations Level
CONFIG_SPEED_OPTIMIZATIONS=y
# comment out for -O0
CONFIG_CODE_DATA_RELOCATION_SRAM=y
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ manifest:
groups:
- hal
- name: hal_nxp
revision: 9dc7449014a7380355612453b31be479cb3a6833
revision: pull/512/head
path: modules/hal/nxp
groups:
- hal
Expand Down
Loading