john30 / ebusd-esp

Firmware for ESP8266 allowing eBUS communication for ebusd (https://github.com/john30/ebusd)
150 stars 21 forks source link

Wemos D32 Pro Support (Boot Loop) #74

Closed ndfred closed 1 year ago

ndfred commented 1 year ago

I have been flashing the ebus-v3_lolin32_factory.bin D32 firmware onto my D32 Pro, which has 16MB of flash instead of 4MB (ESP32-WROVER rather than ESP32-WROOM-32), and am running into a boot loop:

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:QIO, clock div:2 load:0x3fff0030,len:1184 load:0xffffffff,len:-1

I know the D32 Pro is not officially supported, but I am wondering if there is a way to make it work given both boards are so similar. I tried flashing tasmota32.factory.bin and that works no problem. I thought I would rebuild the image for my own board, but the source code is not available.

If I flash tasmota32.factory.bin (which supports both D32 and D32 Pro boards among many others) with the exact same procedure, then I get a normal boot:

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT) flash read err, 1000 ets_main.c 371 ets Jun 8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0030,len:184 load:0x40078000,len:12588 ho 0 tail 12 room 4 load:0x40080400,len:2916 entry 0x400805c4

00:00:00.003 HDW: ESP32-D0WD (PSRAM disabled) 00:00:00.004 HDW: PSRAM is disabled, requires specific compilation on this hardware (see doc) 00:00:00.042 UFS: FlashFS mounted with 12596 kB free 00:00:00.081 CFG: Loaded from File, Count 5 00:00:00.097 QPC: Count 1 00:00:00.187 BRY: Berry initialized, RAM used=4041 bytes 00:00:00.211 Project tasmota - Tasmota Version 12.2.0(tasmota)-2_0_5(2022-10-17T08:39:59) 00:00:00.510 WIF: WifiManager active for 3 minutes 00:00:01.203 HTP: Web server active on tasmota-8D79F8-6648 with IP address 192.168.4.1 00:00:06.885 QPC: Reset

Here is the flashing procedure I have used on macOS (screen command commented, that is what I use to identify the boot loop):

#!/bin/sh -e

cd "`dirname $0`"
MODULES="esptool"
VENV_PATH="$PWD/venv"
SENTINEL_PATH="$VENV_PATH/.setupdone"
FIRMWARE="ebus-v3_lolin32_factory.bin"

if [ -f "$SENTINEL_PATH" ] && [[ $(< "$SENTINEL_PATH") == "$MODULES" ]]
then
  . "$VENV_PATH/bin/activate"
else
  echo "Creating virtual environment"
  rm -rf "$VENV_PATH"
  python3 -m venv "$VENV_PATH"
  . "$VENV_PATH/bin/activate"
  pip install --upgrade pip
  pip install $MODULES
  echo "$MODULES" > "$SENTINEL_PATH"
fi

if [ ! -f "$FIRMWARE" ]
then
  curl -L -O "https://github.com/john30/ebusd-esp/raw/master/dist/$FIRMWARE"
fi

esptool.py --port /dev/tty.usbserial-1330 erase_flash
esptool.py --port /dev/tty.usbserial-1330 write_flash 0x0 "$FIRMWARE"
# screen /dev/cu.usbserial-1330 115200

I have also looked at flash.sh that I modified to reuse esptool.py in the venv set up above, and that gives me a flash error mismatch (16MB rather than 4MB). Since the size is larger I reckon it shouldn't be a problem, so I just commented that test and got this command line, which I flashed my board with, again without success (boot loop):

esptool.py --chip=esp32 --baud 2000000 --after hard_reset write_flash --erase-all --flash_size 4MB --compress 0 ebus-v3_lolin32_factory.bin

ebus-v3_lolin32_factory.bin is 946112 bytes which matches the file on the repo. Any suggestions on how to make this work? Thanks!

ndfred commented 1 year ago

Tried with --flash_size 16MB and that doesn't solve it, and tried with the latest ebus-v3_lolin32_factory.bin (size 948960 bytes), no luck with that either.

ndfred commented 1 year ago

It seems obvious in retrospect, but I didn't realise you needed the eBUS Adapter to deal with 24V, and the board only accommodates the D1 mini format directly. So if I don't want a mess of wires, that board would work best.

john30 commented 1 year ago

you can also use a D1 mini 32. anyway, the flash size needs to match of course