Elektroda.com
Elektroda.com
X

[BK7231T] Is there a way to enable bluetooth or use it on the chip

whiskeysprinkler 528 7
  • #1
    whiskeysprinkler
    Level 2  
    I want to pair something to the bluetooth on the BK7231 chip; a BLE sensor. Has anyone done this yet? what are the steps? do you have to compile a custom version of the firmware and flash?

    if this is documented someplace, can someone provide a link to it? my searches are all ending up with "the 7231 is bluetooth capable" and thats it.
  • #2
    p.kaczmarek2
    Moderator Smart Home
    Hello, can you provide more information about the sensor you want to use with BK and about it's protocol/data format?
  • #3
    whiskeysprinkler
    Level 2  
    Basically I want to connect a BLE device to it. Similar to how tasmota handles stuff like that. The idea is similar to the flic but not dealing with all the flic issues or api or whatnot.

    I want to be able to push a button on this BLE device and trigger in action. If that means that it really is an MQTT message to home assistant and home assistant executes based on that mqtt then that's good enough for now.

    The end goal is really to have a remote button that triggers an openbeken device to toggle a relay. So even if your smart home network goes down, the button still works. (aka no ZigBee)

    All these chipsets We take advantage of are capable of this. I just think it might be time to start using it
  • #4
    jitsirakowsk
    Level 5  
    I would also be interested in this. There are countless directories in the original tuya sdk repo that deal with ble but it is not clear how these functions should be used. There are several functions claiming to be the 'entry point' to ble but what it means escapes me completely. At this point I would be happy to have the device show up on a BT scan.
  • #5
    p.kaczmarek2
    Moderator Smart Home
    Do you need BLE to run at the same time as WiFi?
    Code: c
    Log in, to see the code

    Header indicates that RF uses the same antenna for WiFi and BL and them seemingly can't be used at the same time.
  • #6
    jitsirakowsk
    Level 5  
    p.kaczmarek2 wrote:
    Do you need BLE to run at the same time as WiFi?
    Header indicates that RF uses the same antenna for WiFi and BL and them seemingly can't be used at the same time.

    No, I would just like to use WB2L as a BT or BLE device. The ble.h header seems to list the functions to switch the radio to BLE but it is unclear to me how to bring the BLE subsystem up. There should be a way to supply the bdaddr, etc. somewhere, start advertizing...

    Thanks a lot for the reply and all the amazing work on Open_Beken.

    Andy

    Added after 2 [hours] 52 [minutes]:

    Maybe someone who has access to RivieraWave (now CEVA) documents RW-BLE-HOST-SW-FS.pdf and RW-BLE-HOST.pdf can figure it our but I cannot seem to find these anywhere.
  • #7
    jitsirakowsk
    Level 5  
    I compiled a default template_demo app from the original Tuya repo (after supplying some empty functions) and removed all the WiFi init code from tuya_device.c. Judging by the diagnostic output I get, tuya SDK inits the BLE system itself and I can even see 'appm start advertising' appearing in the output but the device still does not show up on any scans. I added ble_switch_rf_to_ble(); but still no cigar. What am I missing? I do not mind combing the assembly output to see what the SDK does after I get something working but right now nothing seems to be happening. Anybody got any ideas?

    Added after 3 [hours] 12 [minutes]:

    My apologies for spamming this thread again but something seems to be missing in the repos (both tuya's as well as OpenBK). The ble.c file relies on RT-Thread functions like rt_timer_start etc. so it is not directly usable. I am not familiar with RT-Thread and how well it might mix with FreeRTOS code. There are no definitions (or even lib symbols) for these functions anywhere in the code tree so they must be ported to the OS used by the project. Does anyone have a solution or a way around this?
  • #8
    p.kaczmarek2
    Moderator Smart Home

    It seems we have made substantial progress by @lsitkowski. Please see here:
    https://www.elektroda.com/rtvforum/viewtopic.php?p=20653571#20653571
    I will close this topic for now, let's continue in the topic linked above.