fredlcore / BSB-LAN

LAN/WiFi interface for Boiler-System-Bus (BSB) and Local Process Bus (LPB) and Punkt-zu-Punkt Schnittstelle (PPS) with a Siemens® controller used by Elco®, Brötje® and similar heating systems
225 stars 84 forks source link

[FEATURE REQUEST] Add support for WT32-ETH1 board #626

Closed jbaudoux closed 6 months ago

jbaudoux commented 6 months ago

I don't know yet if supporting such board will be easy or not but as I planned to use such board and willing to make the required changes I open an issue for logging the findings.

WT32-ETH1 is esp32 board with a built-in Ethernet port. This board simplifies the hardware when you need a wired LAN connection as you don't need a additional Ethernet board.

fredlcore commented 6 months ago

For that, we support the Olimex EVB and POE-ISO which both come with built-in Ethernet as well. The WT32-ETH1 does not have a pinout that is compatible to the adapters supported by this project, it also does not seem to have a USB port for uploading BSB-LAN without additional hardware. Both aspects mean it's not going to be working out-of-the-box, even more so if it should require the use of a different Ethernet library. All of this means more support work for me with no real benefit. A single digit difference in price would not be a compelling argument for me.

If it's possible to get it working solely by making use of BSB_LANcustom*.h files, I'm perfectly fine to add it to our library, but I won't entertain any changes in the code that go beyond that. However, feel free to log any findings here in case there are others who also want to go down that road for some reason.

jbaudoux commented 6 months ago

No adaptation required so far, it compiles properly for the board. :) I still have to upload and test

fredlcore commented 6 months ago

Watch out that the auto-detection for the RX/TX pins match. If the board behaves like a Joy-It NodeMCU, that should be the GPIOs 16 and 17, but you can check in the boot messages. I'm not sure if these are both accessible on your board, but if they are, then it should work in the same way as the Olimex.

jbaudoux commented 6 months ago

Here are my findings. I'll update this if I discover other useful info.

First of all, this board works without any required change to the code.

It will badly auto-detect the pins. RX1 & TX1 are not defined. In BSB_LAN_config.h you have to set byte bus_pins[2] = {5,17};

For serial programming, you need to ground IO0. For running, you need to remove it.

For serial debug & programming, best is to use a usb to ttl adapter. On warm up, note that the board starts faster than the usb serial connection. You'll may miss the first debug messages unless you add a 1s delay. Example https://github.com/fredlcore/BSB-LAN/pull/637

If you also encounter LAN disconnections, you may need to add a small capacitor on the power supply as close as possible as the power and gnd pins of the board. You can see the LAN socket disconnection by compiling with CORE_DEBUG_LEVEL=4. Note: I haven't tested this yet.

My platformio.ini

[env:wt32-eth01]
platform = espressif32
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.14
board = wt32-eth01
build_src_filter = +<*> -<src/ArduinoMDNS> -<src/WiFiSpi>
;build_flags = -DCORE_DEBUG_LEVEL=4
framework = arduino

I acquired the WT32-ETH01 board 8.4 EUR and the USB-TTL programmer 1.4 EUR. I built the BSB converter board following BSB-LAN schematic, around 10 EUR for the parts. I adapted the resistors based on the hfe of the bipolar transistors.