logo elektroda
logo elektroda
X
logo elektroda

Flashing OpenBeken/OBK firmware to ESP8266/ESP8285 devices

divadiow 822 38
ADVERTISEMENT
  • ADVERTISEMENT
  • Helpful post
    #2 21595406
    p.kaczmarek2
    Moderator Smart Home
    That's great news, can we now make a DIY ESP8266 board with 8MB flash chip, etc?
    Helpful post? Buy me a coffee.
  • Helpful post
    #3 21595791
    DeDaMrAz
    Level 20  
    Amazing news!!

    Flashing OpenBeken/OBK firmware to ESP8266/ESP8285 devices
    Flashing went smooth, confirmed WiFI is not resetting after connecting to network, after manual reset all good, GPIO2 works 🙂

    Info:MAIN:Time 4156, idle 0/s, free 32560, MQTT 0(260), bWifi 1, secondsWithNoPing 4090, socks 0/0 
    Info:MAIN:Time 4157, idle 0/s, free 32560, MQTT 0(260), bWifi 1, secondsWithNoPing 4091, socks 0/0 
    Info:MAIN:Time 4158, idle 0/s, free 32560, MQTT 0(260), bWifi 1, secondsWithNoPing 4092, socks 0/0 
    Info:MAIN:Time 4159, idle 0/s, free 30648, MQTT 0(260), bWifi 1, secondsWithNoPing 4093, socks 0/0 



    Will test more but super cool!!
  • ADVERTISEMENT
  • #4 21596138
    insmod
    Level 24  
    Added PWM and UART, fixed Wifi first connect and reconnect.

    UART RX had to be done very primitively, this in a task:
    while(1)
    {
       int len = uart_read_bytes(uartnum, data, 512, 20 / portTICK_RATE_MS);
       if(len)
       {
          for(int i = 0; i < len; i++)
          {
             UART_AppendByteToReceiveRingBuffer(data[i]);
          }
       }
    }


    Looks like it works even on ESP32, even if i'm sure i've tried that before and it didn't work.
    I also tried via interrupt, and it works too, until received data is too big - it crashed.
    Removed ESP-specific timer for QuickTick, moved to task. And i had to increase stack size for it, since without it it crashed immediately.

    Didn't fix OTA (and i have no idea why it doesn't work, since image check passes).
    Disabled PWM for GPIO0, it bootloops with it enabled. Worked fine if enabled manually.
  • ADVERTISEMENT
  • #5 21596140
    DeDaMrAz
    Level 20  
    >>21596138

    WiFi is fixed, confirmed.

    PWM is Inverted, but working. PWM_n works as expected (also inverted)

    Smooth transition also works, flag 18

    Can't check UART now.


    Flashing OpenBeken/OBK firmware to ESP8266/ESP8285 devices

    [00:43:42]Info:MAIN:Time 411, idle 0/s, free 27140, MQTT 0(26), bWifi 1, secondsWithNoPing 344, socks 0/0 
    [00:43:43]Info:MAIN:Time 412, idle 0/s, free 27140, MQTT 0(26), bWifi 1, secondsWithNoPing 345, socks 0/0 
  • #6 21596199
    divadiow
    Level 34  
    >>21595406
    :)
    https://www.elektroda.com/rtvforum/topic4074860-90.html#21238166

    Added after 1 [hours] 5 [minutes]:

    1707_merge_874bdb527589
    2mb version flash and initial boot of that 8mb ESP-01S:

    Code: Text
    Log in, to see the code


    OTA attempt - fatal exception on reboot
    Code: Text
    Log in, to see the code


    Added after 4 [minutes]:

    same OTA experience on 4mb board

    Added after 16 [minutes]:

    insmod wrote:
    Didn't fix OTA (and i have no idea why it doesn't


    Lol. Misread this. Oh well

    Added after 15 [minutes]:

    curious about something I've just read. Does OTA do the same on a real 2mb flash ESP8266? I only have 4mb+
  • Helpful post
    #7 21596825
    insmod
    Level 24  
    Fixed OTA, problem was partition layout. Apparently ESP8266 had a problem with offsets.
    Need 1MB flash test.

    A question: What platforms need PWM duty update every 25ms? I had to hack ESP8266 and ESP-IDF pwm code so that it would update duty only once. Otherwise it spams the console.
  • #8 21596877
    DeDaMrAz
    Level 20  
    insmod wrote:
    What platforms need PWM duty update every 25ms? I had to hack ESP8266 and ESP-IDF pwm code so that it would update duty only once. Otherwise it spams the console.


    That may be a remnant of the IR testing way back on Beken N.

    Added after 1 [hours] 46 [minutes]:

    insmod wrote:
    Fixed OTA



    Confirmed! Pin setup is retained will check more later.
  • #9 21596997
    p.kaczmarek2
    Moderator Smart Home
    Nice progress! I think we can move PWM update to be done only on change.
    Helpful post? Buy me a coffee.
  • Helpful post
    #10 21597042
    insmod
    Level 24  
    Merge-ready, i believe.
    Added powersave (enabled by default from SDK)
    Added deepsleep with timer (it shuts down, but doesn't wake up for me)
    Fixed 1M build.

    No gpio deep sleep on SDK side.
  • #11 21597058
    p.kaczmarek2
    Moderator Smart Home
    Does it support OTA from Tasmota? Or not, due to partitions difference?

    I we wanted to run it with 8MB flash, we need to partition table, like platforms/ESP8266/partitions-2mb.csv ?
    Helpful post? Buy me a coffee.
  • #12 21597059
    DeDaMrAz
    Level 20  
    I wanted to ask that question as well. After digging through my pile of module I have all sorts of chip sizes and of course various flash chips as well that I can add.
  • #14 21597072
    DeDaMrAz
    Level 20  
    insmod wrote:
    What to do with 8mb flash? Max firmware size, from what i remember, is 1MB. 6mb LFS?



    WebApp on a device or something of that nature for example.
  • #15 21597082
    insmod
    Level 24  
    Well, web app needs about 300kb for a full dist (287278 bytes in my example, after i cut startup.js a little to remove all folders, as i'm not sure if they work in OBK).
    That means that it could be loaded on all bekens, LN882H, RTL8710A, 8mb or more RTL8720D, barely on BL602 (with new partitions, on old it fits fine) and almost on RTL8710B (it has only 274432b).
    I tried it in my WBRG1 and it works.

    Of course if it was minified, it would probably fit on every device (at least minus ~11kb just by minifying templateParser.js and httpVueLoader.js).
  • #16 21597084
    DeDaMrAz
    Level 20  
    Idea is to expand it with more features so space is always welcome ( like GPIO doctor for example) webapp is somewhat neglected for some time now.

    On the other hand that WBRG1 has BT and as mentioned before BTHome would be a massive plus for that gateway, and BT in general is a better feature than webapp across devices in my opinion.

    Data logging is another feature that was talked about.

    Another opinion of mine is that we have reached a super wide coverage of devices and we should maybe focus on polishing UI and UX across the board. New features, drivers etc per request and finally doing per device build. I am making a small cluster that possibly can be used for testing that so after deployment we can expand on that topic if it is of interest of course.

    Again just my opinions.
  • ADVERTISEMENT
  • #17 21597086
    insmod
    Level 24  
    Completely minified web app weigh 195261 bytes. Older vue.min.js allows for additional ~7-8kb size reduction.
    On what it wouldn't fit: ECR6600, ESP8266, 2mb ESP-IDF, all XRs, RTL8710C, W800, W600
    Flashing OpenBeken/OBK firmware to ESP8266/ESP8285 devices

    I like UI as it is now, minimalistic and fairly easy to understand.
    I plan to experiment with BT after i port RTL87xxDA (AmebaDplus, Tuya WR11-series, I shelved OPL1000 for now).
    Or perhaps after i try to create easyflash config generation on windows.
  • #18 21597087
    DeDaMrAz
    Level 20  
    Nice on the "minification"!

    It's not that I don't like the UI but if you browse issues or PR's for a bit you'll find so many similar questions regarding UI, webapp, overall UX that is not that welcoming to new users. For example we got some legacy stuff still lingering on the home page, this comes to mind

    (Cfg size: 3584, change counter: 6, ota counter: 1, incomplete boots: 1 (might change to 0 if you wait to 30 sec)!


    Not to mention flags... which I personally like but for new users they are confusing AF.

    This project is dependent in a way from new users so we might as well pay more attention to them and got some of those "complaints" resolved.

    AmebaDplus can be a nice addition but I was ready to bet money that OPL was next 😁

    I must stress again, I am just thinking out a loud!

    P.S. thank you for suggesting another device to look for 😁also to suggest this board as it should be pin compatible with Dplus - https://www.aliexpress.com/item/1005007255730323.html?
  • #19 21597090
    insmod
    Level 24  
    >>21597087
    This board uses T2-U, which is just CBU with a different name (T2 is Tuya-flavored BK7231N).
    Didn't you already have a BW20 module? It is RTL8711DAF (Dplus).
    After Dplus, i'll probably port RTL8720E (AmebaLite), since it uses the same SDK.
    RTL8720ECF: https://aliexpress.com/item/1005007814225820.html

    Additional challenge for me - to port without modifying anything in SDK, like i've done ESP-IDF.
  • #20 21597094
    DeDaMrAz
    Level 20  
    At this point I have no idea what I have in the box of modules, yesterday I found a W600 module that I forgot I ever ordered, so... maybe 😁

    But as every good alpha tester I'll order some more of course 🙂 pair of each because science!

    What stalled on OPL? I've seen some sonoff devices in the wild using it
  • #21 21597095
    insmod
    Level 24  
    >>21597094
    The lack of AP mode.
    You did have BW20, i remember you posted an ali order screenshot with it.
  • #22 21597097
    DeDaMrAz
    Level 20  
    insmod wrote:
    You did have BW20, i remember you posted an ali order screenshot with it.


    You made me look!! And yes, you are 100% right, I have them all... even some exotic ones..

    Flashing OpenBeken/OBK firmware to ESP8266/ESP8285 devices
  • #24 21597099
    DeDaMrAz
    Level 20  
    Yeap, all of them...

    Remember I was absent for more than 6 months... because life, and work, and shit... completely forgot about it all. I've been playing catchup for last couple of days, maybe weeks - not even close to get the hang of things....

    Thank you for the reminder!
  • #25 21597261
    divadiow
    Level 34  
    insmod wrote:
    There is a possibility to OTA from Tasmota, but firmware must be built manually with this guide


    tried anyway to see what it would do. same with Tasmota and Tasmota-4M

    Code: Text
    Log in, to see the code


    Flashing OpenBeken/OBK firmware to ESP8266/ESP8285 devices

    Added after 8 [minutes]:

    cool. OTA log

    Code: Text
    Log in, to see the code
  • #26 21597272
    p.kaczmarek2
    Moderator Smart Home
    I like current UI as well. Maybe we could try to flash WebApp automatically with BK7231 Easy UART Flasher, but auto-download button/mechanism seems easier.

    We may also consider adding this change to all platforms:
    Flashing OpenBeken/OBK firmware to ESP8266/ESP8285 devices
    This seems to make LFS faster with no real drawbacks at all
    Helpful post? Buy me a coffee.
  • #27 21597496
    DeDaMrAz
    Level 20  
    I think I was misunderstood about the IU - I like it as well and don't want to change it in general just to touch upon it and remove some legacy stuff for example and provide some new information on there.
    My idea originated from tasmota and how it handles internal chip temperature - with a setoption146 "flag"/command. Maybe it can be done in OBK in a similar fashion, as I remember there are some chips that don't have internal temp probe, so we can move those "new" features" to a flag for example.
    Again to ping @max4elektroda whose idea on that topic I liked (not tested by me).

    And on the polishing UI I was talking mostly about some features that I personally find annoying and answering the same questions from time to time - for example

    "why does it take two back click to go back from config to home page??"


    Or

    "does flag 37 actually work??"


    Those kind of things can (I think) improve on UX just by little tweaks on the UI. I think I am capable of testing almost anything in OBK at this point and I volunteer to test and verify whatever need be.
  • Helpful post
    #28 21597649
    insmod
    Level 24  
    And another idea for device-hosted web app:
    If we could somehow enable Content-Encoding gzip specifically for web app page/scripts, then they could be stored precompressed.
  • Helpful post
    #29 21597659
    DeDaMrAz
    Level 20  
    >>21597649

    Imagine a webapp running on that little gateway (8Mb of space) as well + zigbee + BTHome... how nice would that be??
  • #30 21597813
    p.kaczmarek2
    Moderator Smart Home
    Gzip may be a good idea. The header is not compressed, and it still plain text, it looks like somewhat like that:
    
    HTTP/1.1 200 OK
    Content-Type: text/html
    Content-Encoding: gzip
    Content-Length: 1234
    
    

    Then compressed payload follows.

    Maybe we could add some kind of internal mechanism to LFS access, for example, when MyScript.vue is requested, LFS checks first for MyScript.vue.gzip and if present, returns it as a compressed stream, otherwise fallbacks to default behaviour.

    We would just need an "Upload GZIpped" button on LFS page.

    Added after 1 [minutes]:

    PS: Here is a little LFS profiller, I will add it to web app soon:
    Code: HTML, XML
    Log in, to see the code


    Flashing OpenBeken/OBK firmware to ESP8266/ESP8285 devices
    Helpful post? Buy me a coffee.

Topic summary

The discussion centers on flashing a 2MB OpenBeken/OBK firmware onto a 4MB ESP8266 board. Initial boot logs confirm successful recognition of the 4MB flash size with a detailed partition table including OTA data, WiFi NVS, two OTA app partitions, and an LFS partition. Users report smooth flashing and stable WiFi connectivity without resets after manual reboot. GPIO2 functionality is confirmed. Subsequent updates include added PWM and UART support, with UART implemented via a task-based polling method to avoid crashes seen with interrupt-driven approaches. PWM operates inverted but functional, with PWM_n also working as expected. OTA updates remain non-functional despite passing image checks. Adjustments to QuickTick timer handling and stack size were necessary to prevent crashes. Disabling PWM on GPIO0 resolved bootloop issues. Overall, the firmware demonstrates improved hardware compatibility and peripheral support on the 4MB ESP8266 platform.
Summary generated by the language model.
ADVERTISEMENT