logo elektroda
logo elektroda
X
logo elektroda

Identify Tuya Mini WiFi Relay Module with TR6260 Chip - Encountered by Anyone?

ferbulous 5532 81
ADVERTISEMENT
  • #31 21312959
    p.kaczmarek2
    Moderator Smart Home
    Nice, but does it boot?

    Is there LWIP in the SDK?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • ADVERTISEMENT
  • #33 21314458
    micbanand
    Level 5  
    Close-up view of an ESP module with attached colored wires. ESP-02S module with connected wires Close-up of a USB-TTL module with attached wires. Screenshot of a software uploading tool for the TR6260 microprocessor with an error message.
    works with esp-02s?
    have I moved a jumper setting wrong since? set to usb-ttl right
  • #34 21314483
    divadiow
    Level 34  
    >>21314458

    not sure what you mean by ESP-02S but what is the pad you've also grounded with the blue cable?

    Close-up of a PCB with soldered wires.

    does it definitely trace to GPIO14/TOUT2 pin on the TR6260 IC?

    if anything it looks like BT0 is perhaps the most likely candidate for GPIO14. BT0=Bootmode0 maybe

    Close-up of a circuit board with pin labels TXD, RXD, BT1, and BT0.

    Table showing pin assignments, highlighting pins GPIO14 and TOUT2.
  • #35 21314485
    jekader
    Level 6  
    I was not able to get my board into UART boot mode so far, need to re-solder some connections.

    Also, I don't have a Windows env so testing the UTP app might be troublesome.

    Attaching build artifacts of the SDK demo app in case someone wants to try flashing.
    Looking at the artifacts with a hex editor, they don't seem to have a bootloader one must be provided separately I guess.

    Firmware binaries in HKL-M20.7z have bootloaders or one can be dumped from the board itself.
  • #36 21314487
    micbanand
    Level 5  
    >>21314483 I soldered it to what is pin 14 on esp-02s
    but I will try bt1 :) ooh pin bt0 :)
  • #37 21314491
    divadiow
    Level 34  
    micbanand wrote:
    but I will try bt1 ooh pin bt0

    yes sorry, corrected post from BT1 to BT0
  • #38 21314507
    micbanand
    Level 5  
    >>21314491 no luck on bt0
    out of time for today. Suggestions are welcome :)
  • #39 21314509
    divadiow
    Level 34  
    I would try to trace where GPIO14 of the TR6260 goes to with multimeter probes. I've soldered a sewing needle to one probe so I can touch individual chip legs under a microscope with care and certainty.

    Added after 1 [minutes]:

    do the same at your own risk of course ;)

    Added after 11 [minutes]:

    or try BT1?
  • ADVERTISEMENT
  • #40 21314551
    micbanand
    Level 5  
    >>21314483
    "not sure what you mean by ESP-02S but what is the pad you've also grounded with the blue cable?"

    all the smart contacts.
    where the 6260 modules come from.
    are replaced with a esp-02s module.

    the blue cable is going to ground with a switch in between. so I can make a short to ground while plugging in the reader/flasher.
    it went to gpio0 on the esp-02s and it is the pin I tried on gpio14 know bt0 and bt1 and other pins later?

    and yes I can try to follow traces under microscope. do we have a pinout of the 6260 chip?
  • #41 21314580
    divadiow
    Level 34  
    micbanand wrote:
    do we have a pinout of the 6260 chip?


    yes, but something's currently a little unclear. I didn't actually trace the GPIO14-labelled pad on the HLK-M20 module to the leg on the IC to match it up, until now. The Skylab engineer said in his little email guide that "TOUT2" (of the Skylab LCS6260) should be grounded to get into programming mode.

    If you look at TOUT2 of the IC from the diagram in the Transa Semi datasheet TOUT2 is pin 5. BUT on the TR6260S1 on my HLK-M20 module, pin 6 has continuity to GPIO14 pad, meaning TOUT3, which is what you see in the earlier post is what I grounded.

    Diagram of the TR6260 integrated circuit with TOUT2 pin highlighted.

    So, it's either GPIO14 or 15, something's not matching yet. Is TR6260 the same as TR6260S1?

    Either way, you need to pull one of those low. Don't forget you could monitor the TX log out to see which mode each gets you into.

    Added after 9 [minutes]:

    LCS6260 datasheet for added reference.

    Section of documentation detailing boot modes for GPIO14 and GPIO15 pins. The pin description of SCT6260 with TOUT2 and TOUT3 highlighted.

    I guess pulling down GPIO14 would make sense as 15 is already low.
  • #42 21314648
    divadiow
    Level 34  
    >>21314485

    so I've tried a few things and although it's not output anything about a boot fail, it still has only output the standard lines
    Screen displaying text with boot modes and unrecognizable characters.
    those being
    Lentry BootRom
    Lspi-flash boot mode


    so not really sure what it's doing. those unrecognisable character lines are just when I was programming it.

    im trying variations on this with both bins in your zip

    Screenshot of a firmware flashing program with several selected files for flashing.

    interesting is the jpg in the Skylab supplied zip:

    A screenshot of UTP software showing various files to upload, their paths, addresses, and status.

    Added after 4 [minutes]:

    same TX out with this. It'd be good to know how we're to know we're supposed to tell if it's booted.

    Screenshot of a firmware uploading program for a device.

    I've asked Skylab for some demos

    Added after 32 [minutes]:

    if you flash lmactest.bin in the zip you get this output at 115200

    Screenshot of UTP software for microcontroller flashing.

    Terminal output showing unrecognizable characters and diagnostic messages.
  • Helpful post
    #45 21314899
    jekader
    Level 6  
    Thank you! The "good" binaries seem to all start with some sort of bootloader section:

    
    00000000  62 65 6e 6f 04 00 00 00  01 00 00 00 00 00 00 00  |beno............|
    00000010  c0 41 00 00 02 26 20 18  fe 09 96 08 5e b8 c2 00  |.A...& .....^...|
    00000020  00 00 41 80 00 00 00 40  00 01 c0 00 ab 4f b9 58  |..A....@.....O.X|
    00000030  18 14 0f 00 62 6f 6f 74  2d 76 65 72 73 69 6f 6e  |....boot-version|
    00000040  2d 64 65 62 75 67 00 00  00 00 00 00 00 00 00 00  |-debug..........|
    


    Also, I found the script that generates the binary you noticed in the screenshot earlier:
    https://github.com/divadiow/TR6260/blob/main/...scripts/build_tr6260s1_standalone_diff.sh#L21

    It checks the sizes of the binaries and adds these numbers to the start of the file, then concatenates the binaries themselves.
    Attaching the resulting file - maybe flashing it to the offset would provide some results. Still not quite clear what this _diff build target is supposed to produce however.
  • #46 21314908
    divadiow
    Level 34  
    awesome!

    Screenshot of software for uploading binary files to a device.

    Screenshot of a terminal with unreadable text and baud rate set to 115200.

    whatever it is is booting

    Added after 6 [minutes]:

    response to "AT"
    Screenshot showing Unknown command: AT error in a console.

    Added after 31 [minutes]:

    Maybe the attached is meant for use with what's been built, though I see no AT commands in plain text in that binary and it's not responding to commands.
  • #47 21315164
    jekader
    Level 6  
    Awesome, the log line is likely this function executing:

    https://github.com/divadiow/TR6260/blob/main/SDK/system/util_trace_stack.c#L9

    Great to know that the SDK can produce a binary that works on the MCU.

    I guess, now is the time to put OpenBeken instead of the demo app and adjust the includes to make the build happy.
    Did some tests - the build is failing due to missing files but it does try compiling main.c and friends.

    Here's a sample using PLATFORM_BL602 - not too bad for a first random try:
    Spoiler:
    compile ../ref_design/standalone/main.c
    In file included from ../include/system.h:26:0,
                     from ../platform/lwip/contrib/port/arch/cc.h:35,
                     from ../platform/lwip/lwip-2.1.0/src/include/lwip/arch.h:48,
                     from ../platform/lwip/lwip-2.1.0/src/include/lwip/debug.h:40,
                     from ../platform/lwip/lwip-2.1.0/src/include/lwip/opt.h:52,
                     from ../platform/lwip/lwip-2.1.0/src/include/lwip/sockets.h:42,
                     from ../ref_design/standalone/hal/../new_common.h:469,
                     from ../ref_design/standalone/hal/hal_flashVars.h:5,
                     from ../ref_design/standalone/main.c:8:
    ../include/system_common.h:116:0: warning: "MIN" redefined
     #define MIN(x, y)               (((x) < (y))? (x) : (y))
     ^
    In file included from ../ref_design/standalone/hal/hal_flashVars.h:5:0,
                     from ../ref_design/standalone/main.c:8:
    ../ref_design/standalone/hal/../new_common.h:143:0: note: this is the location of the previous definition
     #define MIN(a,b) (((a)<(b))?(a):(b))
     ^
    In file included from ../include/system.h:26:0,
                     from ../platform/lwip/contrib/port/arch/cc.h:35,
                     from ../platform/lwip/lwip-2.1.0/src/include/lwip/arch.h:48,
                     from ../platform/lwip/lwip-2.1.0/src/include/lwip/debug.h:40,
                     from ../platform/lwip/lwip-2.1.0/src/include/lwip/opt.h:52,
                     from ../platform/lwip/lwip-2.1.0/src/include/lwip/sockets.h:42,
                     from ../ref_design/standalone/hal/../new_common.h:469,
                     from ../ref_design/standalone/hal/hal_flashVars.h:5,
                     from ../ref_design/standalone/main.c:8:
    ../include/system_common.h:117:0: warning: "MAX" redefined
     #define MAX(x, y)               (((x) > (y))? (x) : (y))
     ^
    In file included from ../ref_design/standalone/hal/hal_flashVars.h:5:0,
                     from ../ref_design/standalone/main.c:8:
    ../ref_design/standalone/hal/../new_common.h:147:0: note: this is the location of the previous definition
     #define MAX(a,b) (((a)>(b))?(a):(b))
     ^
    In file included from ../include/system.h:26:0,
                     from ../platform/lwip/contrib/port/arch/cc.h:35,
                     from ../platform/lwip/lwip-2.1.0/src/include/lwip/arch.h:48,
                     from ../platform/lwip/lwip-2.1.0/src/include/lwip/debug.h:40,
                     from ../platform/lwip/lwip-2.1.0/src/include/lwip/opt.h:52,
                     from ../platform/lwip/lwip-2.1.0/src/include/lwip/sockets.h:42,
                     from ../ref_design/standalone/hal/../new_common.h:469,
                     from ../ref_design/standalone/hal/hal_flashVars.h:5,
                     from ../ref_design/standalone/main.c:8:
    ../include/system_common.h:175:0: warning: "ASSERT" redefined
     #define ASSERT(x)       if ((x)) {} else {show_assert(#x, __FILE__, __FUNCTION__, __LINE__); }
     ^
    In file included from ../ref_design/standalone/hal/hal_flashVars.h:5:0,
                     from ../ref_design/standalone/main.c:8:
    ../ref_design/standalone/hal/../new_common.h:236:0: note: this is the location of the previous definition
     #define ASSERT
     ^
    In file included from ../include/system_common.h:308:0,
                     from ../include/system.h:26,
                     from ../platform/lwip/contrib/port/arch/cc.h:35,
                     from ../platform/lwip/lwip-2.1.0/src/include/lwip/arch.h:48,
                     from ../platform/lwip/lwip-2.1.0/src/include/lwip/debug.h:40,
                     from ../platform/lwip/lwip-2.1.0/src/include/lwip/opt.h:52,
                     from ../platform/lwip/lwip-2.1.0/src/include/lwip/sockets.h:42,
                     from ../ref_design/standalone/hal/../new_common.h:469,
                     from ../ref_design/standalone/hal/hal_flashVars.h:5,
                     from ../ref_design/standalone/main.c:8:
    ../include/wifi/hal_phy_tr6260.h:37:0: warning: "BIT_SET" redefined
     #define BIT_SET(value,bit) (*(volatile uint32_t*)(value) = (*(volatile uint32_t*)(value))|(1<<(bit)));
     ^
    In file included from ../ref_design/standalone/hal/hal_flashVars.h:5:0,
                     from ../ref_design/standalone/main.c:8:
    ../ref_design/standalone/hal/../new_common.h:136:0: note: this is the location of the previous definition
     #define BIT_SET(PIN,N) (PIN |=  (1<<N))
     ^
    In file included from ../ref_design/standalone/hal/hal_flashVars.h:5:0,
                     from ../ref_design/standalone/main.c:8:
    ../ref_design/standalone/hal/../new_common.h:481:0: warning: "stricmp" redefined
     #define stricmp wal_stricmp
     ^
    In file included from ../ref_design/standalone/hal/../new_common.h:7:0,
                     from ../ref_design/standalone/hal/hal_flashVars.h:5,
                     from ../ref_design/standalone/main.c:8:
    /home/jekader/code/tr6260/nds32le-elf-mculib-v3/nds32le-elf/sys-include/string.h:129:0: note: this is the location of the previous definition
     #define stricmp strcasecmp
     ^
    In file included from ../ref_design/standalone/hal/hal_flashVars.h:5:0,
                     from ../ref_design/standalone/main.c:8:
    ../ref_design/standalone/hal/../new_common.h:497:13: error: conflicting types for 'strcasestr'
     const char* strcasestr(const char* str1, const char* str2);
                 ^
    In file included from /home/jekader/code/tr6260/nds32le-elf-mculib-v3/nds32le-elf/sys-include/stdlib.h:11:0,
                     from ../ref_design/standalone/hal/../new_common.h:4,
                     from ../ref_design/standalone/hal/hal_flashVars.h:5,
                     from ../ref_design/standalone/main.c:8:
    /home/jekader/code/tr6260/nds32le-elf-mculib-v3/nds32le-elf/sys-include/string.h:65:7: note: previous declaration of 'strcasestr' was here
     char *_EXFUN(strcasestr,(const char *, const char *));
           ^
    ../ref_design/standalone/main.c:49:20: fatal error: bl_sys.h: No such file or directory
     #include <bl_sys.h>
                        ^
    compilation terminated.
    make[1]: *** [../scripts/rules.mk:148: ../out/tr6260s1/standalone/obj_standalone_tr6260s1/main.c.o] Error 1
    make: *** [Makefile:306: st_tr6260s1_diff] Error 2
    


    I'm not too familiar with OpenBeken but hopefully someone with more porting skills can take it from here.
  • #48 21315270
    divadiow
    Level 34  
    excellent work.

    jekader wrote:
    hopefully someone with more porting skills can take it from here.


    geniuses like @insmod @DeDaMrAz @max4elektroda @p.kaczmarek2 perhaps ;)
  • #49 21315278
    insmod
    Level 24  
    >>21315270 still waiting for hlk-m20 arrival.
  • ADVERTISEMENT
  • #50 21315543
    divadiow
    Level 34  
    I've scraped a couple of different TR6260 datasheets from around the net. Added to GH. A little comparison:

    Three diagrams depicting pin definitions for TR6260.
  • #51 21316819
    max4elektroda
    Level 20  
    divadiow wrote:
    geniuses like @insmod @DeDaMrAz @max4elektroda @p.kaczmarek2 perhaps

    Sorry, I don't have any hlk-m20 / TR6260 device, so I can't help here
    (and I think I'm far from the title you gave ;-) )
  • #52 21326326
    insmod
    Level 24  
    Absolute blank (no cfg, no wifi etc.) openbeken log
    
        f  `  f    `   枘   `` f  x   [00:00:00.000]ENV isn't initialize OK.
    ENV isn't initialize OK.
    ENV isn't initialize OK.
    ENV isn't initialize OK.
    this is not eco chip, chip type: 2 
    No 1. Task Name(LMAC Task) Handle(2105524) Added to Stack Trace
    0x240200 0x240400 0x240600 0x240800 0x240a00 0x240c00 0x240e00 0x241000 0x241200 0x241400 0x241600 0x241800 0x241a00 0x241c00 0x241e00 0x242000 0x242200 0x242400 0x242600 0x242800 0x242a00 0x242c00 0x242e00 0x243000 0x243200 0x243400 0x243600 0x243800 0x243a00 0x243c00 0x243e00 0x244000 ENV isn't initialize OK.
    ENV isn't initialize OK.
    mainldo_nv_flag=0 buck_nv_flag=0 chip_id=2  is_cp=0
    ENV isn't initialize OK.
    ENV isn't initialize OK.
    LMAC initialize success
    vif_id:0, scanning:false
    ENV isn't initialize OK.
    ENV isn't initialize OK.
    ENV isn't initialize OK.
    No 2. Task Name(wpa_supplicant) Handle(2128488) Added to Stack Trace
    [standalone_main, 152] task creation succeed!(0x207a68)
    [OpenBeken, 65] task created
    No 3. Task Name(OpenBeken) Handle(2208176) Added to Stack Trace
    ENV isn't initialize OK.
    ENV isn't initialize OK.
    ENV isn't initialize OK.
    ENV isn't initialize OK.
    wdt_not_start
    No 4. Task Name(IDLE) Handle(2122692) Added to Stack Trace
    No 5. Task Name(Tmr Svc) Handle(2127848) Added to Stack Trace
    ENV isn't initialize OK.
    wlif_init
    ENV isn't initialize OK.
    wlif_init
    vif_id:0, scanning:false
    ENV isn't initialize OK.
    wpa state:DISCON->INACT.
    wpa state:INACT->DISCON.
    ENV isn't initialize OK.
    wpa state:DISCON->INACT.
    wpa state:INACT->DISCON.
    vif[0],event[27]
    vif[0],event[27]
    vif[1],event[27]
    Entering initLog()...
    vif[1],event[27]
    vif[0],event[0]
    Commands registered!
    initLog() done!
    Info:MAIN:Main_Init_Before_Delay
    OK
    OK
    
    WiFI_GetMacAddressWarn:CFG:CFG_InitAndLoad: Config crc or ident mismatch. Default config will be loaded.
    Info:CFG:CFG_SetDefaultLEDCorrectionTab
    Main_Init_Before_Delay done
    
    Main_Init_Delay
    
    Main_Init_Delay done
    le: setting defaults
    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 []
    Info:MAIN:Using Pass []
    Info:MQTT:MQTT_RegisterCallback called for bT TR626000000000/ subT TR626000000000/+/set
    Info:MQTT:MQTT_RegisterCallback called for bT obks/ subT obks/+/set
    Info:MQTT:MQTT_RegisterCallback called for bT cmnd/TR626000000000/ subT cmnd/TR626000000000/+
    Info:MQTT:MQTT_RegisterCallback called for bT cmnd/obks/ subT cmnd/obks/+
    Info:MQTT:MQTT_RegisterCallback called for bT TR626000000000/ subT TR626000000000/+/get
    Error:CMD:cmd startScript NOT found (args autoexec.bat)
    Info:MAIN:Main_Init_After_Delay done
    Info:MAIN:Time 1, idle 0/s, free 54432, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 0/0 
    Info:MAIN:Time 2, idle 0/s, free 54432, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 0/0 
    Info:MAIN:Time 3, idle 0/s, free 54432, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 0/0 
    Info:MAIN:Time 4, idle 0/s, free 54432, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 0/0 
    Info:MAIN:Time 5, idle 0/s, free 54432, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 0/0 
    Info:MAIN:Time 6, idle 0/s, free 54432, 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 54432, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 0/0 
    Info:MAIN:Time 8, idle 0/s, free 54432, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 0/0 
    Info:MAIN:Time 9, idle 0/s, free 54432, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 0/0 
    Info:MAIN:Time 10, idle 0/s, free 54432, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 0/0 
    
    
  • #54 21326375
    insmod
    Level 24  
    Device configuration interface for OpenTR6260 with technical information and action buttons.
    Was able to get AP working, but dhcp is not working (edit: now works).
  • #55 21326383
    divadiow
    Level 34  
    wowee. lmk if there's anything I can do. I'm guessing not much at this point re coding things :(
  • #56 21326385
    insmod
    Level 24  
    Not enough memory btw, i occasionally see this in log - (Thread create HTTP Client - errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY)
  • #57 21326638
    divadiow
    Level 34  
    hmm. ok. is that in an insurmountable issue? are the specs of the chip too low?
  • #58 21327279
    insmod
    Level 24  
    >>21326638 Chip only has 128kb sram, and this problem, pops up even without mqtt.
    Several kb can be saved (maybe?), if wpa_supplicant task stack size is reduced from 10000 to smth about 6144 like in esp-idf (i don't know if it even consumes this much).
    Binaries now available at github, feel free to test/fix. As i've written on gh, nothing works.
    https://github.com/openshwprojects/OpenBK7231T_App/pull/1446
  • #60 21327639
    p.kaczmarek2
    Moderator Smart Home
    Very good job @insmod ! I need to get/find my TR fast, hopefully it didn't drown when my basement got flooded...
    insmod wrote:
    (Thread create HTTP Client - errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY)

    It's been discussed before, we have multithreaded HTTP server, but maybe it could just work in a single thread:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/src/httpserver/http_tcp_server.c
    There is a snipped:
    Code: C / C++
    Log in, to see the code

    but it caused some strange instabilities on Beken so it's XR809-only for now. Have you tried to enable it for TR?
    Helpful post? Buy me a coffee.

Topic summary

The discussion revolves around the Tuya Mini WiFi Relay Module equipped with the TR6260 chip, which some users have encountered. Initial inquiries reveal that the TR6260 chip is swappable with ESP chips, but users are struggling to find suitable SDKs or flashing tools for it. One user shared boot logs indicating the presence of the Tuya IoT SDK, while another noted that the TR6260S1 chip is also found in the ELM 327 WiFi diagnostic interface. There is speculation about the compatibility of the TR6260 with other chips like the RTL8710, but it appears that the TR6260 is not currently supported by open-source firmware like OpenBeken. Users express hope for future developments in flashing methods for the TR6260.
Summary generated by the language model.
ADVERTISEMENT