SkeletonMan03 / FZEasyMarauderFlash

Easily Flash Marauder onto the Flipper Zero Devboard or an ESP32!
GNU General Public License v3.0
1.02k stars 125 forks source link

Input/output error on Arch #11

Closed TheT3ngu closed 1 year ago

TheT3ngu commented 1 year ago

When I try to flash the device, it seems that my OS can't communicate with the board. The output is:

You have chosen to flash Marauder on a WiFi devboard or ESP32-S2
You are most likely using a Flipper Zero WiFi Devboard or an ESP32-S2
Erasing firmware...
esptool.py v4.4
Serial port /dev/ttyACM0
Connecting........
Traceback (most recent call last):
  File "/home/tengu/Schreibtisch/FZEasyMarauderFlash/EasyInstall.py", line 247, in <module>
    choose_fw()
  File "/home/tengu/Schreibtisch/FZEasyMarauderFlash/EasyInstall.py", line 93, in choose_fw
    flash_esp32marauder()
  File "/home/tengu/Schreibtisch/FZEasyMarauderFlash/EasyInstall.py", line 195, in flash_esp32marauder
    erase_esp32fw()
  File "/home/tengu/Schreibtisch/FZEasyMarauderFlash/EasyInstall.py", line 129, in erase_esp32fw
    esptool.main(['-p', serialport, '-b', BR, '-c', chip, '--before', 'default_reset', '-a', 'no_reset', 'erase_region', '0x9000', '0x6000'])
  File "/usr/lib/python3.10/site-packages/esptool/__init__.py", line 666, in main
    esp = esp or get_default_connected_device(
  File "/usr/lib/python3.10/site-packages/esptool/__init__.py", line 915, in get_default_connected_device
    _esp.connect(before, connect_attempts)
  File "/usr/lib/python3.10/site-packages/esptool/loader.py", line 632, in connect
    last_error = self._connect_attempt(
  File "/usr/lib/python3.10/site-packages/esptool/loader.py", line 556, in _connect_attempt
    self.bootloader_reset(usb_jtag_serial, extra_delay)
  File "/usr/lib/python3.10/site-packages/esptool/loader.py", line 537, in bootloader_reset
    self._setDTR(False)  # IO0=HIGH, done
  File "/usr/lib/python3.10/site-packages/esptool/loader.py", line 450, in _setDTR
    self._port.setDTR(state)
  File "/usr/lib/python3.10/site-packages/serial/serialutil.py", line 603, in setDTR
    self.dtr = value
  File "/usr/lib/python3.10/site-packages/serial/serialutil.py", line 473, in dtr
    self._update_dtr_state()
  File "/usr/lib/python3.10/site-packages/serial/serialposix.py", line 715, in _update_dtr_state
    fcntl.ioctl(self.fd, TIOCMBIC, TIOCM_DTR_str)
OSError: [Errno 5] Input/output error

Sorry, this is my first ESP-board and I have no clue where the error lies exactly. I tried to flash both with and without sudo and getting the same error. Also, my user is in the dialout-group.

SkeletonMan03 commented 1 year ago

I've not gotten an Input/Output error while flashing one before. All I can tell you for certain is this isn't an Arch problem as I've been using it on Arch and those errors appear to be coming from esptool. Are you running this on an ESP32-S2 or a WiFi Devboard? Did you put the chip into bootloader mode by doing the following? 1) Connect the devboard or ESP32 board via USB. 2) Press and hold the BOOT button on the module, press and release the RESET button. 3) Release the BOOT button.

TheT3ngu commented 1 year ago

Thaks for the response. I tested it on another system (also Arch), getting the same error there. It's a WiFi devboard, the sticker on the front reads: "Flipper Zero Wi-Fi Module v1". Sticker on the back states that it contains a ESPS2WR0VER. I tried the following combinations to get the board into download mode:

  1. Connect the board via USB, hold BOOT, press RESET, release BOOT
  2. Hold BOOT, connect the board via USB, release BOOT
  3. Hold BOOT, connect the board via USB, press RESET, release BOOT
  4. Connect the board, hold BOOT for 3 seconds

Nothing of it works, still getting the same error. May my board be broken, anything else I could try?

SkeletonMan03 commented 1 year ago

The Flipper devboard has an ESP32-S2 on it, but don't know if it's the Wrover, can you post a picture of the board where the actual chip is visible?

SkeletonMan03 commented 1 year ago

Could you also send the output of lsusb?

TheT3ngu commented 1 year ago

Sure thing. Pictures from the front and back. devboard_front devboard_back

Here is the output of lsusb when freshly plugged in, without putting it into download mode: Bus 003 Device 026: ID 303a:4001 Flipper Devices Inc. Blackmagic ESP32 Here is the output after putting it in download mode: Bus 003 Device 027: ID 303a:0002 Espressif ESP32-S2

SkeletonMan03 commented 1 year ago

Cool, everything else looks good, so I'm fairly certain your esptool install is broken somehow. Not your board, or even my tool. Could you try pip3 install --upgrade --no-deps --force-reinstall esptool?

TheT3ngu commented 1 year ago

You were right! I still don't know what exactly causes the problem on my Arch, but I ran your installer successfull after setting it up in an Ubuntu live enviroment, where it completed the flash in 6 seconds. Everything works now, thank you so much for your time and help!

SkeletonMan03 commented 1 year ago

I'm curious how that was broken on 2 Arch installs for you, but not on either of my Arch installs, we must have set our stuff up differently. I'm glad you got it working.

seanhagen commented 1 year ago

I had the same thing happen, and the esptool re-install got things kind of working. I say "kind of" because during the erasing/flashing process the dev board got reset and then showed up as /tty/ACM1 instead of /tty/ACM0, causing the tool to fail:

$ python3 EasyInstall.py                                                                                                         1521ms  Sat 08 Jul 2023 08:05:27 PM

#########################################################################                                                                                                                                
#    Marauder Flasher Script                                            #                                                                                                                                
#    Python edition by SkeletonMan based off of a Windows Batch         #                                                                                                                                
#    script by Frog, UberGuidoz, and ImprovingRigamarole                #                                                                                                                                
#                                                                       #                                                                                                                                
#    Thanks to everyone who has done testing on various chips for me    #                                                                                                                                
#    Thanks to Scorp for compiling needed bins for the ESP32-WROOM      #                                                                                                                                
#########################################################################                                                                                                                                

Make sure your ESP32 or WiFi devboard is plugged in!                                                                                                                                                     
Checking for prerequisites...                                                                                                                                                                            
The extra ESP32 bins folder exists!                                                                                                                                                                      
Checking for Marauder releases                                                                                                                                                                           
Great, you have the Marauder releases folder!                                                                                                                                                            
ESP32 Marauder firmware exists at ESP32Marauder/releases/esp32_marauder_v0_10_8_20230621_flipper.bin 
ESP32 Marauder firmware exists at ESP32Marauder/releases/esp32_marauder_v0_10_8_20230621_flipper_sd_serial.bin                                                                                           
ESP32-S3 firmware bin exists at ESP32Marauder/releases/esp32_marauder_v0_10_8_20230621_multiboardS3.bin                                                                                                  
Old Hardware bin exists at ESP32Marauder/releases/esp32_marauder_v0_10_8_20230621_old_hardware.bin                                                                                                       
Mini bin exists at ESP32Marauder/releases/esp32_marauder_v0_10_8_20230621_mini.bin                                                                                                                       

//======================================================\\                                                                                                                                               
|| Options:                                             ||                                          
|| 1) Flash Marauder on WiFi Devboard or ESP32-S2       ||                                                                                                                                               
|| 2) Flash SD Serial Marauder on Devboard or ESP32-S2  ||                                                                                                                                               
|| 3) Save Flipper Blackmagic WiFi settings             ||                                                                                                                                               
|| 4) Flash Flipper Blackmagic                          ||                                          
|| 5) Flash Marauder on ESP32-WROOM                     ||                                                                                                                                               
|| 6) Flash Marauder on ESP32 Wemos D1 Mini             ||                                          
|| 7) Flash Marauder on ESP32-S3                        ||                                          
|| 8) Update all files                                  ||                                          
|| 9) Exit                                              ||                                                                                                                                               
\\======================================================//                                          

