Looking at the following log, it seems that your endpoint is not correct (unless you knowingly removed prefix.):
MQTT echo attempting to connect to -ats.iot.eu-central-1.amazonaws.com
Hi there,
I have exactly the same problem. I created a new thing more than once and followed the instructions exactly. But it doesn´t work with the B-L475-IOT01A1 board. I received the same error message like webcow. When I use a Raspberry Pi instead of the ST-Board it works. So I think, it´s not an issue of the endpoint. What can I do to get it work with the ST-Board? Thanks in advance.
The return value of the function prvSetupConnection is 0.
By the way, I´ve found out that the definition clientcredentialIOT_THING_NAME in aws_clientcredential.h isn´t used anywere in the projekt. Is that correct?
Thanks in advance for your answer
I tried to use this demo on STM32L4 in eu-central-1 and I was able to successfully run it.
The return value of zero from prvSetupConnection means that you are failing to establish a TLS connection. Are you using the latest Amazon FreeRTOS version? I see that you are using ATS enspoint and therefore you need to use the latest version 1.4.4.
At this point I am not sure what might be going wrong with your setup. Would you be willing to setup a remote debugging session so that we can help you better?
For a remote session I need a permit from my company. But I think it will be basicly possible. However, I still have questions regarding aws_clientcredential.h:
/*
MQTT Broker endpoint. /
static const char clientcredentialMQTT_BROKER_ENDPOINT[] = "a3f******po0u-ats.iot.eu-central-1.amazonaws.com";
Is there a prefix or suffix needed to define the broker endpoint, or is the string complete (except for the asterisk)?
/* Use of a “define” and not a “static const” here to be able to
use pre-compile concatenation on the string. */ #define clientcredentialIOT_THING_NAME “StmNode1”
I´ve put the name of my thing here but I cannot find any location in the source code where this definition is used. Is that correct?
/*
Wi-Fi network to join.
*/ #define clientcredentialWIFI_SSID “AndroidAP”
/*
Password needed to join Wi-Fi network. / #define clientcredentialWIFI_PASSWORD "ix***14"
I tried different WLAN hotspots without any success.
Hello,
I´ve make some investigations in the source code and found an issue in es_wifi.c. In line 2360f is the following code:
/* Set the credential set to use. /
sprintf( ( char )( Obj->CmdData ),“PF=%d,%d\r”, credsFunction, credSet );
ret = AT_ExecuteCommand( Obj, Obj->CmdData, Obj->CmdData );
The return value after execution is ‘ES_WIFI_STATUS_UNEXPECTED_CLOSED_SOCKET’ and the return value from the WIFI module in the data buffer is '\r
\r
ERROR\r
…
The reason for this is an incorrect value sent to the WIFI module with the ‘PF’ command. creSet has the value 3. According to the documentation of the WIFI module, the value must not be greater than 2.
When I remove the predifined symbol ‘USE_OFFLOAD_SSL’ the demo works, because this code section is not executed.
Thanks.
Thank you for doing the investigation. PF=3 is a special feature for STM Discovery board.
It seems that you do not have the correct firmware burnt to the WiFi module. Did you download the ISM43362-M3G-L44-SPI-C3.5.2.5.STM binary from here: https://www.inventeksys.com/iwin/firmware/. Note the “.STM” at the end. It is the third download link on the web page and not the second one.
To update the WIFI module I followed the download link on the german ‘getting_started_st.html’ website. In the zip file there was a file named ISM43362_M3G_L44_SPI_C3.5.2.5.STM.bin but obviously it was not the right one. After renewed update of the module everything works fine now.
Thank you for your support.
@aggarg
I know this is a very old post but I have similar issue. I am using STM32 b-l475e-iot01a discovery kit and running Azure middleware for FreeRTOS.
My issue is different a bit though. The stuff works fine (telemetry sending and everything works fine) and all of a sudden I get the below error,
es_wifi.c:2312 :AT_RequestReceiveData failed with return code = 5 (which is ES_WIFI_STATUS_UNEXPECTED_CLOSED_SOCKET)
[ERROR] [TlsTransport] [TLS_Socket_Recv:879] Failed to read data: mbedTLSError[-1006]= : ERROR - This is a bug in the library.
I think the TLS error is an after effect as the socket is no more open/valid.
Is there a known similar open bug?
I am using the sample code from Micrososft site. This does not allow me to add a link as I am a new user of this forum.
Most likely the remote end is closing the connection. You can capture Wireshark logs to confirm. If that happens to be the case, you need to find out why that is happening.