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

Nix fails to set up environment #1

Open
HPlumley opened this issue Nov 14, 2022 · 5 comments
Open

Nix fails to set up environment #1

HPlumley opened this issue Nov 14, 2022 · 5 comments

Comments

@HPlumley
Copy link

When attempting to build following the steps in the readme:
Install Nix
Navigate to extras/nina-src
Run nix-shell

Running nix-shell gives the error:
error: cryptography-38.0.1 not supported for interpreter python2.7

I am not familiar with Nix so not sure how to resolve this, any help appreciated to get this building

@joonazan
Copy link
Owner

Python 2 is no longer supported, it seems and I didn't pin the version to a specific version of the Nix packages.

I've replaced the instructions with a command that uses a maintained and version pinned build script that does the same that mine used to do. nix --experimental-features 'nix-command flakes' develop github:mirrexagon/nixpkgs-esp-dev#esp32-idf This command is quite slow but at least it works reliably. Installing ESP-IDF is challenging because the tool requires rather specific versions of python packages.

I ran the build and it seems to work but as I no longer have access to the hardware, I cannot actually test it. Hopefully you can confirm that it works!

@HPlumley
Copy link
Author

HPlumley commented Nov 14, 2022

Thanks for the quick response.

I'm able to build now but it fails when attempting to upload to the ESP32 via the arduino. The connection appears to timeout during the handshake - I can see the RX LED flash a few times on the arduino and then the error below occurs.

I have attempted flashing using the ESP32 Flash Download Tool V3.9.3 and that works but I am not sure if I am uploading everything I need to. I set it to send bluetooth-coprocessor.bin to address 0x10000, do I also need to flash any other files also?

I presume this is caused by the esptool built from this repo being too old but I cannot identify an exact cause for it to fail uploading.

[nix-shell:/mnt/d/Downloads/nina-fast-bluetooth-master/extras/nina-src]$ make flash
Toolchain path: /nix/store/z00gdprrq2jlvbpi08132014jbd834sn-esp32-toolchain/bin/xtensa-esp32-elf-gcc
Toolchain version: crosstool-ng-1.22.0-80-g6c4433a
Compiler version: 5.2.0
esptool.py v2.8
Python requirements from /mnt/d/Downloads/nina-fast-bluetooth-master/extras/nina-src/esp-idf/requirements.txt are satisfied.

Project is not inside a git repository, will not use 'git describe' to determine PROJECT_VER.
App "bluetooth-coprocessor" version: 1
esptool.py v2.8
Flashing binaries to serial port /dev/ttyACM0 (app at offset 0x10000)...
esptool.py v2.8
Serial port /dev/ttyACM0
Connecting......
Traceback (most recent call last):
  File "/mnt/d/Downloads/nina-fast-bluetooth-master/extras/nina-src/esp-idf/components/esptool_py/esptool/esptool.py", line 3201, in <module>
    _main()
  File "/mnt/d/Downloads/nina-fast-bluetooth-master/extras/nina-src/esp-idf/components/esptool_py/esptool/esptool.py", line 3194, in _main
    main()
  File "/mnt/d/Downloads/nina-fast-bluetooth-master/extras/nina-src/esp-idf/components/esptool_py/esptool/esptool.py", line 2890, in main
    esp.connect(args.before)
  File "/mnt/d/Downloads/nina-fast-bluetooth-master/extras/nina-src/esp-idf/components/esptool_py/esptool/esptool.py", line 475, in connect
    last_error = self._connect_attempt(mode=mode, esp32r0_delay=False)
  File "/mnt/d/Downloads/nina-fast-bluetooth-master/extras/nina-src/esp-idf/components/esptool_py/esptool/esptool.py", line 455, in _connect_attempt
    self.sync()
  File "/mnt/d/Downloads/nina-fast-bluetooth-master/extras/nina-src/esp-idf/components/esptool_py/esptool/esptool.py", line 394, in sync
    timeout=SYNC_TIMEOUT)
  File "/mnt/d/Downloads/nina-fast-bluetooth-master/extras/nina-src/esp-idf/components/esptool_py/esptool/esptool.py", line 337, in command
    self.write(pkt)
  File "/mnt/d/Downloads/nina-fast-bluetooth-master/extras/nina-src/esp-idf/components/esptool_py/esptool/esptool.py", line 300, in write
    self._port.write(buf)
  File "/nix/store/6gcg2pc0iqdxik7f7dhmk7qs7mcqdmnr-python-2.7.18-env/lib/python2.7/site-packages/serial/serialposix.py", line 552, in write
    raise writeTimeoutError
serial.serialutil.SerialTimeoutException: Write timeout
make: *** [/mnt/d/Downloads/nina-fast-bluetooth-master/extras/nina-src/esp-idf/components/esptool_py/Makefile.projbuild:71: flash] Error 1

@joonazan
Copy link
Owner

I have attempted flashing using the ESP32 Flash Download Tool V3.9.3 and that works but I am not sure if I am uploading everything I need to. I set it to send bluetooth-coprocessor.bin to address 0x10000, do I also need to flash any other files also?

I am not sure about this, as I've only used make flash. sdkconfig and partitions.csv seem relevant to flashing but I don't know how make flash interprets them. If you make flash --dry-run  you might see something.

I had the some problems with flashing but I think it was related to the the Arduino and ESP sharing some wires. That is probably only an issue after flashing the new firmware. The solution to that was to reset the device after starting the flashing program.

@HPlumley
Copy link
Author

Using --dry-run did allow me to see the final command used by esptool:

python /mnt/d/Downloads/nina-fast-bluetooth-master/extras/nina-src/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port "/dev/ttyACM0" --baud 115200 --before "default_reset" --after "hard_reset" write_flash -z --flash_mode "dio" --flash_freq "40m" --flash_size detect   0x1000 /mnt/d/Downloads/nina-fast-bluetooth-master/extras/nina-src/build/bootloader/bootloader.bin 0x10000 /mnt/d/Downloads/nina-fast-bluetooth-master/extras/nina-src/build/bluetooth-coprocessor.bin 0x8000 /mnt/d/Downloads/nina-fast-bluetooth-master/extras/nina-src/build/partitions_singleapp.bin

I tried uploading the 3 bin files to those 3 locations which seemed to work. However, the example multiplication sketch did not successfully start the BLE module, as far as I could tell.

There are too many moving parts and possible sources of errors for me to identify what is not working here. I'm going to attempt to get the latest nina-fw building and if that works port your code across. Otherwise, I may try switching to ESP-AT which does the BLE processing on the ESP32.

I'll report back when I get something finally working.

@HPlumley
Copy link
Author

I could not get this repo working.

I was able to get the NimBLE examples building and running fine from the latest ESP-IDF but building this repo with the same framework did not lead to a functioning system. The build and upload passed fine but I did not dig further to debug your code.

I ended up switching to ESP-AT which has 90% of the functionality I want and works perfectly. For anyone who comes across this repo looking for a BLE (or Wi-Fi for that matter) solution for the Arduino MKR WiFi 1010 or the Arduino UNO WiFi Rev2 this page documents how to get ESP-AT running on the Nina-W102: https://projects.gepeo.fr/esp32/

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

2 participants