From acff6a028001a0de8c179994ae1e1353e1850728 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 15 Aug 2025 01:19:03 +0530 Subject: [PATCH 1/5] boards: nordic: nrf7120pdk: Add Wi-Fi support Setup Wi-Fi access to global resources and also kick start LMAC VPR boot. Signed-off-by: Chaitanya Tata --- boards/nordic/nrf7120pdk/board.c | 54 ++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/boards/nordic/nrf7120pdk/board.c b/boards/nordic/nrf7120pdk/board.c index 8c05c8b739e3..47863612c544 100644 --- a/boards/nordic/nrf7120pdk/board.c +++ b/boards/nordic/nrf7120pdk/board.c @@ -9,6 +9,16 @@ #include "nrf7120_enga_types.h" #include "nrf7120_enga_global.h" +/* Wi-Fi core defines (not part of MDK) */ +#define LRC0_POWERON (0x4800B000UL + 0x00000490UL) +#define LMAC_VPR_INITPC (0x48000000UL + 0x00000808UL) +#define LMAC_VPR_CPURUN (0x48000000UL + 0x00000800UL) + +static inline void write_reg32(uintptr_t addr, uint32_t value) +{ + *((volatile uint32_t *)addr) = value; +} + #if CONFIG_BOARD_EARLY_INIT_HOOK /* Temporary workaround while VPR does not handle starting clocks */ void board_early_init_hook(void) @@ -24,8 +34,48 @@ void board_early_init_hook(void) /* Wait for event */ while (NRF_CLOCK_S->EVENTS_LFCLKSTARTED != - CLOCK_EVENTS_LFCLKSTARTED_EVENTS_LFCLKSTARTED_Generated) { - + CLOCK_EVENTS_LFCLKSTARTED_EVENTS_LFCLKSTARTED_Generated) { + /* busy-wait */ } + + /* Make entire RAM accessible to the Wi-Fi domain */ + NRF_MPC00->OVERRIDE[0].STARTADDR = 0x20000000; + NRF_MPC00->OVERRIDE[0].ENDADDR = 0x20100000; + NRF_MPC00->OVERRIDE[0].PERM = 0x7; /* 0-NS R,W,X =1 */ + NRF_MPC00->OVERRIDE[0].PERMMASK = 0xF; + NRF_MPC00->OVERRIDE[0].CONFIG = 0x1200; + + /* MRAM MPC overrides for wifi */ + NRF_MPC00->OVERRIDE[1].STARTADDR = 0x00000000; + NRF_MPC00->OVERRIDE[1].ENDADDR = 0x01000000; + NRF_MPC00->OVERRIDE[1].PERM = 0x7; + NRF_MPC00->OVERRIDE[1].PERMMASK = 0xF; + NRF_MPC00->OVERRIDE[1].CONFIG = 0x1200; + + /* Make GRTC accessable from the WIFI-Core */ + NRF_SPU20->PERIPH[34].PERM = (SPU_PERIPH_PERM_SECATTR_NonSecure << SPU_PERIPH_PERM_SECATTR_Pos); + + /* Wi-Fi VPR uses UART 20 (PORT 2 Pin 2 is for the TX) */ +#define UARTE20_ID ((NRF_UARTE20_S_BASE >> 12) & 0x1F) + NRF_SPU20->PERIPH[UARTE20_ID].PERM = + (SPU_PERIPH_PERM_SECATTR_NonSecure << SPU_PERIPH_PERM_SECATTR_Pos); + NRF_SPU00->FEATURE.GPIO[2].PIN[2] = + (SPU_FEATURE_GPIO_PIN_SECATTR_NonSecure << SPU_FEATURE_GPIO_PIN_SECATTR_Pos); + /* Set permission for TXD */ + NRF_SPU20->FEATURE.GPIO[1].PIN[4] = + (SPU_FEATURE_GPIO_PIN_SECATTR_NonSecure << SPU_FEATURE_GPIO_PIN_SECATTR_Pos); + + /* Split security configuration to let Wi-Fi access GRTC */ + NRF_SPU20->FEATURE.GRTC.CC[15] = 0; + NRF_SPU20->FEATURE.GRTC.CC[14] = 0; + NRF_SPU20->FEATURE.GRTC.INTERRUPT[4] = 0; + NRF_SPU20->FEATURE.GRTC.INTERRUPT[5] = 0; + NRF_SPU20->FEATURE.GRTC.SYSCOUNTER = 0; + + write_reg32(LRC0_POWERON, + (LRCCONF_POWERON_MAIN_AlwaysOn << LRCCONF_POWERON_MAIN_Pos)); + write_reg32(LMAC_VPR_INITPC, 0x28080000); + write_reg32(LMAC_VPR_CPURUN, + (VPR_CPURUN_EN_Running << VPR_CPURUN_EN_Pos)); } #endif From a4e5a6e0cd239066738062050977dbbebabb4571 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 20 Aug 2025 01:43:48 +0530 Subject: [PATCH 2/5] tests: drivers: nrf_wifi: raw_tx_rx: Set filter for long packets By default only 128bytes are allowed in monitor mode, set filter to highest to allow any length frames. Signed-off-by: Chaitanya Tata --- tests/drivers/nrf_wifi/raw_tx_rx/src/main.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/drivers/nrf_wifi/raw_tx_rx/src/main.c b/tests/drivers/nrf_wifi/raw_tx_rx/src/main.c index 0c5f2e4a619d..c82552bd8006 100644 --- a/tests/drivers/nrf_wifi/raw_tx_rx/src/main.c +++ b/tests/drivers/nrf_wifi/raw_tx_rx/src/main.c @@ -300,12 +300,33 @@ static void rx_thread_oneshot(void) ZTEST(nrf_wifi, test_single_raw_tx_rx) { + struct net_if *iface; + struct wifi_filter_info filter_info = {0}; + int ret; /* MONITOR mode */ int mode = BIT(1); wifi_set_mode(mode); zassert_false(wifi_set_tx_injection_mode(), "Failed to set TX injection mode"); zassert_equal(wifi_set_channel(), 0, "Failed to set channel"); + /* Configure packet filter with buffer size 1550 */ + iface = net_if_get_first_wifi(); + if (iface == NULL) { + LOG_ERR("Failed to get Wi-Fi iface for packet filter"); + return; + } + + filter_info.oper = WIFI_MGMT_SET; + filter_info.if_index = net_if_get_by_iface(iface); + filter_info.filter = WIFI_PACKET_FILTER_ALL; + filter_info.buffer_size = 1550; + + ret = net_mgmt(NET_REQUEST_WIFI_PACKET_FILTER, iface, &filter_info, sizeof(filter_info)); + if (ret) { + LOG_ERR("Packet filter setting failed %d", ret); + } else { + LOG_INF("Packet filter set with buffer size %d", filter_info.buffer_size); + } zassert_false(setup_raw_pkt_socket(&sa), "Setting socket for raw pkt transmission failed"); k_thread_start(receiver_thread_id); /* TODO: Wait for interface to be operationally UP */ From a86535de3c8231f3b77698ceae87fb51d9d04cc9 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 20 Aug 2025 01:55:49 +0530 Subject: [PATCH 3/5] tests: drivers: nrf_wifi: Add RF POCAP support Add support for RF playout capture (POCAP) for capturing TX frames and repalying them in RX, useful for end-end testing without a peer, supported in all platforms without actual RF. Signed-off-by: Chaitanya Tata --- tests/drivers/nrf_wifi/raw_tx_rx/src/main.c | 75 +++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/tests/drivers/nrf_wifi/raw_tx_rx/src/main.c b/tests/drivers/nrf_wifi/raw_tx_rx/src/main.c index c82552bd8006..fd7c099ca093 100644 --- a/tests/drivers/nrf_wifi/raw_tx_rx/src/main.c +++ b/tests/drivers/nrf_wifi/raw_tx_rx/src/main.c @@ -45,6 +45,13 @@ static void rx_thread_oneshot(void); K_THREAD_DEFINE(receiver_thread_id, STACK_SIZE, rx_thread_oneshot, NULL, NULL, NULL, THREAD_PRIORITY, 0, -1); +#define NRF_WIFICORE_RPURFBUS_BASE 0x48020000UL +#define NRF_WIFICORE_RPURFBUS_RFCTRL ((NRF_WIFICORE_RPURFBUS_BASE) + 0x00010000UL) +#define NRF_WIFICORE_RPURFBUS_RFCTRL_AXIMASTERACCESS ((NRF_WIFICORE_RPURFBUS_RFCTRL) + 0x00000000UL) + +#define RDW(addr) (*(volatile unsigned int *)(addr)) +#define WRW(addr, data) (*(volatile unsigned int *)(addr) = (data)) + struct beacon { uint16_t frame_control; uint16_t duration; @@ -91,6 +98,73 @@ struct raw_tx_pkt_header { unsigned char raw_tx_flag; }; + +/* RF Playout Capture Register Configuration Structure */ +struct rf_pocap_reg_config { + uint32_t offset; /* Register offset from base */ + uint32_t value; /* Register value to write */ + const char *reg_name; /* Register name for logging */ + const char *desc; /* Description of what this register does */ +}; + +void configurePlayoutCapture(uint32_t rx_mode, uint32_t tx_mode, uint32_t rx_holdoff_length, uint32_t rx_wrap_length, uint32_t back_to_back_mode) +{ +#if (CONFIG_BOARD_NRF7120PDK_NRF7120_CPUAPP || CONFIG_BOARD_NRF7120PDK_NRF7120_CPUAPP_EMU) + unsigned int value; + LOG_INF("%s: Setting RF Playout Capture Config", __func__); + + // Set AXI Master to APP so we can access the RF + WRW(NRF_WIFICORE_RPURFBUS_RFCTRL_AXIMASTERACCESS, 0x31); + while(RDW(NRF_WIFICORE_RPURFBUS_RFCTRL_AXIMASTERACCESS) != 0x31); + + /* Data-driven register configuration */ + struct rf_pocap_reg_config reg_configs[] = { + { + .offset = 0x0000, + .value = (tx_mode << 1) | rx_mode, + .reg_name = "WLAN_RF_POCAP_CONFIG", + .desc = "RX/TX mode configuration" + }, + { + .offset = 0x0004, + .value = rx_holdoff_length & 0xFF, + .reg_name = "WLAN_RF_POCAP_RX_HOLDOFF_CONFIG", + .desc = "RX holdoff length configuration" + }, + { + .offset = 0x0008, + .value = rx_wrap_length, + .reg_name = "WLAN_RF_POCAP_RX_WRAP_CONFIG", + .desc = "RX wrap length configuration" + }, + { + .offset = 0x000C, + .value = (back_to_back_mode << 1), /* WLAN_POCAP_BACK_TO_BACK_MODE [1..1] */ + .reg_name = "WLAN_POCAP_VERSION_CONFIG", + .desc = "Version and back-to-back mode configuration" + } + }; + + /* Process register configurations - skip other configs if back-to-back mode is active */ + for (int i = 0; i < sizeof(reg_configs) / sizeof(reg_configs[0]); i++) { + struct rf_pocap_reg_config *cfg = ®_configs[i]; + + /* If back-to-back mode is active, only configure the version register */ + if (back_to_back_mode && cfg->offset != 0x000C) { + continue; + } + + WRW(NRF_WIFICORE_RPURFBUS_BASE + cfg->offset, cfg->value); + value = RDW(NRF_WIFICORE_RPURFBUS_BASE + cfg->offset); + LOG_INF("%s: %s (0x%04x) = 0x%x - %s", + __func__, cfg->reg_name, cfg->offset, value, cfg->desc); + } + + LOG_INF("%s: RF Playout Capture Config completed", __func__); +#endif /* (CONFIG_BOARD_NRF7120PDK_NRF7120_CPUAPP && CONFIG_EMULATOR_SYSTEMC) || (CONFIG_BOARD_NRF7120PDK_NRF7120_CPUAPP_EMU) */ +} + + static void wifi_set_mode(int mode_val) { int ret; @@ -328,6 +402,7 @@ ZTEST(nrf_wifi, test_single_raw_tx_rx) LOG_INF("Packet filter set with buffer size %d", filter_info.buffer_size); } zassert_false(setup_raw_pkt_socket(&sa), "Setting socket for raw pkt transmission failed"); + configurePlayoutCapture(0, 1, 0x7F, 0xCA60, 0); k_thread_start(receiver_thread_id); /* TODO: Wait for interface to be operationally UP */ k_sleep(K_MSEC(50)); From 892b85ceb2bd9c7102777ba7ccbe992bcd1b0e40 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 30 Sep 2025 21:05:25 +0530 Subject: [PATCH 4/5] manifest: sdk-zephyr: Pull nRF71 Wi-Fi support nRF71 Wi-Fi is now supported. Signed-off-by: Chaitanya Tata --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index a1a8f0e505a9..279d3ea64307 100644 --- a/west.yml +++ b/west.yml @@ -65,7 +65,7 @@ manifest: # https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html - name: zephyr repo-path: sdk-zephyr - revision: c539d475b659949cf96c1638cf7fbafbf64d33f3 + revision: pull/3338/head import: # In addition to the zephyr repository itself, NCS also # imports the contents of zephyr/west.yml at the above From a18c98ae16549238ce1e356978859982c132a979 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 30 Sep 2025 21:06:12 +0530 Subject: [PATCH 5/5] manifest: sdk-nrfxlib: Pull new nRF71 interface files The interface files are different to nRF70, pull the files, the firmware blobs are not yet available. Signed-off-by: Chaitanya Tata --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 279d3ea64307..e74971bdd9e1 100644 --- a/west.yml +++ b/west.yml @@ -145,7 +145,7 @@ manifest: - name: nrfxlib repo-path: sdk-nrfxlib path: nrfxlib - revision: 697969e76e88c57ee1d6733f37723b07463286c8 + revision: pull/1866/head - name: trusted-firmware-m repo-path: sdk-trusted-firmware-m path: modules/tee/tf-m/trusted-firmware-m