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

Unable to use it #7

Closed
markopesevski opened this issue Jul 15, 2020 · 13 comments
Closed

Unable to use it #7

markopesevski opened this issue Jul 15, 2020 · 13 comments

Comments

@markopesevski
Copy link

markopesevski commented Jul 15, 2020

[edit, solved] my issue was not having python2 installed. Somehow make compiles even though it was throwing an error during compilation of the bootloader.

Hi there, I've been trying to use this port to no avail.
Things I've done:

  • Compile seems to go according to plan, make ends with:
[...compilation steps cut out...]
CC build/wpa_supplicant/src/fast_crypto_ops.o
CC build/wpa_supplicant/port/os_xtensa.o
AR build/wpa_supplicant/libwpa_supplicant.a
Generating esp8266.project.ld
LD build/blackmagic.elf
esptool.py v2.4.0
To flash all build output, run 'make flash' or:
python /home/marko/git/blackmagic-espidf/ESP8266_RTOS_SDK/components/esptool_py/esptool/esptool.py --chip esp8266 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after soft_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0xd000 /home/marko/git/blackmagic-espidf/build/ota_data_initial.bin 0x0000 /home/marko/git/blackmagic-espidf/build/bootloader/bootloader.bin 0x10000 /home/marko/git/blackmagic-espidf/build/blackmagic.bin 0x8000 /home/marko/git/blackmagic-espidf/build/partitions_two_ota.bin
  • After that I run make flash, which goes something like:
Toolchain path: /home/marko/esp/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc
Toolchain version: crosstool-ng-1.22.0-100-ge567ec7
Compiler version: 5.2.0
Python requirements from /home/marko/git/blackmagic-espidf/ESP8266_RTOS_SDK/requirements.txt are satisfied.
Flashing binaries to serial port /dev/ttyUSB0 (app at offset 0x10000)...
esptool.py v2.4.0
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: 4c:11:ae:0a:ca:7b
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Compressed 8192 bytes to 31...
Wrote 8192 bytes (31 compressed) at 0x0000d000 in 0.0 seconds (effective 32817.3 kbit/s)...
Hash of data verified.
Compressed 16 bytes to 24...
Wrote 16 bytes (24 compressed) at 0x00000000 in 0.0 seconds (effective 65.3 kbit/s)...
Hash of data verified.
Compressed 499696 bytes to 364577...
Wrote 499696 bytes (364577 compressed) at 0x00010000 in 4.6 seconds (effective 870.8 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 106...
Wrote 3072 bytes (106 compressed) at 0x00008000 in 0.0 seconds (effective 8203.0 kbit/s)...
Hash of data verified.

Leaving...
Soft resetting...
  • And then my board starts blinking the LED quite erratically. Opening its port on a terminal (@74800 baud, the baudrate during booting) delivers the following:
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)
load 0x60000014, len 8, room 16
tail 8

Which, to my understanding, indicates that the ESP is in a reset loop.

Any help is appreciated. This project is a great idea but I can't make it work and don't know what I'm doing wrong 😭

@benvonhandorf
Copy link
Contributor

@markopesevski Did you change any configuration options via make menuconfig?
Are you trying to use the app in Station mode or AP mode?
Part of my PR was an option in the config to disable the rerouting of the ESP8266's UART so that you get more complete logging information. It may be worth toggling that and re-flashing to see if you get a more clear error.

@markopesevski
Copy link
Author

markopesevski commented Jul 15, 2020

@markopesevski Did you change any configuration options via make menuconfig?

At first I had changed some out of desperation, but I've just cloned the repo fresh and tried it without changing anything.

Are you trying to use the app in Station mode or AP mode?

I'd prefer using it in Station mode to be able to connect both the ESP and my PC to the same network to retain my internet connection.

Part of my PR was an option in the config to disable the rerouting of the ESP8266's UART so that you get more complete logging information. It may be worth toggling that and re-flashing to see if you get a more clear error.

Ok, I'll try and get back.

Thank you for your time in any case!

@benvonhandorf
Copy link
Contributor

@markopesevski One thing to be aware of is that the station configuration is case sensitive on the AP name. This caught me out when I was enabling this functionality.

@markopesevski
Copy link
Author

@markopesevski One thing to be aware of is that the station configuration is case sensitive on the AP name. This caught me out when I was enabling this functionality.

This is my current configuration for the Blackmagic component of the menu:
image

I've made sure the SSID and password are well written (case-sensitive ✔️) and still no good.

Part of my PR was an option in the config to disable the rerouting of the ESP8266's UART so that you get more complete logging information. It may be worth toggling that and re-flashing to see if you get a more clear error.

If I'm not mistaken the option you mentioned is "Monitor target UART" from the menu in the image above, right?

@benvonhandorf
Copy link
Contributor

@markopesevski Yes, that's the option I added. If it's disabled then the code should continue to use the ESP UART for debugging.

Hopefully in that state you'll get something more useful out of the debug log.

@markopesevski
Copy link
Author

Hopefully in that state you'll get something more useful out of the debug log.

No luck... I'm still getting the same. Must be something wrong with my module, or something I'm not doing quite right. But it'd seem weird for the module to be bad, since the one I'm trying it on now is a new one I just took out of the bag it came in when I bought it 😅.

I've also tried erasing its flash with esptool.py erase_flash prior to flashing it with make flash. Still same results as with an old one I had laying around.

@benvonhandorf
Copy link
Contributor

If you change your monitor to look at the UART at 115200, which I think is the default in the monitoring configuration, do you get additional output? I may have left in the baud rate change even when the targeting is turned off (bad on me).

@walmis
Copy link
Owner

walmis commented Jul 16, 2020

Maybe the module is with 512KB flash ? IIRC the ones with 512KB will not work correctly.

@markopesevski
Copy link
Author

If you change your monitor to look at the UART at 115200, which I think is the default in the monitoring configuration, do you get additional output? I may have left in the baud rate change even when the targeting is turned off (bad on me).

Didn't do anything new... Garbled characters while the ESP is booting, and nothing useful after.

Maybe the module is with 512KB flash ? IIRC the ones with 512KB will not work correctly.

I don't know for sure, but esptool.py flash_id delivers:

esptool.py v2.6
Found 2 serial ports
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 4c:11:ae:0a:ca:7b
Uploading stub...
Running stub...
Stub running...
Manufacturer: ef
Device: 4016
Detected flash size: 4MB
Hard resetting via RTS pin...

So I think they are 4MB, but the modules came from China so anything and everything is to be expected. These are the concrete ones I bought. The modules themselves seem fine because I can upload other code, i.e. a blink sketch from Arduino, and the LED blinks correctly.

Maybe I have to change the addresses at which the binaries are loaded? 🤷‍♂️

@walmis
Copy link
Owner

walmis commented Jul 16, 2020

Could you try building the AP version instead of STA and try flashing that?

@markopesevski
Copy link
Author

markopesevski commented Jul 16, 2020

Could you try building the AP version instead of STA and try flashing that?

I had already done it, but just rebuilt the AP version to try again. This is my config now:
image
Built, flashed and still no luck, same results as before.

On my part I'm suspicious of my Partition Table config and/or the addresses where the binaries get loaded, as I mentioned before. I haven't touched it so it should be correct, but... 🤷‍♂️ Right now my partition table config looks like this:
image

Don't know what else could be wrong. This is my repo diff.

$ git diff
diff --git a/sdkconfig b/sdkconfig
index 8b2f735..9850547 100644
--- a/sdkconfig
+++ b/sdkconfig
@@ -68,14 +68,16 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=230400
 CONFIG_ESP_WIFI_IS_SOFTAP=y
 # CONFIG_ESP_WIFI_IS_STATION is not set
 CONFIG_ESP_WIFI_MODE_AP=y
-CONFIG_ESP_WIFI_SSID="auto"
-CONFIG_ESP_WIFI_PASSWORD="helloworld"
+CONFIG_ESP_WIFI_SSID="bmesp"
+CONFIG_ESP_WIFI_PASSWORD="blackmagic"
 CONFIG_MAX_STA_CONN=4
 CONFIG_TDI_GPIO=13
 CONFIG_TDO_GPIO=14
 CONFIG_TMS_SWDIO_GPIO=0
 CONFIG_TCK_SWCLK_GPIO=2
 CONFIG_SRST_GPIO=12
+# CONFIG_TARGET_UART is not set
+CONFIG_BLACKMAGIC_HOSTNAME="blackmagic"
 # CONFIG_PARTITION_TABLE_SINGLE_APP is not set
 CONFIG_PARTITION_TABLE_TWO_OTA=y
 # CONFIG_PARTITION_TABLE_CUSTOM is not set

Any more ideas? Thank you for your time!!

@walmis
Copy link
Owner

walmis commented Jul 16, 2020

I've just flashed a random ESP8266 module with micro usb laying around with a fresh clone, seems to work fine, appears in wifi networks list.

