logo elektroda
logo elektroda
X
logo elektroda

Configuring OpenBeken on ESP32 with 4MB Default Using sdkconfig.defaults.esp32

insmod 18810 245
ADVERTISEMENT
  • #61 21221732
    max4elektroda
    Level 24  
    Posts: 746
    Help: 48
    Rate: 184
    Thanks for integrating DS1820 - just tested successfully on S2.

    Can you explain, how all the "standard-settings" can be disabled?
  • ADVERTISEMENT
  • #62 21221762
    insmod
    Level 31  
    Posts: 1356
    Help: 161
    Rate: 426
    >>21221732 I haven't found the reason, why it enables all the drivers. It tries enabling IR driver, even if i disabled autostart. So far, i don't have any ideas, where it is coming from.
    Also, wdt resetting me is TG0WDT_SYS_RESET/TG1WDT_SYS_RESET, and not RTCWDT_SYS_RESET, so configured wdt is 'innocent'.

    Added after 1 [hours] 5 [minutes]:

    Fixed. Now also supports deep sleep (for now without gpio).
    Still needs uart test.
  • #63 21221858
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12433
    I've flashed 1344_merge_512e0b4ce3b0 on my C3 and it works, no phantom drivers nor channels:
    OpenESP32C3 user interface with system information and configuration options.
    The UART can be tested if you enable UART cmdline flag.
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md
    
    // Here is how you can get log print on UART1, instead of default UART2 on Beken
    
    // Enable "[UART] Enable UART command line"
    // this also can be done in flags, enable command line on UART1 at 115200 baud
    SetFlag 31 1
    // UART1 is RXD1/TXD1 which is used for programming and for TuyaMCU/BL0942,
    // but now we will set that UART1 is used for log
    logPort 1 
    

    but I guess the log port is already the flashing port on ESP (as in Tasmota), so only Flag 31 is needed?

    Hm it can't receive commands yet:
    Screenshot of a terminal program showing system logs and serial port settings.



    Ok so let's try DeepSleep:
    Screenshot of OpenESP32C3 tool showing terminal logs.
    Nice, it rebooted like after 10 seconds so I guess that's working.
    Helpful post? Buy me a coffee.
  • #64 21221870
    DeDaMrAz
    Level 22  
    Posts: 600
    Help: 34
    Rate: 127
    @insmod

    Fix is correct :) I got a IO2 set as LED and it stayed after OTA

    OpenESP32 user interface with a Toggle 0 button and system information

    rst:0x1 (POWERON_RESET),boot:0x13 (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:7176
    load:0x40078000,len:15564
    ho 0 tail 12 room 4
    load:0x40080400,len:4
    load:0x40080404,len:3904
    entry 0x40080640
    I (31) boot: ESP-IDF c8fc5f64 2nd stage bootloader
    I (31) boot: compile time Sep 10 2024 09:09:59
    I (31) boot: Multicore bootloader
    I (36) boot: chip revision: v3.0
    I (39) boot.esp32: SPI Speed      : 40MHz
    I (44) boot.esp32: SPI Mode       : DIO
    I (49) boot.esp32: SPI Flash Size : 4MB
    I (53) boot: Enabling RNG early entropy source...
    I (59) boot: Partition Table:
    I (62) boot: ## Label            Usage          Type ST Offset   Length
    I (69) boot:  0 otadata          OTA data         01 00 00009000 00002000
    I (77) boot:  1 nvs              WiFi data        01 02 0000b000 00005000
    I (84) boot:  2 app0             OTA app          00 10 00010000 001d0000
    I (92) boot:  3 app1             OTA app          00 11 001e0000 001d0000
    I (99) boot:  4 lfs              Unknown data     01 82 003b0000 00050000
    I (107) boot: End of partition table
    I (111) esp_image: segment 0: paddr=001e0020 vaddr=3f400020 size=21e90h (138896)                                                                                                                                                                                                                                              map
    I (167) esp_image: segment 1: paddr=00201eb8 vaddr=3ff8005f size=00008h (     8)                                                                                                                                                                                                                                              load
    I (167) esp_image: segment 2: paddr=00201ec8 vaddr=3ffb0000 size=04a8ch ( 19084)                                                                                                                                                                                                                                              load
    I (180) esp_image: segment 3: paddr=0020695c vaddr=40080000 size=096bch ( 38588)                                                                                                                                                                                                                                              load
    I (197) esp_image: segment 4: paddr=00210020 vaddr=400d0020 size=821e4h (532964)                                                                                                                                                                                                                                              map
    I (379) esp_image: segment 5: paddr=0029220c vaddr=400896bc size=0e06ch ( 57452)                                                                                                                                                                                                                                              load
    I (402) esp_image: segment 6: paddr=002a0280 vaddr=400c0000 size=00060h (    96)                                                                                                                                                                                                                                              load
    I (414) boot: Loaded app from partition at offset 0x1e0000
    I (415) boot: Disabling RNG early entropy source...
    I (427) cpu_start: Multicore app
    I (435) cpu_start: Pro cpu start user code
    I (435) cpu_start: cpu freq: 160000000 Hz
    I (435) app_init: Application information:
    I (438) app_init: Project name:     OpenBeken
    I (443) app_init: App version:      512e0b4
    I (448) app_init: Compile time:     Sep 10 2024 15:40:46
    I (454) app_init: ELF file SHA256:  d5f0f82af...
    I (459) app_init: ESP-IDF:          c8fc5f64
    I (464) efuse_init: Min chip rev:     v0.0
    I (469) efuse_init: Max chip rev:     v3.99
    I (474) efuse_init: Chip rev:         v3.0
    I (479) heap_init: Initializing. RAM available for dynamic allocation:
    I (486) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
    I (492) heap_init: At 3FFBDF98 len 00022068 (136 KiB): DRAM
    I (498) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
    I (504) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
    I (511) heap_init: At 40097728 len 000088D8 (34 KiB): IRAM
    I (519) spi_flash: detected chip: generic
    I (522) spi_flash: flash io: dio
    I (537) pm: Frequency switching config: CPU_MAX: 160, APB_MAX: 80, APB_MIN: 40,                                                                                                                                                                                                                                              Light sleep: DISABLED
    I (538) main_task: Started on CPU0
    I (548) main_task: Calling app_main()
    Entering initLog()...
    Commands registered!
    initLog() done!
    Info:MAIN:Main_Init_Before_Delay
    
    Main_Init_Before_Delay done
    
    Main_Init_Delay
    
    Main_Init_Delay done
    Warn:CFG:CFG_InitAndLoad: Correct config has been loaded with 4 changes count.
    Error:CMD:lfs is absent
    Info:GEN:PIN_SetupPins pins have been set up.
    Info:MAIN:Main_Init_Before_Delay done
    Info:MAIN:Main_Init_Delay
    Info:MAIN:Main_Init_Delay done
    Info:MAIN:Main_Init_After_Delay
    Info:MAIN:Using SSID [Ordinacija]
    Info:MAIN:Using Pass [DraganSavatic]
    Info:MQTT:MQTT_RegisterCallback called for bT esp8487B1AC/ subT esp8487B1AC/+/se                                                                                                                                                                                                                                             t
    Info:MQTT:MQTT_RegisterCallback called for bT esp/ subT esp/+/set
    Info:MQTT:MQTT_RegisterCallback called for bT cmnd/esp8487B1AC/ subT cmnd/esp848                                                                                                                                                                                                                                             7B1AC/+
    Info:MQTT:MQTT_RegisterCallback called for bT cmnd/esp/ subT cmnd/esp/+
    Info:MQTT:MQTT_RegisterCallback called for bT esp8487B1AC/ subT esp8487B1AC/+/ge                                                                                                                                                                                                                                             t
    Error:CMD:LFS_ReadFile: lfs is absent
    Info:CMD:CMD_StartScript: failed to get file autoexec.bat
    Info:MAIN:Main_Init_After_Delay done
    Info:MAIN:Time 1, idle 0/s, free 236216, MQTT 0(0), bWifi 0, secondsWithNoPing -                                                                                                                                                                                                                                             1, socks 0/0
    Info:MAIN:Time 2, idle 0/s, free 236216, MQTT 0(0), bWifi 0, secondsWithNoPing -                                                                                                                                                                                                                                             1, socks 0/0
    Info:MAIN:Time 3, idle 0/s, free 236216, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 0/0
    Info:MAIN:Time 4, idle 0/s, free 236216, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 0/0
    Info:MAIN:Time 5, idle 0/s, free 236216, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 0/0
    I (5568) wifi:wifi driver task: 3ffc7c54, prio:23, stack:3072, core=0
    I (5588) wifi:wifi firmware version: ccaebfa
    I (5588) wifi:wifi certification version: v7.0
    I (5588) wifi:config NVS flash: enabled
    I (5588) wifi:config nano formating: enabled
    I (5588) wifi:Init data frame dynamic rx buffer num: 32
    I (5598) wifi:Init static rx mgmt buffer num: 5
    I (5598) wifi:Init management short buffer num: 32
    I (5598) wifi:Init dynamic tx buffer num: 32
    I (5608) wifi:Init static rx buffer size: 1600
    I (5608) wifi:Init static rx buffer num: 10
    I (5618) wifi:Init dynamic rx buffer num: 32
    I (5618) wifi_init: rx ba win: 6
    I (5618) wifi_init: accept mbox: 6
    I (5628) wifi_init: tcpip mbox: 32
    I (5628) wifi_init: udp mbox: 6
    I (5638) wifi_init: tcp mbox: 6
    I (5638) wifi_init: tcp tx win: 5760
    I (5638) wifi_init: tcp rx win: 5760
    I (5648) wifi_init: tcp mss: 1440
    I (5648) wifi_init: WiFi IRAM OP enabled
    I (5658) wifi_init: WiFi RX IRAM OP enabled
    I (5658) phy_init: phy_version 4830,54550f7,Jun 20 2024,14:22:08
    I (5748) wifi:mode : sta (78:21:84:87:b1:ac)
    I (5748) wifi:enable tsf
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTING - 1
    Info:MAIN:WiFi Connecting...
    I (5758) wifi:new:<11,0>, old:<1,0>, ap:<255,255>, sta:<11,0>, prof:1, snd_ch_cfg:0x0
    I (5758) wifi:state: init -> auth (0xb0)
    I (5768) wifi:state: auth -> assoc (0x0)
    I (5778) wifi:state: assoc -> run (0x10)
    I (5788) wifi:<ba-add>idx:0 (ifx:0, f4:17:b8:fa:ad:23), tid:0, ssn:0, winSize:64
    I (5788) wifi:<ba-add>idx:1 (ifx:0, f4:17:b8:fa:ad:23), tid:5, ssn:0, winSize:64
    I (5808) wifi:connected with Ordinacija, aid = 10, channel 11, BW20, bssid = f4:17:b8:fa:ad:23
    I (5808) wifi:security: WPA2-PSK, phy: bgn, rssi: -41
    I (5808) wifi:pm start, type: 1
    
    I (5808) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us
    I (5898) wifi:AP's beacon interval = 102400 us, DTIM period = 1
    Info:MAIN:Time 6, idle 0/s, free 199756, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 0/0
    Info:MAIN:Boot complete time reached (5 seconds)
    Info:MAIN:Time 7, idle 0/s, free 199756, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 0/0
    I (7818) esp_netif_handlers: sta ip: 192.168.0.50, mask: 255.255.255.0, gw: 192.168.0.1
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
    Info:MAIN:Time 8, idle 0/s, free 199108, MQTT 0(0), bWifi 1, secondsWithNoPing -1, socks 0/0
    Info:MAIN:Time 9, idle 0/s, free 198936, MQTT 0(0), bWifi 1, secondsWithNoPing -1, socks 0/0
    Info:MQTT:mqtt_host empty, not starting mqtt
    Info:MAIN:Time 10, idle 0/s, free 196152, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 0/0
    Info:MAIN:Time 11, idle 0/s, free 186440, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 0/0
    Info:MAIN:Time 12, idle 0/s, free 195768, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 0/0
    Info:MAIN:Time 13, idle 0/s, free 195456, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 0/0
    Info:MAIN:Time 14, idle 0/s, free 194920, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 0/0
    Info:MAIN:Time 15, idle 0/s, free 194836, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 0/0
    Info:MAIN:Time 16, idle 0/s, free 194940, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 0/0
    Info:MAIN:Time 17, idle 0/s, free 194596, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 0/0
    Info:MAIN:Time 18, idle 0/s, free 194424, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 0/0
    Info:MAIN:Time 19, idle 0/s, free 194252, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 0/0
    


    Even reboot works now without panic dump :) but still with a stack overflow.

    Screenshot of system logs during the startup process of the ESP32 controller. Visible messages about booting, WiFi configuration, and stack overflow errors.
  • ADVERTISEMENT
  • #65 21221926
    max4elektroda
    Level 24  
    Posts: 746
    Help: 48
    Rate: 184
    ... great, and DS1820 works, too ;-)

    Screenshot of the OpenESP32 interface showing DS1820 temperature at 22.62°C and system details.

    Added after 6 [minutes]:

    DS1820 works - and I also tried successfully with PowerSave 1 and PowerSave2.

    Just out of curiosity, not really a big issue: Does ESP32 has an internal temperature? Its always 0.0, but works fine with S2 and S3.
    [Edit]
    Just did a quick search, seems that the "old" ESP32 don't have an internal temperature sensor...
  • #66 21221977
    divadiow
    Level 38  
    Posts: 4882
    Help: 427
    Rate: 869
    ESP32-WROOM-03 1344_merge_512e0b4ce3b0

    startdriver bmpi2c = WDT reboot
    Code: Text
    Log in, to see the code


    ESP32-C2 1344_merge_512e0b4ce3b0

    startdriver bmpi2c =
    Code: Text
    Log in, to see the code


    ESP32-C3 1344_merge_512e0b4ce3b0

    startdriver bmpi2c =
    Code: Text
    Log in, to see the code


    Added after 2 [hours] 8 [minutes]:

    p.kaczmarek2 wrote:
    I wonder if DHT and DS18B20 are working already

    DHT11 not for me

    ESP32-C2 1344_merge_512e0b4ce3b0
    GPIO2.
    To confirm sensor operation:
    Screenshot showing readings from the DHT11 sensor on ESP32C2 using Tasmota.

    No autostart.
    Screenshot showing no active drivers on ESP32C2.
  • ADVERTISEMENT
  • #67 21222190
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12433
    DHT11 (edit - and other DHTs as well) in OBK is special, it does not reside as a "driver". It's per pin. It will not display as "1 drivers running".
    Helpful post? Buy me a coffee.
  • #68 21222203
    divadiow
    Level 38  
    Posts: 4882
    Help: 427
    Rate: 869
    ah OK. I've not even tried my DHT11 and DHT22 on Beken OBK.

    Connected the DHT22 anyway

    Display of sensor data for DHT22 and DHT11, indicating zero temperature and humidity.
  • ADVERTISEMENT
  • #69 21222204
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12433
    Sorry, to be clear, I meant that all DHTs in OBK are handled in a special way, not just DHT11. Anyway, it doesn't look like it's working. Or maybe you forgot the resistor? Is your pin index correct?
    Helpful post? Buy me a coffee.
  • #70 21222245
    divadiow
    Level 38  
    Posts: 4882
    Help: 427
    Rate: 869
    p.kaczmarek2 wrote:
    Anyway, it doesn't look like it's working

    indeed. thought I'd demonstrate further ;)
    p.kaczmarek2 wrote:
    Or maybe you forgot the resistor?

    theyre these with resistors on board. and DHT11 works in Tasmota (DHT22 driver doesn't seem to be in the unofficial C2 build image) edit: used AM2301 driver
    DHT11 module with resistors on a blue background. Module with three pins on a blue mat, next to a DHT11 sensor.
    p.kaczmarek2 wrote:
    Is your pin index correct?

    how do I determine this?

    I have confirmed pin 4 is GPIO4 with an LED/Relay assignment.

    I've just tried DHT11 and DHT22 on ESP32-WROOM-32 too and I have the same result.
  • #71 21222604
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12433
    I'd just try blinking a LED first on that pin. If it blinks, then assigment is okay.

    In a meantime, I'm working on charts driver:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/src/driver/drv_charts.c
    Helpful post? Buy me a coffee.
  • #72 21222606
    divadiow
    Level 38  
    Posts: 4882
    Help: 427
    Rate: 869
    p.kaczmarek2 wrote:
    I'd just try blinking a LED first on that pin. If it blinks, then assigment is okay.

    assignment is confirmed OK with LED.
    p.kaczmarek2 wrote:
    In a meantime, I'm working on charts driver:

    im excited about this!
  • #73 21222660
    insmod
    Level 31  
    Posts: 1356
    Help: 161
    Rate: 426
    UART finally somewhat working. To prevent it from crashing, had to add vTaskDelay(3) after UART_AppendByteToReceiveRingBuffer in loop. But, if there is much data, then the uart buffer will overflow, which will trigger input flushing and queue resetting.
    For BMP280: i have it working alright on C3 and pins 0 & 1, but 2 & 3 aren't working. Maybe some pullup/pulldown issue?

    Also, PWM now works (6 channels for now on all chips).
  • #74 21222691
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12433
    Does a LED blink works on pins 2 and 3?
    Is your BMP280 connected with external pull down resistors on I2C lines?
    Helpful post? Buy me a coffee.
  • #75 21222698
    divadiow
    Level 38  
    Posts: 4882
    Help: 427
    Rate: 869
    insmod wrote:
    PWM now works

    1344_merge_7a09f42bfbdd. quick test with ESP32-C2 and a single LED is good.
    ESP32-C2 board connected to LEDs on a breadboard.
    dimming 'works'. flickery for me but I assume my LEDs are rubbish
  • #77 21223029
    divadiow
    Level 38  
    Posts: 4882
    Help: 427
    Rate: 869
    DeDaMrAz wrote:
    Any chance you will play around with ESP8266?


    +1 would love this
  • #78 21223268
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12433
    Port is using esp-idf SDK:
    https://github.com/espressif/esp-idf.git
    Code snippet showing changes in the .gitmodules file, adding the esp-idf submodule.
    this SDK only supports:
    ESP-IDF compatibility table for Espressif SoCs with support indications for various versions.
    However, there is also:
    https://github.com/espressif/ESP8266_RTOS_SDK
    And it seems to have lwip and most of the required stuff. So the main question would be how to setup the project and build process, the C porting itself should be very easy.
    Helpful post? Buy me a coffee.
  • #79 21223468
    insmod
    Level 31  
    Posts: 1356
    Help: 161
    Rate: 426
    Tested BMP280 on my ESP32-C6 board.
    Pins 0, 1, 2, 8, 9 working alright as both SDA or SCL.
    Pins 14 as SCL and 13 as SDA, i2c address gets detected, but reading wrong chip id (random at each start). Not working in reverse.

    ESP8266 can be ported later, SDK's are similar enough. But, will it have enough RAM? ESP32-C2 is already struggling, some time after boot it will sometimes fail at allocating memory for tcp client (?, don't exactly remember which, just remember errors in uart and failing at loading main page).

    Questions: should setting loglevel/logfeature in autoexec.bat/early.bat crash the system? When executing manually from console it's working ok.
    Maybe we should call HAL_WiFi_SetupStatusCallback before HAL_ConnectToWiFi? Some events may otherwise be lost.
    Why isn't fast connect enabled by default? We could repurpose the fast connect flag then to make further connections via psk. LN882H for example would be very easy to adapt, and i have made an example for beken.
  • #80 21223521
    divadiow
    Level 38  
    Posts: 4882
    Help: 427
    Rate: 869
    ESP32 WROOM-03 1344_merge_7a09f42bfbdd
    woohoo. finally got something. this is on ESP32 though. nothing for me on C2 yet.
    Code: Text
    Log in, to see the code

    ESP-WROOM-32 module pin diagram with labels

    Display showing information about ESP32, temperature, and pressure from BMP280 sensor.

    and BME680 (but no temp)
    Code: Text
    Log in, to see the code

    command rationale:
    Code: Text
    Log in, to see the code

    Screenshot of sensor readings from BME68X on ESP32.

    Added after 1 [minutes]:

    @insmod on the next release would you mind adding AHTXX driver please?

    Added after 5 [minutes]:

    and set the UART log baud to 115200 for C2 as it needs to be 74880 at the moment :)
  • Helpful post
    #81 21223539
    insmod
    Level 31  
    Posts: 1356
    Help: 161
    Rate: 426
    >>21223521 Baud rate is configured automatically. All C2 revisions, bar last, don't work with 40mhz XTAL. So, they ended up using 26Mhz, as the only working one. Baud rate then is derived as 115200 / 40 * 26.
  • #82 21223551
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12433
    insmod wrote:

    Why isn't fast connect enabled by default?

    This is because in the very early days we had no fast connect flag at all, but, suprisingly, some users were reporting device boot looping/crashing on startup. It didn't affect all devices, just some of them. BK7231 obviously. So, with @btsimonh , we've decided to introduce a delay and those functions:
    - Main_Init_BeforeDelay_Unsafe(false);
    - Main_Init_AfterDelay_Unsafe(false);
    Then, after a year or so, I've tried to optimize door sensors/other battery powered devices so I added "fast connect flag" to allow users experiment.
    Long story short, this flag is not enabled by default because I am simply worried that it may randomly break stuff and scare beginners.

    insmod wrote:
    We could repurpose the fast connect flag then to make further connections via psk. LN882H for example would be very easy to adapt, and i have made an example for beken.

    Yes. That's what I wanted to do. Feel free to make the required modifications.
    For people reading, this refers to: https://github.com/openshwprojects/OpenBK7231T_App/pull/1297

    insmod wrote:

    ESP8266 can be ported later, SDK's are similar enough.

    I can do most of the coding once we get basic compilation process running.

    insmod wrote:

    But, will it have enough RAM? ESP32-C2 is already struggling, some time after boot it will sometimes fail at allocating memory for tcp client (?, don't exactly remember which, just remember errors in uart and failing at loading main page).

    Many things can be optimized per platform. First thing to check could be here:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/src/httpserver/http_tcp_server.c
    Disable CREATE_THREAD_PER_EACH_HTTP_CLIENT or just take some time and rewrite the system to use a cached number of buffers instead of doing malloc/free every time.
    I have ESP board at hand, I can help with optimization.


    insmod wrote:

    Questions: should setting loglevel/logfeature in autoexec.bat/early.bat crash the system? When executing manually from console it's working ok.

    I am currently not aware about this problem. The logging was done by @btsimonh , so my knowledge about it may not be perfect. Is it replicable on all platforms, @divadiow ?
    I've checked the code:
    https://github.com/openshwprojects/OpenBK7231...7829b24843426908bb/src/logging/logging.c#L750
    I can't see any possible crash reasons there. But maybe... comment out sscanf call and retry?
    I remember that in the past we had some ssprintf/sscanf issue and we ended up with using lowweight sscanf/ssprintf replacement.


    insmod wrote:

    Maybe we should call HAL_WiFi_SetupStatusCallback before HAL_ConnectToWiFi? Some events may otherwise be lost.

    Sure, we can try that, I just have two requests, if you can:
    - please consider merging ESP progress first and then doing separate PR for next changes if possible
    - we need to test each main app flow change before releasing

    Added after 1 [hours] 10 [minutes]:

    EDIT: Not strictly related to ESP, but still interesting to run it there - charts driver:
    https://www.elektroda.com/rtvforum/topic4075289.html
    Helpful post? Buy me a coffee.
  • #83 21223661
    divadiow
    Level 38  
    Posts: 4882
    Help: 427
    Rate: 869
    divadiow wrote:
    on the next release would you mind adding AHTXX driver please

    re 1344_merge_1765acff9bb2 - thank you
    I'm afraid no AHT2XX shows in the driver menu as expected - for ESP32 and ESP32-C2. No biggie, just thought I could test some AHTs

    Screenshot of controller menu with selected options AHT2X_SDA and AHT2X_SCK.
  • #84 21223666
    insmod
    Level 31  
    Posts: 1356
    Help: 161
    Rate: 426
    >>21223661 It was removed, just start driver like bmp280/bmpi2c
  • #86 21223711
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12433
    Very nice, with a temperature, humidity and pressure data, we can finally make a good use of a three-axis chart from our new driver:
    https://www.elektroda.com/rtvforum/topic4075289.html
    Helpful post? Buy me a coffee.
  • #87 21223829
    divadiow
    Level 38  
    Posts: 4882
    Help: 427
    Rate: 869
    >>21223711

    was looking to make something for all 4 readings but on ESP32 startdriver ntp causes a stack overflow and reboot until device ends up in safe mode
    Code: Text
    Log in, to see the code
  • #88 21223920
    insmod
    Level 31  
    Posts: 1356
    Help: 161
    Rate: 426
    >>21223829 Try again, i increases the stack size
  • #89 21223955
    divadiow
    Level 38  
    Posts: 4882
    Help: 427
    Rate: 869
    much better. ntp starts and so does charts,
    @p.kaczmarek2 but nothing drawn. Testing with original script (but with BMP280/AHT20);

    Code: Text
    Log in, to see the code

    and this I hoped would work with BMP280/AHT20
    Code: Text
    Log in, to see the code


    Screenshot displaying BMP280 and AHT2X sensor data on the OpenESP32 interface.
  • #90 21223965
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14451
    Help: 650
    Rate: 12433
    Hmm post in charts doc topic and we will continue there, as it may refer to charts themselves and not to ESP32 I guess? Also check with "Inspect element" is the chart there at all. And refresh page.
    Helpful post? Buy me a coffee.

Topic summary

✨ The discussion centers on configuring OpenBeken firmware for ESP32 devices with a default 4MB flash size using sdkconfig.defaults.esp32. Initial issues included missing sdkconfig.defaults.esp32 and bootloader offset misconfiguration, which were resolved to enable successful compilation and flashing. Various ESP32 variants were tested, including ESP32-C3, ESP32-C6, ESP32-CAM, ESP32-C2, ESP32-D0WDQ5-V3 (ESP-WROOM-32), and ESP32-S3, with reports on flash size detection, bootloader behavior, and peripheral support. Challenges encountered involved stack overflows on reboot, watchdog timer resets, and GPIO functionality inconsistencies, particularly on non-C/S ESP32 boards. Solutions included adjusting makefiles for 4MB flash, fixing bootloader offsets, increasing task stack sizes, and replacing software timers with hardware timers for improved timing accuracy. Peripheral drivers such as BMP280, AHT2x, DS1820, DHT11/22, PWM, UART, and NTP were tested with varying success; some required specific pin assignments or additional delays to prevent crashes. Deep sleep support was added without GPIO wakeup. The firmware uses the Espressif ESP-IDF SDK for ESP32 and plans for ESP8266 porting were discussed, noting SDK differences and RAM constraints. Continuous integration (CI) and online build availability were confirmed. Users shared flashing tools, partition table considerations, and debugging tips including esptool flash_id and efuse burning. The community actively tested and reported logs, crashes, and feature functionality, contributing to iterative fixes and enhancements.
Generated by the language model.

FAQ

TL;DR: 4MB stało się domyślną bazą dla OpenESP32, a autor poprawki napisał: "Now configured with 4MB by default". Ten FAQ jest dla osób uruchamiających OpenBeken na ESP32 i wyjaśnia, jak dobrać build, rozwiązać błędy partycji, bootloadera, OTA, UART i Wi‑Fi na C2, C3, S2, S3 oraz klasycznym ESP32. [#21220790]

Dlaczego to ważne: Błędny rozmiar flash, zły offset bootloadera albo niewłaściwy typ obrazu potrafią dać „invalid header”, bootloop albo bezpieczny tryb AP mimo sprawnego sprzętu.

Wariant Typowy flash z wątku Co działało najlepiej Najczęstszy problem
ESP32-C3 4MB Wi‑Fi, OTA, PWM, czujniki I2C SuperMini miewa problemy z Wi‑Fi i DHCP
Klasyczny ESP32 4MB, czasem wykrywany jako 2MB GPIO, OTA, Wi‑Fi po poprawnym flashu błędy tabeli partycji i safe mode po reboocie
ESP32-S2/S3 4MB lub 16MB DS1820, GPIO, AP/STA po poprawkach stack overflow, problemy z temperaturą wewnętrzną
ESP32-C2 4MB podstawowe funkcje, PWM mało RAM, czułość na taktowanie i baud
ESP8266 1MB, 4MB, 8MB po swapie eksperymenty po rozdzieleniu wątku zbyt mały flash dla dual-OTA przy 8Mbit

Najważniejszy wniosek: Na ESP32 najpierw dobierz właściwy obraz do realnego flashu i układu, a dopiero potem diagnozuj skrypty, UART lub Wi‑Fi. W wątku większość „magicznych” awarii okazała się skutkiem złego rozmiaru flash, złego offsetu bootloadera albo użycia factory.bin zamiast .img. [#21221363]

Quick Facts

  • Domyślna konfiguracja ESP32 została przestawiona na 4MB flash, bo brakowało sdkconfig.defaults.esp32; to była kluczowa poprawka startowa całego portu. [#21220790]
  • Na ESP32-C3 poprawny boot pokazał partycje app0 0x10000, app1 0x100000 i LFS 0x1EF000, przy wykrytym flashu 4MB oraz SPI 80MHz/DIO. [#21221080]
  • Jeden z modułów ESP32-C5 pobierał przy starcie AP około 1,4 W / 0,3 A przy 5 V, czyli w przybliżeniu 0,5 A przy 3,3 V; to tłumaczy brownouty przy słabym zasilaniu. [#21648381]
  • Dla problematycznych płytek ESP32-C3 SuperMini obniżenie mocy Wi‑Fi do 10 dBm, a nawet 6 dBm, poprawiało łączenie z DHCP. [#21450268]
  • W sterowniku BP5758D padały konkretne prądy robocze: domyślnie 14 mA, w ESPHome 10 mA, a w praktyce dla GU10 sprawdzało się nawet 8 mA na kanałach. [#21246766]

How do I configure OpenBeken on ESP32 to use 4MB flash by default with sdkconfig.defaults.esp32?

Dodaj brakujący plik sdkconfig.defaults.esp32 i ustaw w nim wariant 4MB jako domyślny dla ESP32. To właśnie ta zmiana odblokowała poprawny start portu i autor podsumował ją krótko: „Now configured with 4MB by default”. Jeśli tworzysz także obraz scalony, dopasuj --flash_size 4MB, bo samo SDK nie naprawi błędnego merge bin. [#21220790]

Why does OpenESP32 factory.bin fail to boot with partition table errors on some ESP32 boards that actually have 4MB flash?

Najczęściej dlatego, że obraz factory.bin został zmergowany z nagłówkiem 2MB, mimo że płytka ma fizycznie 4MB. W logu widać wtedy SPI Flash Size : 2MB, a zaraz potem błąd typu partition ... exceeds flash chip size 0x200000. W wątku poprawka polegała na zmianie polecenia esptool.py merge_bin z --flash_size 2MB na --flash_size 4MB, bez zmiany samej płyty. [#21221363]

What is the difference between OpenBeken factory.bin and non-factory .img builds on ESP32, and when should each one be flashed?

factory.bin to obraz scalony z bootloaderem, tabelą partycji i aplikacją, a .img to zwykle sam obraz aplikacji do istniejącego układu partycji. Gdy układ startuje od zera, po erase_flash, albo masz uszkodzone partycje, użyj factory.bin. Gdy bootloader i partycje już są poprawne, często bezpieczniej użyć .img; w wątku klasyczny ESP32 ruszył po przejściu z factory na non-factory. [#21221359]

How can I erase_flash and reflash OpenBeken correctly on ESP32, ESP32-C3, and ESP32-S2 boards when GPIOs or boot behavior seem broken?

Najbezpieczniej wykonaj pełne czyszczenie i dopiero potem ponowny flash. 1. Uruchom erase_flash, aby usunąć stare partycje, konfigurację i błędne autostarty. 2. Wgraj właściwy obraz dla układu i realnego flashu: factory.bin przy czystym starcie albo .img przy istniejących partycjach. 3. Na S2 wejdź w boot przez przyciski RST i 0, a potem sprawdź log i AP przed testem GPIO. Ten schemat przywrócił poprawne działanie LED-ów i factory.bin na kilku płytkach. [#21221622]

Why did the ESP32-C3 merge initially fail with invalid header errors, and how does the bootloader offset at 0x0 vs 0x1000 affect flashing?

Bo przy merge dla C3 bootloader trafił pod zły adres. Autor poprawki napisał wprost, że „bootloader must be at 0x0, instead of 0x1000”, a wcześniejszy układ dawał serię invalid header. Na ESP32-C3 boot ROM oczekiwał bootloadera od 0x0, więc obraz z offsetem 0x1000 wyglądał jak uszkodzony mimo poprawnego flashowania. [#21221037]

What causes OpenBeken script timing to run too slowly on ESP32, and how do QUICK_TMR_DURATION, vTaskDelay, and esp_timer_get_time relate to the fix?

Problem wynikał z błędnego liczenia g_deltaTimeMS i z niepoprawnego użycia opóźnienia FreeRTOS. Poprawa miała dwa elementy: dla ESP-IDF czas zaczęto brać z esp_timer_get_time()/1000, a w wątku timera zmieniono vTaskDelay(QUICK_TMR_DURATION) na vTaskDelay(QUICK_TMR_DURATION / portTICK_RATE_MS). To ograniczyło dryf, który wcześniej dawał wynik około MAIN:Time 150 przy kanale zwiększonym tylko do 121. [#21221114]

How do flash encryption flags and eFuse settings on an ESP32-C3 device affect whether OpenBeken can boot after flashing?

Włączone szyfrowanie flash może zablokować start zwykłego obrazu, nawet gdy sprzęt ma poprawne 4MB i sam flash zapisze się bez błędów. W wątku jeden ESP32-C3 miał Flash Encryption: Enabled i nie startował jak zwykła płytka deweloperska. Po zmianie eFuse tak, by raport pokazywał Flash Encryption: Disabled oraz SPI_BOOT_CRYPT_CNT: 0x3, urządzenie zaczęło bootować OpenBeken poprawnie. [#21221080]

What is LittleFS or LFS in OpenBeken, and why do ESP logs sometimes say 'lfs is absent' even when scripts appear to work later?

„LittleFS” jest lekkim systemem plików flash, który przechowuje skrypty, pliki startowe i inne dane trwałe, a jego kluczową cechą jest praca na wydzielonej partycji flash zamiast w RAM. Log lfs is absent oznacza zwykle brak zamontowanej partycji LFS lub jeszcze nieutworzony system plików. W wątku ten komunikat pojawiał się przy starcie, ale później testy pokazały, że skrypty i zapis zaczęły działać po dalszych poprawkach partycji i flashowania. [#21221088]

What is TCA9554, and why is that I2C expander needed to run OpenESP32 on boards like the Waveshare ESP32-S3-ETH-8DI-8RO?

„TCA9554” jest ekspanderem I2C, który dodaje 8 linii wejścia/wyjścia GPIO, a jego główną cechą jest sterowanie dodatkowymi sygnałami przez magistralę I2C zamiast bezpośrednio z MCU. Na płytce Waveshare ESP32-S3-ETH-8DI-8RO ten układ steruje sekcją przekaźników, więc bez jego obsługi OpenESP32 nie potrafi przełączać wyjść. Dlatego w wątku wskazano, że TCA9554 jest wymagany, aby ta płyta miała sensowną obsługę pod OpenESP32. [#21640201]

ESP32-C2 vs ESP32-C3 vs classic ESP32 vs ESP32-S3 for OpenBeken — which one is currently the better choice for stability, Wi-Fi, sensors, and OTA?

Najbezpieczniejszym wyborem z wątku jest ESP32-C3 albo poprawnie zasilony ESP32-S3. C3 miał działające Wi‑Fi, OTA, PWM i czujniki I2C, choć wersje SuperMini wymagały czasem obniżenia mocy TX. Klasyczny ESP32 działał, ale częściej wpadał w safe mode, miał problemy z restartem i błędami partycji. C2 działał, lecz był bardziej ograniczony RAM-em; autor napisał wprost, że „ESP32-C2 is already struggling”. [#21223468]

How can I diagnose ESP32 reboot loops, WDT safe mode, or stack overflow crashes in OpenBeken after restart, OTA, NTP start, or saving pins?

Najpierw patrz na dokładny powód resetu i nazwę zadania z logu. Jeśli widzisz TG0WDT_SYS_RESET lub TG1WDT_SYS_RESET, szukaj blokującego kodu, a nie problemu RTC WDT. Jeśli log mówi o stack overflow w sys_evt, quick albo IntTemp, zwiększ stack albo znajdź pętlę rekurencyjną. W wątku restart rozbijał się o nieskończoną pętlę: WIFI_STA_DISCONNECTED wywoływało HAL_DisconnectFromWifi, które generowało ten sam event ponownie. [#21224554]

What is the best way to test UART on OpenESP32 with TuyaMCU, and why can UART receive still behave inconsistently even when transmit works?

Najlepiej testować UART na prawdziwym urządzeniu z TuyaMCU i osobno sprawdzić TX oraz RX. Autor portu podał, że nadawanie działało, ale odbiór wymagał obejścia: po UART_AppendByteToReceiveRingBuffer dodał vTaskDelay(3), aby uniknąć crasha. To stabilizowało pracę, ale przy większym strumieniu danych nadal mogło przepełnić bufor, wywołać flush wejścia i reset kolejki. [#21222660]

How do I reduce Wi-Fi issues on ESP32-C3 SuperMini boards in OpenBeken, including slow DHCP or failed connections, with commands like powersave 1 10?

Obniż moc nadawania i nie zakładaj, że domyślne 20 dBm będzie stabilne. Dla ESP32-C3 SuperMini w wątku zalecono powersave 1 10, gdzie 10 oznacza 10 dBm, a w jednym przypadku urządzenie połączyło się dopiero przy 6 dBm. To pomogło przy wolnym DHCP, braku adresu IP i niestabilnych połączeniach, typowych właśnie dla SuperMini. [#21450298]

Can I upgrade an ESP8266 or ESP-01 flash chip from 1MB to 4MB or 8MB for OpenBeken, and what should I verify with esptool afterward?

Tak, taka podmiana została potwierdzona praktycznie. W wątku wymieniono flash w ESP-01 z 1MB na 4MB, a później także na 8MB w innym module, po czym esptool flash_id poprawnie raportował nowy rozmiar pamięci. Po wymianie zawsze sprawdź producenta układu, kod urządzenia i Detected flash size, bo to jedyny szybki sposób potwierdzenia, że lutowanie i konfiguracja SPI są poprawne. [#21238166]

How can I create a global float variable or pulse counter in OpenBeken on ESP32-C3 for water meters when each pulse represents 10 liters?

W pokazanym fragmencie wątku nie ma gotowej, potwierdzonej implementacji globalnego floata ani licznika impulsów dla 10 litrów na impuls. Jest tylko pytanie użytkownika o taki licznik po uruchomieniu logiki addChangeHandler, bez dalszej odpowiedzi z działającym rozwiązaniem. Jeśli chcesz pozostać zgodny z tym wątkiem, jedyną potwierdzoną ścieżką jest dalszy eksperyment ze skryptami lub Berry, ale bez gotowej recepty opisanej w podanych postach. [#21798097]
Generated by the language model.
ADVERTISEMENT