-
Notifications
You must be signed in to change notification settings - Fork 43
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
Wifi + SSL + Zigbee Crash (TZ-1130) #427
Comments
My understanding is that Zigbee & WiFi on current devices, simultaneously, is not supported. I investigated briefly on a ESP32C6& didn't have good results. This is probably your best solution. |
Hi @kioelka It seems that the crash log is not related to co-existence. Could you please share more details? E.g. the steps to reproduce the issue, app code snippet? BTW, did the WiFi part itself could work correctly (without Zigbee functional enabled)? |
/**
* Init ssl connection
*/
void sslClientTask(void *pvParameters)
{
if ((devc.isUpdating) && (devc.currentCumulativeOTAStatus.source != ZNOCloudUpdate))
{
vTaskDelete(NULL);
}
DEBUG_MSG(BDL, (COL_CLOUD "certsOk: %d", devc.certsOk));
static int tls_error_count;
static int reconnect_tries;
static int success_connects;
char buf[CLOUD_READBUF];
int ret, flags, err;
vTaskDelay(pdMS_TO_TICKS(50));
DEBUG_MSG(BDL, (COL_CLOUD "mbedTLS thread start OK"));
devc.cloudPin = initState;
wifiInit((wifi_mode_t)WIFI_MODE_STA);
#if defined(CONFIG_IDF_TARGET_ESP32C6)
DEBUG_MSG(BDL, (COL_EXCHANGE "initZigbee()" ));
xTaskCreate(esp_zb_task, "Zigbee_main", ZIBGEE_TASK_STACK, NULL, ZIGBEE_TASK_PRIORITY, &devc.zbTaskHandle);
#endif
time(&now);
localtime_r(&now, &timeinfo);
if (!devc.certsOk)
{
DEBUG_MSG(BDL, (COL_ERROR COL_CLOUD "Certs corrupted, delete task"));
vTaskDelete(NULL);
}
mbedtls_entropy_context entropy;
mbedtls_ctr_drbg_context ctr_drbg;
// mbedtls_ssl_context ssl;
mbedtls_x509_crt cacert;
mbedtls_x509_crt clicert;
mbedtls_pk_context pkey;
mbedtls_ssl_config conf;
mbedtls_net_context server_fd;
devc.cloudCon.sslc = &ssl;
xEventGroupSetBits(devc.cloudEventGroup, CLOUD_FAIL_BIT);
xEventGroupWaitBits(devc.wifiEventGroup, WIFI_CONNECTED_BIT,
false, true, portMAX_DELAY);
mbedtls_ssl_init(&ssl);
mbedtls_ctr_drbg_init(&ctr_drbg);
mbedtls_ssl_config_init(&conf);
...
...
if (!waitTimes)
{ // try to connect ot cloud by ip
waitTimes = CONNECT_WAIT_TIMES;
while (waitTimes)
{
DEBUG_MSG(BDL, (COL_CLOUD "Connecting to %s:%s...", devc.cloudIp, devc.cloudPort)); // TLS_PORT));
if ((ret = mbedtls_net_connect(&server_fd, devc.cloudIp,
devc.cloudPort, MBEDTLS_NET_PROTO_TCP)) != 0)
{
DEBUG_MSG(IDL, (COL_ERROR COL_CLOUD "mbedtls_net_connect returned -%x", -ret));
waitTimes--;
}
else
{
break;
}
vTaskDelay(pdMS_TO_TICKS(5 * 1000)); // 15 sec here
}
if (!waitTimes)
goto exit;
}
devc.connectionState = serverConnection;
DEBUG_MSG(BDL, (COL_CLOUD "Connected"));
getExtIP(); void getExtIP()
{
#define SERVER_NAME "api.ipify.org"
#define SERVER_PORT "80"
#define PATH "/?format=json"
const char *getRequest = "GET " PATH " HTTP/1.1\r\nHost: " SERVER_NAME "\r\nAccept: */*\r\n\r\n";
devc.extIPaddress = 0;
if (getOtaStage())
return;
int sock = openSocket(SERVER_NAME ":" SERVER_PORT);
char response[256];
if (sock != ESP_FAIL)
{
send(sock, getRequest, strlen(getRequest), 0);
// Get answer
recv(sock, response, 256, 0);
char *ipStr = strstr(response, "\"ip\":\"") + 6;
if (ipStr != NULL)
{
*(strrchr(ipStr, '\"')) = 0;
devc.extIPaddress = inet_addr(ipStr);
DEBUG_MSG(CDL, (COL_WIFI "Ip address %s [%d]", ipStr, devc.extIPaddress));
}
}
close(sock);
} usually it falls in getExtIP() function
or sslClientTask in connectibg to cloud
|
Question
ESP_IDF v 5.1.3
chip ESP32C6 8MB SPI flash
I'm trying to add zigbee function to project.
It works only if wifi isn't connected to AP, else app crashes in ssl task when it starts to connect to server or when it gets white IP address from api.ipify.org
ANOTHER log
Additional context.
No response
The text was updated successfully, but these errors were encountered: