b3nn0 / stratux

Fork of the original cyoung/stratux with multiple patches for flying in europe
BSD 3-Clause "New" or "Revised" License
157 stars 66 forks source link

T-Beam Flashing fails in multiple ways #307

Open Stefan-Kosker opened 9 hours ago

Stefan-Kosker commented 9 hours ago
  1. Stratux version:

  2. Stratux config:

    SDR

    • [ ] single
    • [x] dual

    GPS

    • [x] yes
    • [ ] no type:

    AHRS

    • [x] yes
    • [ ] no

    power source: 5V 20000mAh Powerbank

    usb cable: Generic USB-MicroUSB Cable 7cm

  3. EFB app and version: (e.g., WingX Pro7 8.6.2)

    EFB platform: (e.g., iOS 9.2)

    EFB hardware: (e.g., iPad Mini 2)

  4. Description of your issue:

When I try to flash the T-Beam, I get following stack trace error:

pi@stratux:/opt/stratux/ogn $ sudo /opt/stratux/ogn/install-ogntracker-firmware-pi.sh ogn-tracker-bin-tbeams3-sx1262-ubx
ogn-tracker-bin-tbeams3-sx1262-ubx.zip
Archive:  ogn-tracker-bin-tbeams3-sx1262-ubx.zip
  inflating: /tmp/bootloader.bin     
  inflating: /tmp/firmware.bin
  inflating: /tmp/partitions.bin     
  inflating: /tmp/esptool.py
esptool.py v2.7-dev
Serial port /dev/serialin
Connecting....
Traceback (most recent call last):
  File "/tmp/esptool.py", line 3065, in <module>
    _main()
  File "/tmp/esptool.py", line 3058, in _main
    main()
  File "/tmp/esptool.py", line 2757, in main
    esp.connect(args.before)
  File "/tmp/esptool.py", line 463, in connect
    last_error = self._connect_attempt(mode=mode, esp32r0_delay=False)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/esptool.py", line 441, in _connect_attempt
    self.flush_input()
  File "/tmp/esptool.py", line 377, in flush_input
    self._port.flushInput()
  File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 588, in flushInput
    self.reset_input_buffer()
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 683, in reset_input_buffer
    self._reset_input_buffer()
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 677, in _reset_input_buffer
    termios.tcflush(self.fd, termios.TCIFLUSH)
termios.error: (5, 'Input/output error')

Device is showing under the list of USB Devices, when I call lsusb: Bus 001 Device 010: ID 303a:8133 SoftRF Prime Edition Mk.3

