logo elektroda
logo elektroda
X
logo elektroda

[BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

p.kaczmarek2 178122 1242
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #241 19897210
    sebastian48
    Level 9  
    boozeman wrote:
    sebastian48 wrote:
    HA! of course I didn't think of that! I do have an Arduino that I could use actually! Thanks


    You do not need the second UART because when you do successful flash and connect the device to your wlan, you can always use ip.address/app link. There is logs tab


    Yes but why not now that I have it :)

    The one thing is soldering to the pads. I'm just to shaky to get that to ever work out. Are you guys using pogo pins/clips or some other tool to connect to those pads?

    Would it make sense to get one of these: Amazon link
  • ADVERTISEMENT
  • #243 19897857
    sebastian48
    Level 9  
    ferbulous wrote:

    You could print one of this and use acupuncture pins, works for me

    https://www.thingiverse.com/thing:3615910


    Jesus H Christ! That is an excellent rig! I only have a SLA printer so it will be a mess but I will look into other solutions. I always forget I have a printer for some reason. Thanks!
  • ADVERTISEMENT
  • #245 19898449
    ferbulous
    Level 18  
    @p.kaczmarek2
    update..nevermind, just some wiring issue
    Also, can we actually use the ota option to upload the bin files? since it needs the url address for it

    What should I do if the AP doesn't show up?
    I've been at this for half an hour but it's still not visible (using QIO bin)

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    I did get the AP at first, setup wifi/mqtt in the settings. Restart it again, but it's still not connected to my wifi yet
  • #246 19898498
    ExploWare
    Level 10  
    Retry with the UA bin.

    Also, for the OTA option, you'll have to serve the .rbl fild on a webserver.
    I started
    pip3 install http-here; http-here --host 0.0.0.0 8000
    in the output-folder and set http://ipaddress:8000/OpenBK7231T_App_e896a81e.rbl in the URL field

    Dodano po 2 [godziny] 45 [minuty]:

    p.kaczmarek2 wrote:
    ExploWare wrote:

    I've also created a pull request for the OpenBK7231 as well as the _App repositories, to include the Git clone version, I think that's easier for users as it is auto_incrementing and developers as it's always pointing to what version is in use.

    It seems like a very nice idea, but my concern is that the SDKs doesn't have to be used only to build our app, they can be basically used to build any app for BK7231N or BK7231T or XR809. Could you modify your code in such a way that it takes the GIT version if there is not one specified, and if user specified a version then he's allowed to override it?


    @p.kaczmarek2 Good suggesion, I've created a new pull request: https://github.com/openshwprojects/OpenBK7231T/pull/5
    It takes the git version if no version is specified or when git is specified as version

    
    user:~$ ./build_app.sh 1 2 3 4
    APP_PATH=1
    APP_NAME=2
    APP_VERSION=3
    USER_CMD=4
    
    user:~$ ./build_app.sh 1 2 git 3
    APP_PATH=1
    APP_NAME=2
    APP_VERSION=ed9e43e
    USER_CMD=3
    
    user:~$ ./build_app.sh 1 2 notgit
    APP_PATH=1
    APP_NAME=2
    APP_VERSION=notgit
    USER_CMD=
    
    user:~$ ./build_app.sh 1 2 git
    APP_PATH=1
    APP_NAME=2
    APP_VERSION=ed9e43e
    USER_CMD=
    
    user:~$ ./build_app.sh 1 2
    APP_PATH=1
    APP_NAME=2
    APP_VERSION=ed9e43e
    USER_CMD=
  • #247 19898875
    ferbulous
    Level 18  
    @ExploWare
    I see, so it’s not just hosting the bin file in local ftp server, there’s additional steps
    I was able to get to the ap after a repeated flashing attempts (setup the wifi/mqtt) after my last post but it’s not saving the settings after reboot. Then it’s back to no ap broadcast
  • #248 19899049
    ExploWare
    Level 10  
    ferbulous wrote:
    @ExploWare
    I see, so it’s not just hosting the bin file in local ftp server, there’s additional steps
    I was able to get to the ap after a repeated flashing attempts (setup the wifi/mqtt) after my last post but it’s not saving the settings after reboot. Then it’s back to no ap broadcast

    Only not ftp, but http, no additional steps otherwise.
    Maybe FTP will work, have not tried it, as the http method was so easy
  • #249 19900350
    MustangMatt
    Level 8  
    I ordered some of these (https://templates.blakadder.com/D06.html) but they have CB3S (bk7231N) now. (I bent the PCB in the process of removing it unfortunately.)

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    I'll try to pull the firmware off tonight. I haven't been able to do it successfully yet I guess I need to re-read the thread and make sure I understand exactly what I should be doing.
  • #250 19900455
    p.kaczmarek2
    Moderator Smart Home
    ferbulous wrote:

    What should I do if the AP doesn't show up?
    I've been at this for half an hour but it's still not visible (using QIO bin)

    Repower the module, check logs... for N version only QIO bin worked for me.
    What do you exacly mean by "AP doesn't show up"? Was the initial access point showing correctly and now the module fails to connect to your wifi (as a client, not an AP), or was it never showing up?

    ExploWare wrote:

    @p.kaczmarek2 Good suggesion, I've created a new pull request: https://github.com/openshwprojects/OpenBK7231T/pull/5
    It takes the git version if no version is specified or when git is specified as version

    I have accepted the pull request but now I realized that something might be missing. Have you tested it with Cygwin build on Windows platform?


    pepesuriano wrote:

    Seems to be a TW-02 (W600 based see attachment for info)

    Looks very promising, albeit some of sdk urls looks like expired.
    https://github.com/w600
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    it could be possible to get my app running on this module, but I'd need to at least get one for testing. Where did you buy that smart device?

    sebastian48 wrote:

    Anyway, I ordered a station with exchangeable tips and digital temperature setting.

    Every station is slightly different, so it's better if you experiment with those things yourself on the scrap boards. The only most important thing is to keep soldering tip clean and use flux/solder paste.


    MustangMatt wrote:
    I ordered some of these (https://templates.blakadder.com/D06.html) but they have CB3S (bk7231N) now. (I bent the PCB in the process of removing it unfortunately.).

    is the same uart port used for flashing and for communication with mcu? maybe you need to ground the RESET pin of mcu if it's present. TuyaMCU is on my TODO list. I might need to buy this door sensor for development
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #251 19900496
    MustangMatt
    Level 8  
    I tried grounding reset but I can never get it to connect to the chip. I'm not sure if it's my poor soldering job or if I've fried it. I have a different device I'll try tomorrow if I can get the chip off the pcb to access all the pins.
  • #252 19900533
    ExploWare
    Level 10  
    [quote="p.kaczmarek2"I have accepted the pull request but now I realized that something might be missing. Have you tested it with Cygwin build on Windows platform?
    [/quote]

    I have not. I don't have such a setup at hand right now.
    I think defining a version by hand would always overrule any errors, but sure worth testing.

    If someone can confirm with a Cygwin setup, please do, otherwise I think I'll have time to do this in in the coming weekend.
  • ADVERTISEMENT
  • #253 19900628
    p.kaczmarek2
    Moderator Smart Home
    MustangMatt wrote:
    I tried grounding reset but I can never get it to connect to the chip. I'm not sure if it's my poor soldering job or if I've fried it. I have a different device I'll try tomorrow if I can get the chip off the pcb to access all the pins.

    Connect permanently a 10k resistor between CEN and 3.3V. Then try everything again. Do not disconnect 10k while resetting, just pull CEN temporarily to ground.

    ExploWare wrote:

    If someone can confirm with a Cygwin setup, please do, otherwise I think I'll have time to do this in in the coming weekend.

    For me, it gives "unknown command git", most likely because git is installed on Windows through SourceTree and build process is on Cygwin. I have modified the script to check again (after calling git) the value of version and default it to 1.0.0 if it's empty. I will try to get it working properly with Cygwin soon.
    Helpful post? Buy me a coffee.
  • #254 19900718
    ExploWare
    Level 10  
    p.kaczmarek2 wrote:
    ExploWare wrote:

    If someone can confirm with a Cygwin setup, please do, otherwise I think I'll have time to do this in in the coming weekend.

    For me, it gives "unknown command git", most likely because git is installed on Windows through SourceTree and build process is on Cygwin. I have modified the script to check again (after calling git) the value of version and default it to 1.0.0 if it's empty. I will try to get it working properly with Cygwin soon.


    Aah, true, the git part is done in windows.
    Well, the directory structure should be the same, so the .git/refs/heads/main should contain the latest branch. At least it does in my tree.
    Can you verify this? The pull request has been created.

    @btsimonh I've included your suggestion to use the app_path variable also. Of course that should be used, I didn't think there :)
  • #255 19900739
    p.kaczmarek2
    Moderator Smart Home
    Great, it seems correct now. Thanks!
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    Helpful post? Buy me a coffee.
  • #256 19901456
    pepesuriano
    Level 9  
    Hi, if I want to test serial connection before flashing, is it ok the following procedure?

    1- wire vcc, tx, rx, gnd to the module
    2- launch putty on serial connection mode and set bauds to 921600
    3- see output in console, interact with keyboard?
  • #257 19901507
    ExploWare
    Level 10  
    pepesuriano wrote:
    Hi, if I want to test serial connection before flashing, is it ok the following procedure?

    1- wire vcc, tx, rx, gnd to the module
    2- launch putty on serial connection mode and set bauds to 921600
    3- see output in console, interact with keyboard?


    If you use the bk_writer tool and press read the " read flash" button and then power on the the module, you'll be performing a more informative test
  • #258 19901511
    MustangMatt
    Level 8  
    For some reason bkwriter never sees com ports for me. Python does though.
  • #259 19901604
    ExploWare
    Level 10  
    Can anybody build correctly with the current versions?
    My current build_app.sh crashes at:
    OpenBK7231T/platforms/bk7231t/bk7231t_os/beken378/app/app_bk.c:717: undefined reference to `user_main'
    collect2: error: ld returned 1 exit status
    make[1]: *** [application.mk:640: application] Error 1

    (at both my laptop and my server,identical behaviour,and I used to be able to build at my laptop)
  • #260 19901645
    p.kaczmarek2
    Moderator Smart Home
    ExploWare wrote:

    My current build_app.sh crashes at:
    OpenBK7231T/platforms/bk7231t/bk7231t_os/beken378/app/app_bk.c:717: undefined reference to `user_main'
    collect2: error: ld returned 1 exit status
    make[1]: *** [application.mk:640: application] Error 1


    What are you trying to build? Old Tuya demos will not build without small fix.
    The main App and my demos: (obk_demo_openAccessPoint, obk_demo_scanNetworks, obk_hello_world) should build.
    Helpful post? Buy me a coffee.
  • #261 19901660
    ExploWare
    Level 10  
    I was trying the app straight from github.com/openshwprojects/OpenBK7231T_App. It somehow does not work for me.
    Any dependencies changed? As I said, I was able to build it, a week ago
  • #262 19901665
    p.kaczmarek2
    Moderator Smart Home
    Maybe try a clear clone of OpenBK7231T and OpenBK7231T_App repositories? I will also check on clear copy, give me a sec..


    Are you putting App in correct place? Do you have same error for obk_demo_* demos?
    Helpful post? Buy me a coffee.
  • #263 19902324
    pepesuriano
    Level 9  
    Hi, I managed to connect 2RX and 2TX and got serial output to debug my plug, here are some lines I found relevant:

    V:BK7231S_1.0.5
    CPSR:000000D3
    ...
    prvHeapInit-start addr:0x420030, size:131024
    ...
    [01-01 18:12:15 TUYA Notice][tuya_bt_sdk.c:130] ty bt sdk init success finish
    [01-01 18:12:15 TUYA Notice][tuya_device.c:355] < TUYA IOT SDK V:1.0.2 BS:40.00_PT:2.2_LAN:3.3_CAD:1.0.2_CD:1.0.0 >
    < BUILD AT:2020_09_25_17_24_52 BY embed FOR ty_iot_wf_bt_sdk_bk AT bk7231t >
    IOT DEFS < WIFI_GW:1 DEBUG:1 KV_FILE:0 SHUTDOWN_MODE:0 LITT[01-01 18:12:15 TUYA Notice][tuya_device.c:356] oem_bk7231s_dltj:1.3.5
    [01-01 18:12:15 TUYA Notice][tuya_device.c:357] firmware compiled at Dec 25 2020 10:09:14
    bk_rst:0 tuya_rst:0[01-01 18:12:15 TUYA Notice][tuya_device.c:360] REST INFORMATION IS 0
    ...
    [01-01 18:12:15 TUYA Notice][device_config_load.c:479] ,module: is WB2S
    ...
    [01-01 18:12:15 TUYA Notice][tuya_main.c:311] **********[oem_bk7231s_dltj] [1.3.5] compiled at Dec 25 2020 10:09:10**********

    I tested:
    - Wire UART adapter 1 to 1RX, 1TX, GND
    - Wire UART adapter 2 to 2RX, 2TX and it's GND to CEN
    - Launch putty on adapter 1 and beken writer on adapter 2
    - Click "Read flash" on beken writer, in 2 seconds plug VCC, and in another 2 seconds, unplug CEN from GND
    - Serial output shows on putty, but seems just normal boot and beken writer failed

    See picture:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    I have the pending suggestion from previous posts to desolder VCC from mainboard, since logs show fine on debug output, do I need it anyway? Or if it was the case it has just to restart or have the debugguing output not working?

    I clicked beken writer read flash with the plug on "idle" watching serial output, nothing happens just as it should be unwired (it's perfectly wired).

    Any ideas on how to continue?
  • #264 19902541
    boozeman
    Level 11  
    pepesuriano wrote:
    Any ideas on how to continue?


    What kind of device you are trying to flash? Can you check with multimeter if there is some pull-up or pull-down resistors in RX1 or TX1 pins.

    I have one smart plug where RX1 is pulled up to 3.3V because it is used for relay activating button. This prevents flashing for me.
  • #265 19902591
    ferbulous
    Level 18  
    boozeman wrote:
    pepesuriano wrote:
    Any ideas on how to continue?


    What kind of device you are trying to flash? Can you check with multimeter if there is some pull-up or pull-down resistors in RX1 or TX1 pins.

    I have one smart plug where RX1 is pulled up to 3.3V because it is used for relay activating button. This prevents flashing for me.


    If i need to check, how do i do that?
    Do i just probe the rx1 and vcc and it gives me 3.3v?
  • #266 19902594
    boozeman
    Level 11  
    ferbulous wrote:
    If i need to check, how do i do that?
    Do i just probe the rx1 and vcc and it gives me 3.3v?


    You have to follow the tracks from Rx1 or Tx1 pin and see what components there are and where the traces go. Can you add some pictures of your device. Both sides.
  • #267 19902604
    ferbulous
    Level 18  
    @p.kaczmarek2

    Wb3s
    I ended up desoldering the wb3s and was able to flash firmware and it boot up with ap.

    Cbu
    As for the cbu chip, I’m still having problem getting the AP with even with successful flashing each time.
    How do i get the logs if I’m not using bkwriter?

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    WE3L
    Still trying to flash it but I’m not succesful yet
  • #268 19902615
    p.kaczmarek2
    Moderator Smart Home
    ferbulous wrote:

    WE3L
    Still trying to flash it but I’m not succesful yet

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    Are you trying to flash ESP8266 chip with BKwriter 1.60?

    Also, please post full photos of your setup. What kind of UART converter are you using?
    Helpful post? Buy me a coffee.
  • #269 19902636
    ferbulous
    Level 18  
    p.kaczmarek2 wrote:
    ferbulous wrote:

    WE3L
    Still trying to flash it but I’m not succesful yet

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    Are you trying to flash ESP8266 chip with BKwriter 1.60?

    Also, please post full photos of your setup. What kind of UART converter are you using?


    Oh wow, this in an esp? I thought it was another bk7321t variant, i ordered like a dozen of these bulbs and the rest were wb3L
  • #270 19902772
    pepesuriano
    Level 9  
    boozeman wrote:
    pepesuriano wrote:
    Any ideas on how to continue?


    What kind of device you are trying to flash? Can you check with multimeter if there is some pull-up or pull-down resistors in RX1 or TX1 pins.

    I have one smart plug where RX1 is pulled up to 3.3V because it is used for relay activating button. This prevents flashing for me.


    Here are some pictures:

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

Topic summary

The discussion revolves around the development and implementation of custom firmware for devices using the BK7231T and BK7231N chips, particularly focusing on creating a mini HTTP server, MQTT support, and integration with Home Assistant. Users share their experiences flashing various smart devices, troubleshooting issues related to UART connections, and configuring GPIO pins for different functionalities. The conversation also touches on the challenges of maintaining WiFi connectivity, the importance of proper pin configuration, and the potential for using I2C for additional device control. Several users report successful firmware updates and the addition of new features, including support for various sensors and devices.
Summary generated by the language model.
ADVERTISEMENT