I' m using custom board of nrf5340 with nrf7002, and the SDK version is ncs v2.5.2.
I've tried to build and run, but the log in RTT viewer is only print the line "Bringing network interface up and connecting to the network", It seems the program is stuck, and it didn't proceed to execute.
and I wondered it is because of the MAC address, so I added the "set_mac _address" function into "network.c" and executed it in the function "network_task", but it printed other errors below.
prj.conf
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#prj.conf
#
# Copyright (c) 2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
# Common configurations for all boards
CONFIG_WIFI=y
CONFIG_WIFI_NRF700X=y
CONFIG_NET_L2_WIFI_MGMT=y
CONFIG_HEAP_MEM_POOL_SIZE=25000
# System settings
CONFIG_NEWLIB_LIBC=y
# Networking
CONFIG_NETWORKING=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_NET_NATIVE=y
Below is the function what I added. And this function is executed normally in the Scan sample.
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
int8_t wifi_set_mac_address()
{
struct net_if *iface = net_if_get_default();
uint8_t mac_addr[6] = {0xF0, 0xCE, 0x36, 0x00, 0x00, 0x4A};
struct ethernet_req_params eth_param;
memcpy(eth_param.mac_address.addr, mac_addr, 6);
// if (net_if_down(iface))
// {
// printk("<Err> Couldn't shutdown WiFi interface\n");
// return -1;
// }
printk("<Inf> Setting MAC address\n");
if (net_mgmt(NET_REQUEST_ETHERNET_SET_MAC_ADDRESS, iface, ð_param, sizeof(struct ethernet_req_params)))
{
printk("<Err> Couldn't set new MAC Address\n");
return -2;
}
int ret = memcmp(net_if_get_link_addr(iface)->addr, mac_addr, sizeof(mac_addr));
How can I run the MQTT sample correctly?