Toolchain path: /home/walmis/Desktop/Programming/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc
Toolchain version: crosstool-ng-1.22.0-100-ge567ec7
Compiler version: 5.2.0
Python requirements from /home/walmis/Desktop/Programming/blackmagic-espidf/ESP8266_RTOS_SDK/requirements.txt are satisfied.
Flashing binaries to serial port /dev/ttyUSB1 (app at offset 0x10000)...
esptool.py v2.4.0
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: 50:02:91:68:38:2c
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 230400
Changed.
Configuring flash size...
Compressed 8192 bytes to 31...
Wrote 8192 bytes (31 compressed) at 0x0000d000 in 0.0 seconds (effective 11461.4 kbit/s)...
Hash of data verified.
Compressed 5632 bytes to 4464...
Wrote 5632 bytes (4464 compressed) at 0x00000000 in 0.2 seconds (effective 224.0 kbit/s)...
Hash of data verified.
Compressed 499712 bytes to 364732...
Wrote 499712 bytes (364732 compressed) at 0x00010000 in 16.2 seconds (effective 247.5 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 106...
Wrote 3072 bytes (106 compressed) at 0x00008000 in 0.0 seconds (effective 2814.4 kbit/s)...
Hash of data verified.

Leaving...
Soft resetting...

in menuconfig you could try these:
You could try to reduce flash speed to 40M
also you could try Single factory app, no OTA

@markopesevski
Copy link
Author

markopesevski commented Jul 16, 2020

Hey @walmis and @benvonhandorf, thanks again.
Just right now I've realized the fact that my bootloader isn't compiling correctly. 🤦‍♂️
Comparing the sizes of your results and mine @walmis, I saw that:

[... walmis ...]
Compressed 5632 bytes to 4464...
Wrote 5632 bytes (4464 compressed) at 0x00000000 in 0.2 seconds (effective 224.0 kbit/s)...
Hash of data verified.
[... mine ...]
Compressed 16 bytes to 24...
Wrote 16 bytes (24 compressed) at 0x00000000 in 0.0 seconds (effective 65.3 kbit/s)...
Hash of data verified.

I'm trying to figure out what's going on so it doesn't compile correctly, so I'll post when I find a solution.
For now all I know is that it seems some weird python2 vs python3 thing going on with esptool.py. And IIRC I don't even have python2 installed, so I'm going to give that a try.
This is the error I'm getting:

[...compilation steps cut out...]
CC build/bootloader/util/src/sha512.o
AR build/bootloader/util/libutil.a
LD build/bootloader/bootloader.elf
esptool.py v2.4.0
Traceback (most recent call last):
  File "/home/marko/git/blackmagic-espidf/ESP8266_RTOS_SDK/components/esptool_py/esptool/esptool.py", line 3034, in <module>
    _main()
  File "/home/marko/git/blackmagic-espidf/ESP8266_RTOS_SDK/components/esptool_py/esptool/esptool.py", line 3027, in _main
    main()
  File "/home/marko/git/blackmagic-espidf/ESP8266_RTOS_SDK/components/esptool_py/esptool/esptool.py", line 2800, in main
    operation_func(args)
  File "/home/marko/git/blackmagic-espidf/ESP8266_RTOS_SDK/components/esptool_py/esptool/esptool.py", line 2369, in elf2image
    image.save(args.output)
  File "/home/marko/git/blackmagic-espidf/ESP8266_RTOS_SDK/components/esptool_py/esptool/esptool.py", line 1380, in save
    checksum = self.save_segment(f, segment, checksum)
  File "/home/marko/git/blackmagic-espidf/ESP8266_RTOS_SDK/components/esptool_py/esptool/esptool.py", line 1290, in save_segment
    f.write(segment.data)
TypeError: a bytes-like object is required, not 'str'
make[1]: *** [/home/marko/git/blackmagic-espidf/ESP8266_RTOS_SDK/components/esptool_py/Makefile.projbuild:72: /home/marko/git/blackmagic-espidf/build/bootloader/bootloader.bin] Error 1
make: *** [/home/marko/git/blackmagic-espidf/ESP8266_RTOS_SDK/components/bootloader/Makefile.projbuild:40: /home/marko/git/blackmagic-espidf/build/bootloader/bootloader.bin] Error 2

[edit] solved by installing python2. Now it flashes and appears as an AP correctly. I haven't tried but I'm guessing station mode will work also. So, lesson learned.
Thanks again for your ideas. I'm going to edit my first post to add this in case anyone stumbles pursuing the same ghost.

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