Comments (19)
Hi @danewalton , yes, I had not thought of it until yesterday and after changing the calls from one task to the other everything just worked fine.
Thank you all, your support was really appreciated.
from iot-middleware-freertos-samples.
First attempt returns the log errors from above. Then if the device restarts the connection and again tries to send the reported properties there is an exception and decoding the backtrace it seems the source is in line 448 of transport_tls_esp32.c:
EspTlsTransportParams_t * pxEspTlsTransport = (EspTlsTransportParams_t *)pxTlsParams->xSSLContext;
from iot-middleware-freertos-samples.
Hi @afcec
What is the exact payload which you are trying to send?
from iot-middleware-freertos-samples.
I have tried with my original payload (can be quite large depending on the situation) but then I started testing just simple JSONs like this one with the same results:
"{ "system.applianceType": 2 }"
from iot-middleware-freertos-samples.
Also the application crashes when I try to call AzureIoTHubClient_ProcessLoop...
from iot-middleware-freertos-samples.
If I remove the call to AzureIoTHubClient_SendPropertiesReported and just leave AzureIoTHubClient_ProcessLoop the backtrace seems to point to the following line in transport_tls_esp32.c (line 414):
tlsStatus = esp_transport_read( pxEspTlsTransport->xTransport, pBuffer, xBytesToRecv, pxEspTlsTransport->ulReceiveTimeoutMs );
So once I am connected, it looks like no matter if I try to send or receive using the current socket, there is an exception.
from iot-middleware-freertos-samples.
What is your device ID just out of curiosity?
from iot-middleware-freertos-samples.
I am using device ID 1901202300000001 for my last tests.
from iot-middleware-freertos-samples.
I'm getting some interesting logs looking at that device
ErrorCode: DeviceNotFound
Message: Device 1901202300000001 at IotHub iot-hub-teka-smart-home not registered.
Timestamp: 01/19/2023 10:48:39
Details: Client Id and Device Id in username do not match. If this is device module then client ID must be a Module ID; otherwise it must be a Device ID.
Are you sure you're setting the parameters correctly in the APIs?
from iot-middleware-freertos-samples.
Hi Dane, those logs are quite old. If you see my description I confirm that the device registration is completed successfully and then I can stablish the connection with the IoT Hub. Only when I try to send/receive any data I am experiencing the issue.
That entry from 01/19 comes from a moment when I was also sending Module ID = Device ID in the API and then I found out that those parameters were not the same ( issue #298 )
Thanks
from iot-middleware-freertos-samples.
Are you able to send your client code so I can see if there's anything problematic there?
from iot-middleware-freertos-samples.
Yes, of couse. I will send you an email later today with the code interacting with Azure along with some explanations, If you need anything else, just let me know. Thanks.
from iot-middleware-freertos-samples.
Hi Dane, any news about this issue?
from iot-middleware-freertos-samples.
@afcec , if you got the code from https://github.com/Azure-Samples/iot-middleware-freertos-samples/tree/main/demos/projects/ESPRESSIF/esp32 it should work on your own device. We run that sample frequently and the code is working for us.
I have a few questions in case you are still facing this issue in your application:
- Did you run the sample above with your Azure IoT hub and device id?
- What is the sku of the scale unit of your Azure IoT hub?
- What is the specific ESP chip you are using in your tests (where the crash is happening)?
from iot-middleware-freertos-samples.
Hi @afcec , there will be an update for you through the support request you opened, but please find a reference sample we put together for you: https://github.com/ewertons/aziot-freertos-esp32 (1)
This sample (1) does call AzureIoTHubClient_SendPropertiesReported
(https://github.com/ewertons/aziot-freertos-esp32/blob/main/components/sample-azure-iot/demos/sample_azure_iot/sample_azure_iot.c#L462) and AzureIoTHubClient_ProcessLoop
(https://github.com/ewertons/aziot-freertos-esp32/blob/main/components/sample-azure-iot/demos/sample_azure_iot/sample_azure_iot.c#L453), showing these functions can be used without crashing the application.
We have used ESP IDF v.4.4.3 for validation.
from iot-middleware-freertos-samples.
Hi @ewertons , thanks for your help and sorry for the delay in my reply. I was just trying to test again your previous sample because it has been a long time since I ran that code. Unfortunately, it is not so easy because I am using flash encryption and there are several additional tasks I need to accomplish:
- Changes in partition table
- Changes in kconfig
- Modification of my original X.509 certificate and private key from PEM format to single line strings as requested by your sample (And make sure I do not make any mistake hereβ¦)
- Modifications in the code to enable operation with encrypted NVS
From my humble opinion, providing the certificate and private key from kconfig is not a good reference, you should try to create a more realistic sample. Let me make a few tests with the old and new code and I will get back to you ASAP.
from iot-middleware-freertos-samples.
Hi again, I am having problems with the certificate/key as expected...
- esp-tls-mbedtls: mbedtls_x509_crt_parse returned -0x2780
I am doing the following: From my original X.509 files in PEM format I just replace "\r\n" with "\n". Please see the pictures attached (original PEM, modified removing \r and kconfig) because there are no line feeds in the strings in kconfig.
redacted
from iot-middleware-freertos-samples.
Hi @afcec ,
Please use the support issue you opened for sending sensitive data like certs or credentials, or logs with PII.
Apologies, but I took the freedom to redact your message and delete the certs info.
from iot-middleware-freertos-samples.
I believe this was tackled in the support request, and was related to calling middleware send/receive APIs in different threads. Which to note here is not natively supported.
Closing this for now but please let us know if you would like it reopened.
from iot-middleware-freertos-samples.
Related Issues (20)
- Crypto.h header file causes project not to build when enabling BLE MESH due to duplicate crypto.h file HOT 2
- Add config directories to code style script
- Timeout HOT 2
- Windows Sample hangs HOT 1
- ullGetUnixTime() does not return an accurate Unix epoch in ST b-l475e-iot01a demo HOT 3
- Update the Windows "Find UART" instructions everywhere HOT 1
- PnP crashes after 64 minutes HOT 19
- CMake configuration/build error for PC Simulation (windows) HOT 1
- Cortex-Debug for NXP 1060 should use "runToMain": true
- ADU groups doesnt appear in Groups and Deployments under Update section HOT 8
- FOTA with the ESP32 Documentation Inquiry HOT 11
- Potential stack corruption in sockets_wrapper_lwip.c HOT 2
- Can anyone help to use vscode to build example HOT 2
- ESP-TLS : Failed to open new connection HOT 5
- How to connect more than 1 module? HOT 1
- SNTP Server time sync event messes up with the TLS receive function
- How to receive desired properties from IoT hub from device twin HOT 4
- Wrong version of CMAKE specified HOT 1
- Uninitialized memory in TLS_Socket_Connect will cause random free of memory in mbedlts context
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iot-middleware-freertos-samples.