flipperzero-firmware icon indicating copy to clipboard operation
flipperzero-firmware copied to clipboard

Black Magic wont compile to wifi devboard

Open aidenhyde opened this issue 1 year ago • 3 comments

Describe the bug.

So i am using your guide to install black magic to the wifi devboard WD.1 When i run the command py -m ufbt devboard_flash i get the error of wifi board not being found. It shows up in my device manager.

Reproduction

  1. Install uFBT.
  2. Connect the wifiboard to pc
  3. run the command py -m ufbt devboard_flash

Target

Wifi Devboard

Logs

PS C:\Users\HydeAiden>  $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.22621.2506
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.2506
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


PS C:\Users\HydeAiden> py -m ufbt devboard_flash
scons: Entering directory `C:\Users\HydeAiden\.ufbt\current\scripts\ufbt'

fbt: warning: Folder app: manifest application.fam is missing
LoadAppManifest, line 33, in file "C:\Users\HydeAiden\.ufbt\current\scripts\fbt_tools\fbt_apps.py"
python C:\Users\HydeAiden\.ufbt\current\scripts/wifi_board.py
2023-11-16 10:09:09,804 [ERROR] WiFi board not found
2023-11-16 10:09:09,804 [INFO] Please connect WiFi board to your computer, hold down BOOT button and press RESET button
scons: *** [phony_devboard_flash] Error 1
PS C:\Users\HydeAiden>

Anything else?

No response

aidenhyde avatar Nov 16 '23 16:11 aidenhyde

Please show how does your device manager display it.

hedger avatar Nov 16 '23 16:11 hedger

Screenshot 2023-11-16 133909

aidenhyde avatar Nov 16 '23 19:11 aidenhyde

I have the same issue, and it also shows under "Other Devices" as ESP32-S2 with an error icon. image image Under the ports section od device manager, mine looks the same, except it is COM9 instead of 6. I confirmed the ID it shows is an ESP ID in the device manager. Hope this helps. Not sure what to try next.

ThirteenTX avatar Dec 29 '23 21:12 ThirteenTX

@hedger @DrZlo13 any progress?

skotopes avatar Jan 10 '24 07:01 skotopes

Just chiming in as I have the exact same issue. image

CookiePLMonster avatar Jan 29 '24 17:01 CookiePLMonster

I'm going to infodump everything I have found out when debugging it on my end. I will be updating this post with findings. cc @hedger

  • find_wifi_board_bootloader appears to be looking for ESP32-S2, so I tried to check if it shows in the list at all. include_links parameter does not help.
         for test_post in list_ports.comports():
             print(f'Name: {test_post.name}, Desc: {test_post.description}, HWID: {test_post.hwid}')
    
    Output: Name: COM6, Desc: USB Serial Device (COM6), HWID: USB VID:PID=303A:0002 SER=0 LOCATION=1-6:x.0 The name the script expects is present in Device Manager for this COM device under Bus reported device description, but that is not grepped by pySerial, at least by default.
  • This appears to be a known limitation of the Windows version of pySerial, with a PR open since 2018! https://github.com/pyserial/pyserial/pull/338
  • Passing the port manually through ufbt doesn't seem to work either, scons doesn't pass it through. I hoped for ufbt devboard_flash -p COM6 to work, but it doesn't.

It would seem like using -p COM6 may be necessary in this case? It is potentially a necessity on Windows overall? The docs seem to imply that by saying Repeat Step 1 and view the name of your Developer Board that appeared in the list., but then this is never brought up again. Seems like without manual setupapi query circumventing pySerial, this is currently hopeless.

EDIT: Even running wifi_board.py manually does not work. flash.command downloaded from Flipper's CDN refers to 'esptool.py -p (PORT) -b 460800 --before default_reset --after hard_reset --chip esp32s2 write_flash --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 bootloader.bin 0x10000 blackmagic.bin 0x8000 partition-table.bin \n' while on Windows, it's esptool.exe. The CDN might have to drop .py from the definition so it works on both OSes, maybe? It also cannot locate it, despite being located in python\Scripts.

EDIT2: I finally got it to run by:

  1. Adding flash_command.replace("esptool.py", "python -m esptool") to wifi_board.py. If this was to become a proper fix, python should probably become sys.executable though.
  2. Running wifi_board.py -p COM6. Notice that COM6 alone worked, which makes me think
    if os.name == "nt":
                 port.device = f"\\\\.\\{port.device}"
    
    in find_wifi_board_bootloader may not be needed?

CookiePLMonster avatar Jan 29 '24 17:01 CookiePLMonster