OTA Example not working

gregstewart90
Posts: 59
Joined: Thu Jan 19, 2017 5:17 pm

OTA Example not working

Postby gregstewart90 » Fri Feb 10, 2017 6:38 pm

I've tried to get the OTA example working found in the esp-idf. I tried following the steps given, but it resulted in lots of errors.

A few examples of those errors.
esp-idf/examples/system/ota/build/esp32/libesp32.a(system_api.o):(.iram1.literal+0x34): undefined reference to `esp_wifi_stop'
/esp32/esp-idf/components/esp32/lib/librtc.a(bt_bb.o): In function `bt_rfoffset_en':
(.text+0x450): undefined reference to `g_phyFuns'
/esp32/esp-idf/components/esp32/lib/librtc.a(bt_bb.o): In function `force_bt_mode':
(.text+0x7c8): undefined reference to `phy_force_wifi_chan'

I then copied the code into Eclipse where I am doing the rest of my project. I had a lot of errors here too, so I did the following replacements:
bool -> int
true -> 1
false -> 0
<netdb.h> -> "lwip/netdb.h"
<sys/socket.h> -> "lwip/sockets.h" AND "lwip/sys.h"

I also updated the example wifi settings to match that of my router. The following is the output of the esp32.

Code: Select all

[0;32mI (5789) event: ip: 192.168.135.12, mask: 255.255.0.0, gw: 192.168.135.1[0m
[0;32mI (5790) ota: Connect to Wifi ! Start to Connect to Server....[0m
[0;32mI (5792) ota: Server IP: 192.168.135.6 Server Port:8071[0m
[0;32mI (6025) ota: Connected to server[0m
[0;32mI (6025) ota: Connected to http server[0m
[0;32mI (6026) ota: Send GET request to server succeeded[0m
[0;31mE (6028) esp_ota_ops: not found ota data[0m
Guru Meditation Error of type LoadProhibited occurred on core  0. Exception was unhandled.

The output of the python script

Code: Select all

Serving HTTP on 0.0.0.0 port 8071 ...



192.168.135.12 - - [10/Feb/2017 11:32:57] "GET /hello-world.bin  HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('192.168.135.12', 9756)
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 290, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 318, in process_request
    self.finish_request(request, client_address)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 331, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 654, in __init__
    self.finish()
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 713, in finish
    self.wfile.close()
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 283, in close
    self.flush()
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 307, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
Ultimately I want the code in eclipse, make the binary, and then signal the esp32 to connect the the server, download the binary, and then use the new image. It looks to me like if this example works, I can use this code in my project, and I would just need to signal the OTA to start, and everything would basically work as planned.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: OTA Example not working

Postby WiFive » Fri Feb 10, 2017 11:44 pm

esp_ota_ops: not found ota data

Sounds like you don't have the correct partition table?

gregstewart90
Posts: 59
Joined: Thu Jan 19, 2017 5:17 pm

Re: OTA Example not working

Postby gregstewart90 » Sat Feb 11, 2017 4:05 pm

The partition table was the problem. To fix it, I did the following:

make menuconfig
Partition Table
Factory App, two OTA definitions
Save
Exit

I then ran
make erase_flash flash

and reflashed. I kept getting the error

Code: Select all

OTA Write Header format Check Failed!
so I changed the code in the resolve_pkg function from 0xE9 0x08 to 0xE9 0x09.

Code: Select all

if (ota_write_data[0] == 0xE9 && i_write_len >= 2 && ota_write_data[1] == 0x08) {
                ESP_LOGI(TAG, "OTA Write Header format Check OK. first byte is %02x ,second byte is %02x", ota_write_data[0], ota_write_data[1]);
            } else {
                ESP_LOGE(TAG, "OTA Write Header format Check Failed! first byte is %02x ,second byte is %02x", ota_write_data[0], ota_write_data[1]);
                return 0;
            }
I'm not sure why the file started with 0xE9 0x08 instead of 0xE9 0x09. I uploaded a different file .bin file and it worked with the 0xE9 0x08 configuration.

Who is online

Users browsing this forum: No registered users and 116 guests