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

Rainmaker OTA fails - ESP HTTPS OTA Begin failed (MEGH-5052) #287

Open
3 tasks done
miroslavpetrov opened this issue Nov 5, 2023 · 2 comments
Open
3 tasks done

Comments

@miroslavpetrov
Copy link

Answers checklist.

  • I have read the Rainmaker documentation and the issue is not addressed there.
  • I have updated my IDF branch (release/vX.Y) to the latest version and checked that the issue is present there. This is not applicable if you are using Rainmaker with Arduino.
  • I have searched the Rainmaker forum and issue tracker for a similar issue and not found a similar issue.

General issue report

We run rainmaker in a private AWS instance. OTA was working fine a few months ago. Now i am trying to update a few nodes and in the console i get the following:

10:15:59.070 -> �[0;32mI (535478) esp_rmaker_ota_using_topics: Upgrade Handler got:{"url":"xxx","fw_version":"2.0","ota_job_id":"ZRhABWWP2GC6DN6yWvvSoK","file_size":1577600}
10:15:59.166 ->  on node/Bx3LawREvwzSiBqN6TCRXP/otaurl topic
10:15:59.198 -> �[0;32mI (535578) esp_rmaker_ota_using_topics: OTA Job ID: ZRhABWWP2GC6DN6yWvvSoK�[0m
10:15:59.198 -> �[0;32mI (535588) esp_rmaker_ota_using_topics: URL: xxx�[0m
10:15:59.293 -> �[0;32mI (535688) esp_rmaker_ota_using_topics: File Size: 1577600�[0m
10:15:59.293 -> �[0;32mI (535698) esp_rmaker_ota: Reporting in-progress: Starting OTA Upgrade�[0m
10:15:59.293 -> �[0;32mI (535698) esp_rmaker_ota_using_topics: {"ota_job_id":"ZRhABWWP2GC6DN6yWvvSoK","status":"in-progress","additional_info":"Starting OTA Upgrade"}�[0m
10:15:59.327 -> �[0;33mW (535718) esp_rmaker_ota: Starting OTA. This may take time.�[0m
10:16:01.272 -> �[0;32mI (537688) esp-x509-crt-bundle: Certificate validated�[0m
10:16:06.680 -> �[0;33mW (543098) esp-tls: Failed to open new connection in specified timeout�[0m
10:16:06.680 -> �[0;31mE (543098) TRANSPORT_BASE: Failed to open a new connection�[0m
10:16:06.712 -> �[0;31mE (543098) HTTP_CLIENT: Connection failed, sock < 0�[0m
10:16:06.712 -> �[0;31mE (543098) esp_https_ota: Failed to open HTTP connection: ESP_ERR_HTTP_CONNECT�[0m
10:16:06.712 -> �[0;31mE (543108) esp_https_ota: Failed to establish HTTP connection�[0m
10:16:06.712 -> �[0;31mE (543118) esp_rmaker_ota: ESP HTTPS OTA Begin failed�[0m
10:16:06.712 -> �[0;32mI (543118) esp_rmaker_ota: Reporting failed: ESP HTTPS OTA Begin failed�[0m
10:16:06.746 -> �[0;32mI (543128) esp_rmaker_ota_using_topics: {"ota_job_id":"ZRhABWWP2GC6DN6yWvvSoK","status":"failed","additional_info":"ESP HTTPS OTA Begin failed"}�[0m

Any ideas on how to dig deeper in the problem and fix the issue?

@github-actions github-actions bot changed the title Rainmaker OTA fails - ESP HTTPS OTA Begin failed Rainmaker OTA fails - ESP HTTPS OTA Begin failed (MEGH-5052) Nov 5, 2023
@shahpiyushv
Copy link
Collaborator

Can you try initialising the console commands using esp_rmaker_console_init() and check memory available after you see this error using mem-dump command on the serial terminal?

Also, please check if you can download the OTA image using the url from a host machine connected to the same network.

@FBSeletronica
Copy link

I had the same issue here using the ESP32-S2 with IDF v5.1. I tested the same code on the ESP32, ESP32-S3, ESP32-C6, and ESP32-C3, and it worked correctly.

Since it only failed on the ESP32-S2, I realized it was a memory issue, as @shahpiyushv suggested. So, I analyzed the sdkconfig.defaults for the ESP32-C2, which has less RAM, and noticed some optimizations.

So I made adjustments to my sdkconfig for the ESP32-S2, such as:

CONFIG_ESP_RMAKER_OTA_HTTP_RX_BUFFER_SIZE=512

CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y
CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH=y

CONFIG_ESP32S2_INSTRUCTION_CACHE_LINE_16B=y
CONFIG_ESP32S2_DATA_CACHE_LINE_16B=y

CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=16
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2048
CONFIG_ESP_MAIN_TASK_STACK_SIZE=3072

CONFIG_ESP_TIMER_TASK_STACK_SIZE=2048

CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y

Finally, I was able to perform the OTA successfully.

But I'm not sure if what I did is correct or if it might affect other functionalities.

@shahpiyushv, I suggest that you update sdkconfig.defaults.esp32s2 to include the necessary optimizations for the ESP32-S2. Can you make this adjustment?

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

3 participants