Please enter the number of your choice: 1                                                                                                                                                                
You have chosen to flash Marauder on a WiFi devboard or ESP32-S2                                                                                                                                         
Checking for serial port...                                                                                                                                                                              
You are most likely using a Flipper Zero WiFi Devboard or an ESP32-S2                                                                                                                                    
Erasing firmware...                                                                                                                                                                                      
esptool.py v4.6.2                                                                                                                                                                                        
Serial port /dev/ttyACM0                                                                                                                                                                                 
Connecting...                                                                                                                                                                                            
Chip is ESP32-S2 (revision v0.0)                                                                                                                                                                         
Features: WiFi, No Embedded Flash, No Embedded PSRAM, ADC and temperature sensor calibration in BLK2 of efuse V2                                                                                         
Crystal is 40MHz                                                                                                                                                                                         
MAC: 84:f7:03:8b:09:a6                                                                                                                                                                                   
Uploading stub...                                                                                                                                                                                        
Running stub...                                                                                                                                                                                          
Stub running...                                                                                                                                                                                          
Erasing region (may be slow depending on size)...                                                                                                                                                        
Erase completed successfully in 0.4 seconds.                                                        
Staying in bootloader.                                                                                                                                                                                   
esp32s2 was successfully erased!                                                                    
Waiting 5 seconds...                                                                                
Flashing ESP32 Marauder Firmware on a WiFi Devboard or ESP32-S2...                                  
esptool.py v4.6.2                                                                                                                                                                                        
Serial port /dev/ttyACM0                                                                                                                                                                                 
Connecting........                                                                                                                                                                                       
[Errno 5] Input/output error                                                                                                                                                                             
Waiting 5 seconds and trying again...                                                                                                                                                                    
Flashing ESP32 Marauder Firmware on a WiFi Devboard or ESP32-S2...
esptool.py v4.6.2
Serial port /dev/ttyACM0
Could not open /dev/ttyACM0, the port doesn't exist
Waiting 5 seconds and trying again...
Flashing ESP32 Marauder Firmware on a WiFi Devboard or ESP32-S2...
esptool.py v4.6.2
Serial port /dev/ttyACM0
Could not open /dev/ttyACM0, the port doesn't exist
Could not flash firmware on ESP32-S2

