ST67W611M1A6UTR with Mission T02 Binary, Fails to connect to Wifi
I am using the ST67W611M1A6UTR Wi-Fi NCP with an STM32H563ZIT6 MCU on a custom board.
The ST67W611 is flashed with st67w611m_mission_t02_v2.0.89.bin, and I am running LwIP on the STM32H563ZIT6 host MCU. I am using the ST67W6X_CLI_LWIP example as a reference to implement a custom TCP stack for my board.
Below is my current initialization and Wi-Fi/TCP connection sequence:
void network_task(void *argument) {
W6X_Status_t ret = 0;
W6X_WiFi_Connect_t connectData = {0};
W6X_WiFi_StaStateType_e state = W6X_WIFI_STATE_STA_OFF;
wifi_init();
network_log_init();
W6X_App_Cb_t App_cb = {0};
App_cb.APP_wifi_cb = APP_wifi_cb;
App_cb.APP_net_cb = NULL;
App_cb.APP_ble_cb = NULL;
App_cb.APP_mqtt_cb = NULL;
App_cb.APP_error_cb = NULL;
W6X_RegisterAppCb(&App_cb);
app_evt_current = xEventGroupCreate();
/* Initialize the ST67W6X Driver */
ret = W6X_Init();
if (ret != W6X_STATUS_OK) {
// TODO: Handle this error appropriately, maybe log it or retry
// initialization
}
vTaskDelay(pdMS_TO_TICKS(500)); // Delay to ensure the driver is ready
ret = W6X_WiFi_Init();
if (ret != W6X_STATUS_OK) {
// TODO: Handle this error appropriately, maybe log it or retry
// initialization
}
int32_t lwip_success = MX_LWIP_Init();
if (lwip_success != 0) {
}
vTaskDelay(pdMS_TO_TICKS(500)); // Delay to ensure the driver is ready
W6X_WiFi_Connect_Opts_t wifi_connect_opts = {0};
strncpy((char *)wifi_connect_opts.SSID, TARGET_SSID, W6X_WIFI_MAX_SSID_SIZE);
strncpy((char *)wifi_connect_opts.Password, TARGET_SSID_PASSWD,
W6X_WIFI_MAX_PASSWORD_SIZE);
wifi_connect_opts.Reconnection_interval = 0;
wifi_connect_opts.Reconnection_nb_attempts = 0;
wifi_connect_opts.WPS = 0;
wifi_connect_opts.WEP = 0;
memset(wifi_connect_opts.MAC, 0, sizeof(wifi_connect_opts.MAC));
W6X_Status_t status = W6X_WiFi_Connect(&wifi_connect_opts);
while (1) {
vTaskDelay(pdMS_TO_TICKS(100));
}
}
The issue I am encountering is that both the Wi-Fi driver and the LwIP stack initialize successfully. However, when the application calls W6X_WiFi_Connect(), it crashes during an internal function call before the connection process completes.
The crash consistently occurs inside W6X_WiFi_Connect(), rather than returning an error status to the application.
ret = W61_AT_Common_SetExecute(Obj, (uint8_t *)cmd, W61_WIFI_CONNECT_TIMEOUT);
Interestingly, if I comment out the call to net_if_init(), W6X_WiFi_Connect() completes successfully and the module connects to the Wi-Fi network.
So the crash appears to be related to the interaction between net_if_init() / LwIP network interface setup and the subsequent W6X_WiFi_Connect() call.
if (net_if_init(&net_if_cb) != 0) {
LogError("Failed to init the LwIP network interface\n");
return -1;
}
which is present in MX_LWIP_Init().
W6X_Status_t W6X_Netif_Init(W6X_Net_if_cb_t *net_if_cb) {
/* Get the global W61 context pointer */
p_DrvObj = W61_ObjGet();
NULL_ASSERT(p_DrvObj, W6X_Obj_Null_str);
if (p_DrvObj->NetCtx.Supported != 0) {
NET_LOG_ERROR("Netif module not supported\n");
return W6X_STATUS_ERROR;
}
if (BusIo_SPI_Bind(SPI_MSG_CTRL_TRAFFIC_NETWORK_STA, 16,
net_if_cb->rxd_sta_notify_fn) != 0) {
SYS_LOG_ERROR("Bind Network Traffic Station failed\n");
return W6X_STATUS_ERROR;
}
if (BusIo_SPI_Bind(SPI_MSG_CTRL_TRAFFIC_NETWORK_AP, 8,
net_if_cb->rxd_ap_notify_fn) != 0) {
SYS_LOG_ERROR("Bind Network Traffic AP failed\n");
return W6X_STATUS_ERROR;
}
p_DrvObj->Callbacks.Netif_cb.link_sta_up_fn = net_if_cb->link_sta_up_fn;
p_DrvObj->Callbacks.Netif_cb.link_sta_down_fn = net_if_cb->link_sta_down_fn;
p_DrvObj->Callbacks.Netif_cb.link_ap_up_fn = net_if_cb->link_ap_up_fn;
p_DrvObj->Callbacks.Netif_cb.link_ap_down_fn = net_if_cb->link_ap_down_fn;
return W6X_STATUS_OK;
}
It looks like W6X_Netif_Init() is somehow conflicting with W6X_WiFi_Connect(). After W6X_Netif_Init() is called, the application gets stuck during AT command execution inside W6X_WiFi_Connect().
I have not been able to identify the root cause of this conflict between the LwIP network interface initialization and the Wi-Fi connection sequence.
Any guidance on the correct initialization order, required synchronization, or possible configuration issues would be greatly appreciated, as this is currently blocking my development.
