seemoo-lab / openhaystack

Build your own 'AirTags' 🏷 today! Framework for tracking personal Bluetooth devices via Apple's massive Find My network.
https://owlink.org
GNU Affero General Public License v3.0
8.03k stars 428 forks source link

ESP32 firmware doesn't work with ESP32-S2 Mini #164

Open dzianisv opened 1 year ago

dzianisv commented 1 year ago

Describe the bug I flashed openhaystack firmware to ESP32-S2 with the following cmdline

esptool.py  --before no_reset --baud 921600 --port /dev/cu.usbmodem01 write_flash 0x1000 /Users/engineer/workspace/openhaystack/Firmware/ESP32/build/bootloader/bootloader.bin 0x8000 /Users/engineer/workspace/openhaystack/Firmware/ESP32/build/partition_table/partition-table.bin 0xe000 /Users/engineer/workspace/openhaystack/Firmware/ESP32/tmp.key 0x10000 /Users/engineer/workspace/openhaystack/Firmware/ESP32/build/openhaystack.bin
esptool.py v4.4
Serial port /dev/cu.usbmodem01
WARNING: Pre-connection option "no_reset" was selected. Connection may fail if the chip is not in bootloader or flasher stub mode.
Connecting.....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Detecting chip type... ESP32-S2
Chip is ESP32-S2FH4 (revision v0.0)
Features: WiFi, Embedded Flash 4MB, No Embedded PSRAM, ADC and temperature sensor calibration in BLK2 of efuse V1
Crystal is 40MHz
MAC: 84:f7:03:db:92:a8
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Unexpected chip id in image. Expected 2 but value was 0. Is this image for a different chip model?

A fatal error occurred: /Users/engineer/workspace/openhaystack/Firmware/ESP32/build/bootloader/bootloader.bin is not an ESP32-S2 image. Use --force to flash anyway.

But esptool.py reports a wrong bootloader.bin image format. When I flashed with --force, it helped to flash, but device is not discoverable (I phones doesn't report it).

I am pretty new to ESP32 world, probably a firmware has to be rebuilt. Thoughts?

To Reproduce Steps to reproduce the behavior:

  1. Clone repo

  2. cd openhaystack/Firmware/ESP32

  3. Copy firmware from the latest release app, cp -r /Applications/OpenHaystack.app/Contents/Resources/ESP32/build .

  4. export PUBKEY= from OpenHaystack.app

    image
  5. Connect esp32 s2 mini board, hold key 0, push Reset key to switch MCU into USB download mode. image

  6. ./flash_esp32.sh --port /dev/cu.usbmodem01

Expected behavior 1 Firmware is flashed 2 USB device is discoverable

Screenshots ESP32-S2mini

OpenHaystack version: Version 0.5.2 (1)

macOS version: 12.5.1

Brezensalzer commented 1 year ago

Hi, as far as I know, the ESP32-S2 chip doesn't have bluetooth capabilities. https://www.adafruit.com/product/4653