But when I reset the board and just used esptool.py directly, it worked fine:

$ esptool.py -p /dev/ttyACM0 -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                                                                                                                                                       
esptool.py v4.6.2                                                                                                                                                                                        
Serial port /dev/ttyACM0                                                                                                                                                                                 
Connecting...                                                                                                                                                                                            
Chip is ESP32-S2 (revision v0.0)                                                                                                                                                                         
Features: WiFi, No Embedded Flash, No Embedded PSRAM, ADC and temperature sensor calibration in BLK2 of efuse V2                                                                                         
Crystal is 40MHz                                                                                                                                                                                         
MAC: 84:f7:03:8b:09:a6                                                                                                                                                                                   
Uploading stub...                                                                                                                                                                                        
Running stub...                                                                                     
Stub running...                                                                                                                                                                                          
Changing baud rate to 460800                                                                        
Changed.                                                                                            
Configuring flash size...                                                                           
Flash will be erased from 0x00001000 to 0x00004fff...                                                                                                                                                    
Flash will be erased from 0x00010000 to 0x000ecfff...                                                                                                                                                    
Flash will be erased from 0x00008000 to 0x00008fff...                                                                                                                                                    
Compressed 13248 bytes to 9298...                                                                                                                                                                        
Wrote 13248 bytes (9298 compressed) at 0x00001000 in 0.3 seconds (effective 395.7 kbit/s)...                                                                                                             
Hash of data verified.                                                                              
Compressed 904288 bytes to 562550...                                                                
Wrote 904288 bytes (562550 compressed) at 0x00010000 in 6.4 seconds (effective 1132.1 kbit/s)...                                                                                                         
Hash of data verified.                                                                              
Compressed 3072 bytes to 124...                                                                                                                                                                          
Wrote 3072 bytes (124 compressed) at 0x00008000 in 0.1 seconds (effective 359.7 kbit/s)...          
Hash of data verified.      

Leaving...                                                                                                                                                                                               
WARNING: ESP32-S2 (revision v0.0) chip was placed into download mode using GPIO0.                                                                                                                        
esptool.py can not exit the download mode over USB. To run the app, reset the chip manually.                                                                                                             
To suppress this note, set --after option to 'no_reset'.                             

Not sure what happened, but figured it's worth reporting here so you have another data point for comparison!