I own following device: U-blox MAX-M10S-00B, SX1262 868MHz, CHINA (https://de.aliexpress.com/item/1005005418286231.html - UBLOX 868 Variant)

image

what am I doing wrong? SOFT-RF Hotspot gets created and GPS Fix is also there so the device is fine

image

Am I using the wrong software? On chip, it says v3.0 and it is a U-BLOX variant so the only U-BLOX in the list is sudo /opt/stratux/ogn/install-ogntracker-firmware-pi.sh ogn-tracker-bin-tbeams3-sx1262-ubx. At the same time, the T-Beam UI shows a version 1.2 but the only 1.2 version to flash is with sx1276 chip, so it is probably not compatible neither.

I would like to try the other methods as well, but unfortunately the both links here are down and leading to a 404: https://github.com/b3nn0/stratux/wiki/TTGO-T-Beam-Firmware-for-Stratux#flashing-from-linux

Only lead I got was, after the failing, the T-Beam is not showing up on USB devices anymore. I don't know if it is by design so. But install-ogntracker-firmware-pi.sh doesn't show any "disconnect USB Device" code

Help would be much appreciated. Best Regards Stefan Kosker

If possible, enable "Replay Logs", reproduce the problem, and provide a copy of the logs in http://192.168.10.1/logs/stratux/ and http://192.168.10.1/logs/stratux.log.

VirusPilot commented 9 hours ago

you may have to put your T-Beam in Espressif Service Mode (press and keep holding BOOT, press and release RESET, thereafter release BOOT) before starting the flash script

Stefan-Kosker commented 9 hours ago

you may have to put your T-Beam in Espressif Service Mode (press and keep holding BOOT, press and release RESET, thereafter release BOOT) before starting the flash script

Good idea, no chance:

image

ogn-tracker-bin-tbeams3-sx1262-ubx.zip
Archive:  ogn-tracker-bin-tbeams3-sx1262-ubx.zip
replace /tmp/bootloader.bin? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
  inflating: /tmp/bootloader.bin     
  inflating: /tmp/firmware.bin
  inflating: /tmp/partitions.bin
  inflating: /tmp/esptool.py
esptool.py v2.7-dev
Serial port /dev/serialin
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 322, in open
    self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/dev/serialin'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/esptool.py", line 3065, in <module>
    _main()
  File "/tmp/esptool.py", line 3058, in _main
    main()
  File "/tmp/esptool.py", line 2756, in main
    esp = chip_class(each_port, initial_baud, args.trace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/esptool.py", line 225, in __init__
    self._port = serial.serial_for_url(port)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/serial/__init__.py", line 90, in serial_for_url
    instance.open()
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 325, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/serialin: [Errno 2] No such file or directory: '/dev/serialin'

I wonder if it has something to do with me installing stratux radar first and trying to flash T-Beam afterwards.

Btw this is another error. Not the same

Best Regards Stefan Kosker

VirusPilot commented 9 hours ago

did you really put it in Espressif Service Mode? don't mix it up with the UF2 upload mode

Stefan-Kosker commented 9 hours ago

did you really put it in Espressif Service Mode? don't mix it up with the UF2 upload mode

I will be honest to you mate. If I knew what I was doing, I wouldn't be here.

First time hearing uf2 upload mode and espif service mode.

I will try again soon. How can I double check, if I am in service mode?

Stefan-Kosker commented 9 hours ago

It makes it hard to boot if the only buttons I have are power and rst btw. I got the same device as you suggested in your tutorials viruspilot. Did you had such an issue? Is the most right button boot button? I tried it with that as well but had no chance unfortunately

VirusPilot commented 9 hours ago

There is no confirmation about the service mode - only if e.g. you have booted SoftRF before and have an TX counter running, then in service mode this counter and the entire screen will freeze.

VirusPilot commented 9 hours ago

To force a power cycle, just remove the USB-C connector. Battery is anyway not recommended as it will prevent such a power cycle. Honestly, this device is quite picky sometimes ...

Stefan-Kosker commented 8 hours ago

So, usb out, finger on most right button, usb in?

I am asking this detailed, because as soon as it works, I will add a pr for updated readme

Stefan-Kosker commented 8 hours ago

Okay, so one step ahead:

ogn-tracker-bin-tbeams3-sx1262-ubx.zip
Archive:  ogn-tracker-bin-tbeams3-sx1262-ubx.zip
  inflating: /tmp/bootloader.bin     
  inflating: /tmp/firmware.bin
  inflating: /tmp/partitions.bin     
  inflating: /tmp/esptool.py
esptool.py v2.7-dev
Serial port /dev/serialin
Connecting...
Chip is ESP32D0WDQ6 (revision 0)
Features: WiFi, BT, Dual Core, Coding Scheme None
MAC: 00:00:00:00:00:00
Uploading stub...
Running stub...

A fatal error occurred: Invalid head of packet (0x47)

interesting. I guess, I achieved the debug mode: This is the result of lsusb: Bus 001 Device 006: ID 303a:1001 Espressif USB JTAG/serial debug unit. I wonder why Invalid head of packet (0x47) occurs

VirusPilot commented 7 hours ago

Next option is to connect the device with your PC and flash it with Chrome: https://espressif.github.io/esp-launchpad/. I will try this option on my end as well and report.

Stefan-Kosker commented 6 hours ago

That is what I wanted to try before coming here. Sadly the link for flash is 404. (See my first post) Can I use the zipfile in the folder for that?

Stefan-Kosker commented 6 hours ago

Another question. Maybe I should try the 10-1262 firmware. After all, the board says v3.0 but the number after T22 is still a11 and according to docs, I should use 10-1262 firmware. What do you think?

VirusPilot commented 6 hours ago

Another question. Maybe I should try the 10-1262 firmware. After all, the board says v3.0 but the number after T22 is still a11 and according to docs, I should use 10-1262 firmware. What do you think?

No, this package is for the ESP32 CPU. You need ESP32S3 versions.

VirusPilot commented 5 hours ago

I will try this option on my end as well and report.

No success also on my side either. I have been using PlatformIO to flash the latest version with OLED enabled.

Stefan-Kosker commented 5 hours ago

I got something:

https://esp32.com/viewtopic.php?t=21200

I think the package for our t-beam is compiled with an older version of esp-idf.

@b3nn0 can you provide me with a small documentation what to compile for my esp32. I would create a pr when successful. Or can you recompile the package for 1262-ubx with IDF at least version 4.3<? Thank you.

If I would guess, I would have to recompile this commit for target device and it should be good to go.

https://github.com/pjalocha/ogn-tracker/tree/03b9c07c0c3599a87567c079ea38ef38dde51ec8

Alternatively, another t-beam module? One without u-blox and v7 instead of V8 1262 chipset maybe? If it is more stable, I don't see any reason not to try it.

b3nn0 commented 5 hours ago

The firmware binary is almost definitely not the problem, they are built correctly. maybe a too-old version of esptool.py (which is used for flashing) is. Unfortunately I can't really test that here. In that case you should still be able to flash the firmware by other means. I already fixed the download links, you can find the zip files here: https://github.com/b3nn0/stratux/tree/master/ogn

Stefan-Kosker commented 5 hours ago

The firmware binary is almost definitely not the problem, they are built correctly. maybe a too-old version of esptool.py (which is used for flashing) is. Unfortunately I can't really test that here. In that case you should still be able to flash the firmware by other means. I already fixed the download links, you can find the zip files here: https://github.com/b3nn0/stratux/tree/master/ogn

Will try later. Thank you.