Comments (14)
Hi @velbn,
Thanks for bringing this to our attention. We'll take a look.
from amazon-freertos.
@velbn I'd be interested to see what the output looks like in the failure case if you enable the MQTT debug logs. You can do so like this: #define mqttconfigENABLE_DEBUG_LOGS 1
By the way, how do you "send a reset via command line"? Are you using a JTAG connection?
from amazon-freertos.
Also, I can say that I've been doing quite a bit of experimenting with this demo as well and I don't recall seeing this issue.
from amazon-freertos.
I don't have the time today to get the logs, but i can say. When i do "make flash monitor" and the demo fails, I press CTRL+T then R. This sends a signal to the board to reset it. I use an external USB to Serial board
from amazon-freertos.
This is the logs with mqtt debug enabled
3 2683 [IP-task] vDHCPProcess: offer c0a8081aip
4 2684 [main] WiFi Connected to AP. Creating tasks which use network...
5 2685 [main] Creating MQTT Echo Task...
6 2685 [MQTTEcho] MQTT echo attempting to connect to xxxxxxx.iot.eu-west-2.amazonaws.com.
7 2685 [MQTTEcho] Sending command to MQTT task.
8 2686 [MQTT] Received message 10000 from queue.
9 2692 [IP-task] Socket sending wakeup to MQTT task.
I (27411) PKCS11: Initializing SPIFFS
I (27411) PKCS11: Partition size: total: 52961, used: 0
10 3220 [MQTT] About to close socket.
11 3220 [MQTT] Socket closed.
12 3220 [MQTT] Stack high watermark for MQTT task: 4036
13 3220 [MQTT] Notifying task.
14 3221 [MQTTEcho] Command sent to MQTT task failed.
16 3221 [MQTT] Received message 0 from queue.
15 3221 [MQTTEcho] ERROR: MQTT echo failed to connect.
17 3221 [MQTTEcho] MQTT echo test could not connect to broker.
18 3221 [MQTTEcho] Sending command to MQTT task.
19 3221 [MQTT] Received message 20000 from queue.
20 3221 [MQTT] Notifying task.
21 3221 [MQTTEcho] Command sent to MQTT task passed.
22 3221 [MQTTEcho] MQTT echo demo finished.
23 3221 [MQTTEcho] ----Demo finished----
from amazon-freertos.
velbn, hello, in reviewing https://github.com/aws/amazon-freertos/blob/master/demos/espressif/esp32_devkitc_esp_wrover_kit/common/application_code/main.c#L134, I believe there are some problems. For one thing, FreeRTOS_IPInit is being called before prvWifiConnect. Instead, the app start-up logic should attempt to connect to the network (and ideally confirm/wait) prior to bringing up the TCP/IP stack.
Second, the app demo task is being launched without waiting for vApplicationIPNetworkEventHook to signal that the network is up.
A related note is that FreeRTOS+TCP depends on the PKCS#11 crypto library as a source of random numbers (RNG; including for use in DNS and DHCP packet transaction IDs, as well as selection of outbound ports). In other words, that RNG dependency will be hit early in network stack initialization. In turn, the RNG typically (including in the case of Espressif) has a hardware dependency for gathering entropy. Realistically, those factors combine to result in some delay while bringing up TCP/IP during app start-up.
In summary, network-dependent app business logic should wait for the above to complete for launching. For the Espressif port, reordering Wi-Fi connect to happen first is the first step. Then initialize FreeRTOS+TCP and wait for its NetworkUp callback. Then run the demo task.
from amazon-freertos.
Hi,
First boot always work fine, then if I quit miniterm and start again using make monitor, 50% the wifi connection will fail and display following message.
I (233) WIFI: SYSTEM_EVENT_STA_START
I (353) wifi: n:1 0, o:1 0, ap:255 255, sta:1 0, prof:1
I (1333) wifi: state: init -> auth (b0)
I (1333) wifi: state: auth -> auth (8a0)
I (2333) wifi: state: auth -> init (2)
I (2333) wifi: n:1 0, o:1 0, ap:255 255, sta:1 0, prof:1
I (2333) WIFI: SYSTEM_EVENT_STA_DISCONNECTED
1 223 [main] WiFi failed to connect to AP.
If I restart, it will work. Then will fail on next restart, etc...
Do somebody else encountered this on the aws_demo?
Thanks
from amazon-freertos.
Hi has, has anybody been able to solve the inconsistent demo results as reported by velbn?
Seeing similar issues. The demo succeeds sometimes to send MQTT messages to AWS, but does fail often to connect to the MQTT broker.
21 5325 [MQTTEcho] MQTT echo attempting to connect to xxxxxxxx.iot.us-east-1.amazonaws.com.
22 5826 [MQTTEcho] ERROR: MQTT echo failed to connect with error 1.
23 5826 [MQTTEcho] MQTT echo test could not connect to broker.
24 5826 [MQTTEcho] MQTT echo demo finished.
25 5826 [MQTTEcho] ----Demo finished----
from amazon-freertos.
Please try a "make erase_flash" before "make flash monitor". This will clear any invalid certificates or other data in flash memory that may be disrupting your socket connection to the broker.
from amazon-freertos.
Hi @velbn , are you able to get reliable results on doing make erase_flash
and then make flash monitor
from amazon-freertos.
if i remembered correctly no.
Did it multiple times i think.
I switched over to the aws iot embedded c sdk that is integrated with the ESP-IDF package
from amazon-freertos.
@velbn have been unblocked now after switching to c sdk ? Thanks
from amazon-freertos.
It seems things are working, and I'm closing this issue to clean up the ticket queue. Please reach out again, if there's still concern.
from amazon-freertos.
Hi, I am implementing the demo, I am using esp32 devkitc v1. I was able to connect to mqtt broker not it is not. Here is the message from mqtt debug log:
5 848 [main] Write device private key...
6 860 [main] Creating MQTT Echo Task...
7 860 [MQTTEcho] MQTT echo attempting to connect to XXXXXXXXXXiot.us-east-1.amazonaws.com.
8 860 [MQTTEcho] Sending command to MQTT task.
9 860 [MQTT] Received message 10000 from queue.
10 1861 [IP-task] Socket sending wakeup to MQTT task.
11 2361 [MQTT] About to close socket.
12 2361 [MQTT] Socket closed.
13 2361 [MQTT] Stack high watermark for MQTT task: 4696
14 2361 [MQTT] Notifying task.
15 2361 [MQTT] Received message 0 from queue.
16 2361 [MQTTEcho] Command sent to MQTT task failed.
17 2361 [MQTTEcho] ERROR: MQTT echo failed to connect with error 1.
18 2361 [MQTTEcho] MQTT echo test could not connect to broker.
19 2361 [MQTTEcho] Sending command to MQTT task.
20 2362 [MQTT] Received message 20000 from queue.
21 2362 [MQTT] Notifying task.
22 2363 [MQTTEcho] Command sent to MQTT task passed.
23 2363 [MQTTEcho] MQTT echo demo finished.
24 2363 [MQTTEcho] ----Demo finished----
from amazon-freertos.
Related Issues (20)
- [BUG] `CORE_MQTT_MUTUAL_AUTH` Demo: Failed to establish new connection HOT 5
- [BUG] pPublishInfo->payloadLength changes after call to sendPacket HOT 6
- [BUG] MbedTLS version not reflected within git modules. HOT 2
- [BUG] Array bound warning observed in iot_test_tcp.c HOT 2
- [General] Where is esp_hw_support component ? HOT 1
- [Feature Request] Allow to define custom 'help' command in freertos-cli HOT 2
- nvs_flash_init() panics HOT 1
- [BUG] Lacking a check for the return value of mbedtls_ssl_conf_own_cert() HOT 1
- [Feature Request] Update submodule "vendors/espressif/esp-idf" to release/v4.4 of esp-afr-sdk HOT 2
- [General] Unable to access esp-idf ble_wifi_provisioning component HOT 9
- [General] Cannot use Bluedroid, NVS crashes/panics HOT 15
- [General] BLE service to leverage IOT BLE data transfer service HOT 1
- ESP32 compiled binary shows absolute file path when walked through using binwalk HOT 6
- [General] STM32L4 discovary board AWS IoT Tera Term Error HOT 5
- [BUG] ESP32 Port SPI Error with S3 HOT 2
- [BUG] Trace output of ESP32-DevKitC jobs demo is clobbered HOT 2
- [General] Ethernet AWS MQTT DNS Network Error HOT 4
- [General] Is there a reason, why there is almost two months no merge in main? HOT 5
- [General] ESP32S3 OTA fails due to not multiple of 16 bytes
- [General] esp_ota_begin fails in simple example HOT 3
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 amazon-freertos.