-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to ESP32 - Wemos S2/C3 mini and S3 #605
Comments
The esp32-s2 is a different chip so the code needs to compiled. I've haven't tried it myself. https://docs.platformio.org/en/stable/boards/espressif32/lolin_s2_mini.html |
It's the easiest to just get a MH-ET LIVE D1 Mini with ESP32 chip. |
Thank you, I have the MH-ET, just wanted to know if I have to cut the enclosure, as these mentioned boards are the same size as the D1 mini. Ordered them, and will try them out if it works. |
The MH-ET is wider so you have to make a few adjustments to the housing. See the wiki: |
What I'm trying to avoid is to cut the housing. But this is a good idea to cut the board itself, thank you :) |
You also have to remove the plastic spacer from the board pins to make the usb fit without cutting the housing. |
I did build for S2: there are 3 minor adjustments necessary NO UART2 moved to UART1 needs testing, NO BT skip include esp_bt.h and I modified the rename_fw script to generate a S2 specific bin file. Only problem: the settings are not stored in NVS. It's already mentioned as an issue in 3.4.2. If that part is fixed I can do some testing. I will create an PR if it works. |
@ajvdw There's already a working version committed for Lolin C3 mini. |
I followed the same path ;-) I'd like to propose the bin files to follow the names in the PlatformIO Project environment, the rename_fw script would be something like, so no need to mention the flash size separately: chip_target = env.get('PIOENV').upper()
|
That's a good recommendation. I had already change the file in the latest flash_optmization branch (which I'll merge into dev soon): EMS-ESP32/scripts/rename_fw.py Line 39 in 58a0ec9
|
Today i've got a C3-Mini and a S2-Mini from lolin store. I'll check memory and issues the next days. S2 has less ram, but PSRAM. I'm curious how this works. |
I'm also curious how to use it (there are a few ways described here). I'm also going to start looking at how to measure performance using some kind of profile. There must be something out there that can monitor. The alternative is to build a test into test.cpp which will stress test EMS-ESP by loading data, printing it, publishing it, and repeating for a few minutes, and then logging CPU and memory consumption. There are 2 cores in the ESP32 standard and I don't think we're even using the 2nd one fully. |
@proddy To identify the platform in a string at central place i've modified the version.h to
Is this ok, or should i add a |
Yes! Nice. |
It's better to check the chip, not the specific board.
The C3-Mini board have a rgb-LED (WS2812B), and can not be switchted by gpio, needs a fast protocoll with ns timing. Adafruit NeoLED lbrary can handle this, but flash is nearly full for ESP32C3. For now i skip LED. |
I've ordered an S2 and C3 because I'm missing out on the fun too. regarding the RGB, I have some old C code from another project years ago that handled the RGB LED on an ESP32, I'll see if I can reuse it. |
I've done some testing with the S2, I can't change to GPIO 7 to 9 because of the validators. More GPIO's should be probably allowed. My board used GPIO18 and GP19 on the ESP32 on the S2 the GPIO pins 7 and 9 are on that location.... I defined my board profile but I couldn't get it to connect to the EMS bus. Probably because of incorrect initialization? I remember a remark about setting GPIO's before initializing the UART. But I can't find the matching commit with that fix..... |
Those validators are easy to adjust for the different ESPs. I'm sure Michael can figure out the GPIOs init. I'm waiting for my S2's to arrive. |
@ajvdw I will push a working dev soon to my repo and make a pr. Here is a working bin from my testings (with some extra debug logs, experimental values, etc.) |
I've tested this version. It seems to work even with. the custom GPIO's set to 7 and 9. |
The source is online now: https://github.com/MichaelDvP/EMS-ESP32/tree/dev_. |
Got my S2 Mini and C3 Mini today so will join the fun |
I think you have a configuration error with the two ems-esp, same bus-id, same mqtt-settings, same hostname, or something like that. But without log and system info it's just a look in a crystall ball. |
No different bus-id, s3 without mqtt, different hostname and ip-adresses. |
I have tried the official build, it crashes every few seconds. Seems i have made a fix in my testbuild, have to check what is was. |
Seems to be a stack overflow in UART task, change line 92 of |
@MichaelDvP yes uart stack size was causing the problems. |
Under S3 the 2 following thermostat entities are missing: hc1/hc2.haclimate. Anyhow I do have no glue what these entities are used for. Same code for S3 (16MB) and ESP32 (4MB) with new partioning. |
This is a dummy entity to generate the homeassistant climate card depending on thermostat configuration. It should show up in settings customizations, but only has a value if HA is activated. |
Understood. Everything seems to work now. Just a final question: while using the S3 I need to compile always by myself - isn't it? (I can't use the bin-files (4MB) provided by @proddy) |
The current bin file on the repository is specific to the ESP32 architecture, the ESP32-S3 is a different architecture. |
The esp32, s2, c3, s3 are different chip types and needs different binary files. The platformio.ini sets the right chiptype and partition size. Set in your pio_local.ini
to build both binaries if you hit build button. |
I've been running on S3 for a while now, very stable. @MichaelDvP do you think we can close this? |
Yes, S3 is working good, i have 2 gateways connected MH-ET and S3. C3 was also good, but not tested with the latest 3.6. With S2 i remember that memory was a bit critical, but maybe this was also the stack overflow from NTP service. My S2-tests are long time ago. We can reopen for S2 if someone use it an report issues. |
Before we close, can we add the bin files to the release, so people can use them without compiling the whole stuff? |
Well maybe now is a good time to start offering a bin file for S3 on the repository. |
@CheeseE Seems we had the same idea at the same time :-) |
Same for me. Bin files for S3 would be fine. Is there any chance to provide old version bin files in the repository as well? |
Github actions has a issue for S3 with default platform, giving |
Tested the S2 again with actual v3.6dev.
|
Do you know what is causing the mqtt errors? Is it because of the heap check we added? I've been looking into https://github.com/bertmelis/espMqttClient which is new version of asyncMqttClient from one of the maintainers. It looks more lightweight and we can probably not use async and just send out the messages immediately because of the ESP32's dual core. I'm not sure though.
Good catch. We can add that code to ignore it. Also, do you think it's worth investing time into making EMS-ESP work on an S2? |
Yes, mostly. The async-mqtt also checks for free heap (4k) and gives message id 0 back if lower. For the HA messages we can change the mqtt publish functions to bool, checking the message-Id and resend later if not sent.
looks nice. Also the current async-mqtt has a queue and processes qos, works also direct sending. The ems-esp queue is only usefull to queue before connected. But the new lib looks good. We should test it.
No. But it's a nice test to see what happens if heap gets low and PSRam is active. Should be possible to make it stable. |
@MichaelDvP could we add C3 binaries as well? I'm using that one for months now without issues. |
The C3 works good, has more ram than S2 and with reduced tx-power buspowernig is possible. The Wemos C3 mini fits in the old gateway premium. It has only 4MB flash, but asymetric partitions with loader work. But there are different versions of the wemos, v1.0.0 needs a special wifi init and have a single LED, v2.1.0 has a programable RGB-LED. So we need different binaries. I think it's better to compile yourself, or forc the repo and edit the github action to build your version. @proddy what do you think about adding C3 bnary? |
agree to make special instructions on how to adjust for C3 |
I'll add an update to my wiki soon with instruction on selecting the correct bin file. |
Just an update to modules: |
Thanks for sharing. Hopefully bbqkees has enough S3's in stock for his next batch of gateway boards. Then next I'd love to play with the C6 with its fast RISC-V and WiFi6 support. |
Question
Has anyone tried this or this board to upgrade the old ESP8266 to ESP32? Is it pin-to-pin compatible with the D1 mini? It seems to me but it would be good for someone to confirm, thanks.
The text was updated successfully, but these errors were encountered: