Skip to content
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

Get started not working with esp32 #24

Open
ashwanisihag opened this issue Apr 27, 2021 · 5 comments
Open

Get started not working with esp32 #24

ashwanisihag opened this issue Apr 27, 2021 · 5 comments

Comments

@ashwanisihag
Copy link

IP address:
192.168.41.128
[ 4634][E][esp32-hal-adc.c:164] __analogRead(): GPIO0: ESP_ERR_TIMEOUT: ADC2 is in use by Wi-Fi.
Info: Initializing SNTP

Info: SNTP initialization complete

Info: IoT Hub SDK for C, version 1.1.23

Error: Time:Tue Apr 27 08:58:50 2021 File:C:\Users\Vaeg\Documents\Arduino\libraries\ESP32_AzureIoT_Arduino\src\az_iot\c-utility\pal\socket_async.c Func:socket_async_create Line:134 Socket connect failed, not EINPROGRESS: 0

Info: Could not open the socket

Info: >>>Connection status: disconnected

Info: >>>Connection status: disconnected

Info: tlsio_openssl_close has been called when in neither TLSIO_STATE_OPEN nor TLSIO_STATE_ERROR.

@cyberwaelder1
Copy link

hello, is there a solution? I have the same problem.

@ftylitak
Copy link

ftylitak commented Apr 4, 2022

Even though this is quite old, just for future reference, this issue is caused because you try to use this library with esp-idf 4.x which is not supported based on my tests (or ESP32 Arduino 2.x).

Switch back to esp-idf 3.x (3.3.6 is the newest at the time of writing).

If you are using Arduino code and Arduino IDE, you need to go to the Boards Manager and downgrade esp32 support to maximum version 1.0.6.

@ftylitak
Copy link

ftylitak commented Apr 4, 2022

A very rough workaround is to comment out all the following lines:

if (connect_ret == -1)
{
int sockErr = get_socket_errno(sock);
if (sockErr != EINPROGRESS)
{
/* Codes_SRS_SOCKET_ASYNC_30_022: [ If socket connection fails, socket_async_create shall log an error and return SOCKET_ASYNC_INVALID_SOCKET. ]*/
LogError("Socket connect failed, not EINPROGRESS: %d", sockErr);
result = SOCKET_ASYNC_INVALID_SOCKET;
}
else
{
// This is the normally expected code path for our non-blocking socket
/* Codes_SRS_SOCKET_ASYNC_30_018: [ On success, socket_async_create shall return the created and configured SOCKET_ASYNC_HANDLE. ]*/
result = sock;
}
}
else
{
/* Codes_SRS_SOCKET_ASYNC_30_018: [ On success, socket_async_create shall return the created and configured SOCKET_ASYNC_HANDLE. ]*/
// This result would be a surprise because a non-blocking socket
// returns EINPROGRESS. But it could happen if this thread got
// blocked for a while by the system while the handshake proceeded,
// or for a UDP socket.
result = sock;
}

and replace them by:

result = sock;

May be it is a timing issue. Sounds bad not to check for the socket connect return code...though it works for me with esp-idf v4.4.

@ftylitak
Copy link

FYI: at some point I changed all the backend of this project with an updated version of az_iot based on https://github.com/Azure/azure-iot-sdk-c (commit: cb8ef0535ebd06f81231be4c40b372ef17cd995e)

Just in case someone is blocked and it can help.

https://github.com/insighio/ESP32_AzureIoT_Arduino

@ttrichar
Copy link

A very rough workaround is to comment out all the following lines:

if (connect_ret == -1)
{
int sockErr = get_socket_errno(sock);
if (sockErr != EINPROGRESS)
{
/* Codes_SRS_SOCKET_ASYNC_30_022: [ If socket connection fails, socket_async_create shall log an error and return SOCKET_ASYNC_INVALID_SOCKET. ]*/
LogError("Socket connect failed, not EINPROGRESS: %d", sockErr);
result = SOCKET_ASYNC_INVALID_SOCKET;
}
else
{
// This is the normally expected code path for our non-blocking socket
/* Codes_SRS_SOCKET_ASYNC_30_018: [ On success, socket_async_create shall return the created and configured SOCKET_ASYNC_HANDLE. ]*/
result = sock;
}
}
else
{
/* Codes_SRS_SOCKET_ASYNC_30_018: [ On success, socket_async_create shall return the created and configured SOCKET_ASYNC_HANDLE. ]*/
// This result would be a surprise because a non-blocking socket
// returns EINPROGRESS. But it could happen if this thread got
// blocked for a while by the system while the handshake proceeded,
// or for a UDP socket.
result = sock;
}

and replace them by:

result = sock;

May be it is a timing issue. Sounds bad not to check for the socket connect return code...though it works for me with esp-idf v4.4.

This worked for me, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants