logo elektroda
logo elektroda
X
logo elektroda

Cozylife DS-1211AN 3Gang Touch Switch: 1MB BL602L10 [XT-BL12][DT-BL12] - Images, Firmware & Boot

divadiow 2835 92
ADVERTISEMENT
  • Helpful post
    #1 21301826
    divadiow
    Level 34  
    This is the Cozylife DS-1211AN 3-gang touch wall switch. The sticker on the box states it was manufactured by Shenzhen Dianling Intelligent Technology Co Ltd.

    Unfortunately it comes with a 1mb BL602 so is not an easy candidate for freeing from Cozylife cloud services as OpenBeken does not work on 1mb BL602s. It's a standard-sized 12S type module that could be replaced with an ESP-12S.

    The module is labelled as a Cozylife-3 XT-BL12 and DT-BL12, but unlike the DT-BL12 here https://cozylife.app/product/zh/hardware/wifi/dt-bl12.html the GPIOs/pads are as below
    Diagram of the XT-BL12 module with pins and a PCB antenna.

    Here's a load of pics.
    Screenshot of Bouffalo Lab Dev Cube version 1.9.0 showing an interface for reading and writing flash memory. Circuit board with electronic components. Circuit board with three white buttons of the Cozylife DS-1211AN touch switch. PCB with electronic components and a connector on a carpet. Cozylife DS-1211AN circuit board on a woolen carpet. Interior of a plastic casing of a 3-gang touch wall switch Cozylife DS-1211AN with a visible green circuit board. Partial view of the Cozylife DS-1211AN 3-gang touch wall switch with open casing. A Cozylife DS-1211AN three-key touch wall switch lying on a beige carpet next to a user manual. 3-pole touch wall switch Cozylife DS-1211AN and its packaging. Back of the Cozylife DS-1211AN 3-gang wall switch with specification details. Box, switch, and user manual for the Cozylife DS-1211AN touch wall switch. DT-BL12 module with short-range contacts on a wooden background. Cozylife DT-BL12 module with visible pins on a wooden surface. View of DT-BL12 module on a wooden surface showing pins. Wi-Fi XT-BL12 module lying on a wooden surface. XT-BL12 Cozylife-3 module with Wi-Fi and Bluetooth markings. Cozylife XT-BL12 Wi-Fi module on a wooden background. Close-up of a circuit board in a Cozylife DS-1211AN three-way wall switch. Interior of the Cozylife DS-1211AN 3-gang touch wall switch showing the circuit board and components. Electronic circuit board inside the Cozylife DS-1211AN wall switch with visible modules and connectors. Close-up of a circuit board with visible traces, resistors, and a connector. Close-up of a circuit board from the Cozylife wall switch with a visible WiFi module labeled XT-BL12. Printed circuit board with Cozylife-3 XT-BL12 module. Close-up of a circuit board with a Cozylife XT-BL12 Wi-Fi module.

    UART boot log
    Code: Text
    Log in, to see the code


    and firmware backup attached
  • ADVERTISEMENT
  • Helpful post
    #2 21301840
    insmod
    Level 24  
    >>21301826 Is GPIO17 used for anything? If so, then transplantation to ESP-12 would require to solder additional resistor to IO0-3V3 (about 1K), otherwise it may not boot.
    On this switch, when i replaced the stock BL602 module with an ESP one, GPIO0 low at boot prevented it from working.
  • ADVERTISEMENT
  • #3 21302067
    divadiow
    Level 34  
    good point. module swap is conditional.

    GPIO17 traces to:

    Electronic board with visible pin connections and GPIO17 marking.

    Portion of a circuit board with labels LED12 and GPIO17
  • ADVERTISEMENT
  • #4 21303882
    divadiow
    Level 34  
    module has a new home. ready for some unknown adventure
    Wi-Fi module mounted on a breadboard. Electronic module with various pins placed on a breadboard.
  • #6 21381948
    divadiow
    Level 34  
    The bell at the bottom of the thread can be used to watch a topic :)
  • #7 21381958
    vinibali
    Level 6  
    >>21381948 the post might cause more attention, I'm also happy to help the development here if I could :)
  • #8 21381962
    divadiow
    Level 34  
    Cool 😎

    Added after 2 [minutes]:

    This was the latest on the issue. I have not tried to disable LFS yet but I did try really old BL602 builds before LFS was implemented. That was with old SDK though

    https://www.elektroda.com/rtvforum/topic4024917-60.html#21372625

    Added after 3 [minutes]:

    I was looking into it more - perhaps this in here /components/bl602/bl602/evb/ld/flash.ld

    but if it is that then it means we've been building fw for 4mb flash to date (?)

    Code: Text
    Log in, to see the code


    @miegapele
  • #9 21384022
    miegapele
    Level 15  
    that's memory layout in application, not flash layout. It's most likely the same regardless how much flash you have. I would look into partition layout files (toml) and check what we use. Also now I think about it bootloader might be different too maybe?
  • #10 21384041
    divadiow
    Level 34  
    I've been trying the 1mb toml. I'll transplant BL from 1mb device and test
  • #11 21384047
    miegapele
    Level 15  
    There is partitions missing in there I believe. You will need to modify it to have all the required partitions or do not use the partitions which don't exists on 1mb layout in the application.
  • #12 21427362
    p.kaczmarek2
    Moderator Smart Home
    Hey guys, any hope for running BL602 OBK port on this chip? We've got the same switch on polish elektroda side, this topic:
    https://www.elektroda.pl/rtvforum/topic4103835.html#21427337
    I can help by making PR and reducing build size with obk_config.h , but I don't have XT-BL12 on my site for testing.

    Latest OBK version have even options (defines) to disable stuff like config HTML pages, so maybe we could reduce size a lot futher...
    Helpful post? Buy me a coffee.
  • #13 21427375
    divadiow
    Level 34  
    miegapele wrote:
    There is partitions missing in there I believe. You will need to modify it to have all the required partitions or do not use the partitions which don't exists on 1mb layout in the application.


    how do we turn off OpenBL602 knowing about the OTA partition/expecting one to exist?

    I've already tried pre-LFS OpenBL602 to 1mb chip in case it was LFS to blame

    old and new builds and even the latest SDK PR flash fine but always fail at the same point in boot

    Added after 6 [minutes]:

    I've transplanted the BL from a 1mb Tuya device into a dump of an OBKd BL602 dump but this made no difference. From what I was reading on Lupyuen, the BL is constructed at build from the toml file anyway, so the BL was already being created ready for 1mb device.

    Added after 3 [minutes]:

    by coincidence someone responded to my old post about this this morning https://bbs.bouffalolab.com/d/316-adjusting-2mb-bl602-code-for-1mb-bl602l10-buildflash/2

    Added after 23 [minutes]:

    Quote:
    Personally, I'd stick a JTAG probe on it and just debug the code. You should be able to single step it almost right from reset. Just knowing this type of problem, there's probably a flash for filesystems or partition tables or overriding code or stack or something Very Important.


    Maybe I need to work out how to debug and do this
  • #14 21431285
    miegapele
    Level 15  
    >>21427362
    Which flasher version and which toml file are you using for the module? I don't think size in itself is an issue. It should fit, absence of separate upgrade partition might be issue. Maybe there is different boot loader for that?
  • #15 21431287
    divadiow
    Level 34  
    1.4.8 and latest - 1.9.0 - both with 1mb ota and no-ota toml
  • #16 21431343
    miegapele
    Level 15  
    >>21431287
    I do not see that toml for 1.4.8, there is only one with 2mb. 1.9.0 works with standard module and 1mb toml, so additional partitions are not used it seems.
    Do you get any boot log?
  • #18 21431575
    miegapele
    Level 15  
    So it seems to crash during EasyFlash init which is somewhat expected, given there is less flash. Normally logs continue with
    
    EasyFlash V4.0.99 is initialize success.
    

    But this easyflash init is somewhat suspect:
    [EF] Found Valid PSM partition, XIP Addr 230e8000, flash addr 000f9000
    *default_env_size = 0x00000001
    ENV start address is 0x00000000, size is 32768 bytes.

    PSM partition is not at zero, but at 000f9000 and size is not 32768, but only 8096 bytes. This looks strange. Although same logs work with 2mb flash...
  • #19 21431866
    p.kaczmarek2
    Moderator Smart Home
    maybe let's comment out easyflash and give it a try? I should boot into AP mode with default obk config.
    Helpful post? Buy me a coffee.
  • #20 21432034
    miegapele
    Level 15  
    >>21431575
    Seems like 32k might be needed.
    Could you try this toml file, before we try code changes?
    [pt_table]
    #partition table is 4K in size
    address0 = 0xE000
    address1 = 0xF000
    
    [[pt_entry]]
    type = 0
    name = "FW"
    device = 0
    address0 = 0x010000
    size0 = 0xD7000
    address1 = 0x000
    size1 = 0x000
    # compressed image must set len,normal image can left it to 0
    len = 0
    
    [[pt_entry]]
    type = 3
    name = "media"
    device = 0
    address0 = 0x0E7000
    size0 = 0x2000
    address1 = 0
    size1 = 0
    # compressed image must set len,normal image can left it to 0
    len = 0
    
    [[pt_entry]]
    type = 4
    name = "PSM"
    device = 0
    address0 = 0x0E9000
    size0 = 0x8000
    address1 = 0
    size1 = 0
    # compressed image must set len,normal image can left it to 0
    len = 0
    
    [[pt_entry]]
    type = 7
    name = "factory"
    device = 0
    address0 = 0x0F1000
    size0 = 0x7000
    address1 = 0
    size1 = 0
    # compressed image must set len,normal image can left it to 0
    len = 0
    
    #if user want to put RF calibration data on flash, uncomment following pt entry
    #[[pt_entry]]
    #type = 8
    #name = "rf_para"
    #device = 0
    #address0 = 0x1FF000
    #size0 = 0x1000
    #address1 = 0
    #size1 = 0
    ## compressed image must set len,normal image can left it to 0
    #len = 0
    
  • #21 21432090
    divadiow
    Level 34  
    :(
    Bouffalo Lab Dev Cube software interface with a configuration file edited in Notepad.

    Added after 4 [minutes]:

    erased whole flash. changed to GA build and did again. loops
    Screenshot of debugging messages related to flash memory configuration.
  • #23 21434004
    divadiow
    Level 34  
    gets further (pic animated)
    Bouffalo Lab Dev Cube software interface with various firmware options and configurations.

    Code: Text
    Log in, to see the code
  • #24 21434046
    miegapele
    Level 15  
    So it's boot looping and not freezing? Then that feels like power problem... How are you powering this?
    The same might be with standard build, it tries to erase some flash and that also requires power.
  • ADVERTISEMENT
  • #25 21434069
    divadiow
    Level 34  
    oh wow. I thought it was power too but this PSU is usually fine with BL602 - even at 3.5v it was looping. Made VCC even shorter and now it's OK. 🙄
    Power supply module and prototyping board on a wooden table.

    :D

    Control panel for the OpenBL602_57827302 device with options for configuration, restart, and web application launch.

    Added after 2 [minutes]:

    full successful boot
    Code: Text
    Log in, to see the code
  • #26 21434075
    miegapele
    Level 15  
    Good!. I think normal firmware will work too. You might need to use toml I provided though, not sure. BL602 is rated up to 3.6V, so should be no issue with that.
  • #27 21434078
    divadiow
    Level 34  
    also, is this an opportunity to switch to new SDK for 1mb OBK releases?

    Added after 16 [minutes]:

    would you like me to flash with any other toml now?

    These BL602s are SO fussy. it started looping again and always at wifi AP join. Made VCC cable even shorter at 3.55v and now OK again.
    Electronic display and module with wires on a wooden surface.
  • #28 21434116
    miegapele
    Level 15  
    I see some capacitors on the main board. Might be not enough decoupling on bare board.

    I think you should try standard build, maybe with my toml, that 8kb PSM partition feels wrong in the other toml.
  • #29 21434122
    divadiow
    Level 34  
    maybe time to get a decent bench PSU.

    Added after 21 [minutes]:

    Quote:
    I see some capacitors on the main board. Might be not enough decoupling on bare board.

    (forgive the side-bar on the power issue)
    bare board being the module breakout? XL4015 looks OK?

    Electronic module with components, including XL4015. Electronic components on a wooden table: PCB board and WiFi module.

Topic summary

The discussion revolves around the Cozylife DS-1211AN 3-gang touch wall switch, which utilizes a 1MB BL602 chip, making it challenging to free from Cozylife's cloud services. Users explore the possibility of replacing the BL602 with an ESP-12S module, discussing GPIO configurations and the need for additional resistors for proper booting. Several users share their experiences with firmware modifications, including attempts to disable EasyFlash and adjust partition tables to accommodate the 1MB flash size. The conversation highlights issues with power supply stability, boot loops, and the need for specific configurations in the toml files to achieve successful firmware flashing. Ultimately, a successful build for the 1MB BL602 is achieved, allowing for further development and testing.
Summary generated by the language model.
ADVERTISEMENT