logo elektroda
logo elektroda
X
logo elektroda

BK7231 WB3S via SPI in flash memory mode - Python and Raspberry Pi 3

slaweb91 1206 4
ADVERTISEMENT
  • #1 20575617
    slaweb91
    Level 4  
    Hi friends, I have some problems with wb3s...I try to flesh but I accidentally write flesh with this command (bk7231tools write_flash -d /dev/tty.usbserial-14140 -s 0x0 --bootloader OpenBK7231T_UA_1.17.105.bin)

    and I think the error was in this (-s 0x0) needs I think (-s 0x11000). now my mini smart switch doesn't want to go into flesh mode. I try with SPI (pi 3) but I get

    Send 250 'D2'
    0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 Test by sending get ID
    0x0 0x0 0x0 0x0 ID bad
    Failed to read flash id

    I use code (https://github.com/openshwprojects/BK7231_SPI_Flasher/blob/main/bk7231_spi_flasher.py)

    I only change this:

    CENGPIO = 3 (because my CEN from the WB3S is on pin 3 ras.pi 3)

    GPIO.setmode(GPIO.BOARD)

    Can someone help me? :)

    BK7231 WB3S via SPI in flash memory mode - Python and Raspberry Pi 3
  • ADVERTISEMENT
  • #2 20575661
    p.kaczmarek2
    Moderator Smart Home
    Please do not use obsolete toolset, we have a BK7231 gui flasher that requires just a BK7231N or BK7231T selection and will not allow for configuration errors at all:
    https://github.com/openshwprojects/BK7231GUIFlashTool
    It can also automatically detect Tuya GPIO config and configure OBK at the flash time.

    Regarding SPI problem:
    - check with LED is the CEN GPIO correctly configured and selected
    - try lower SPI speed
    - in general, check all connections... are you really sure that SPI pins (the ones for flashing, not for the slave control) are available on WB2S?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 20575696
    slaweb91
    Level 4  
    I know for that tool but I didn't have Win PC I have only Mac. And a few days ago I flashed 4ch-433 tuya with OpenBK72xxN. In the future, I will use the GUI tool...

    BK7231 WB3S via SPI in flash memory mode - Python and Raspberry Pi 3 BK7231 WB3S via SPI in flash memory mode - Python and Raspberry Pi 3 BK7231 WB3S via SPI in flash memory mode - Python and Raspberry Pi 3 BK7231 WB3S via SPI in flash memory mode - Python and Raspberry Pi 3

    3,3 --- pin 1
    cen --- pin 3
    si ---- pin 19
    so --- pin 21
    csn --- pin 24
    sck --- pin 23
    gnd --- pin 39

    I tried 20 000 speed but nothing

    I will maybe need to check all pins again, SPI is activated on ras.pi...

    Thank you
  • ADVERTISEMENT
  • #4 20575759
    p.kaczmarek2
    Moderator Smart Home
    Maybe try swapping MOSI and MISO... the MOSI of Raspberry (Master Out Slave In) should connect to SI (Slave In) of BK.
    Helpful post? Buy me a coffee.
  • #5 20575767
    slaweb91
    Level 4  
    I will try, and let you know.

    Right now I install Wine and I start .exe flesher...so the next flesh will be with the GUI tool definitely :D

    Added after 6 [minutes]:

    >>20575696

    you think only to set like this

    si ---- pin 21
    so --- pin 19

    because right now si is on si
    and so is on so

    do you mean to turn them like tx-rx on usb-ttl? (tx to rx, rx to tx)

    Added after 5 [hours] 57 [minutes]:

    >>20575661

    I reduce speed to 3000 HZ and get read

    root/beken_sp_flash.py:13: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
    GPIO.setup(CENGPIO, GPIO.OUT)
    Send 250 'D2'
    0x0 0xd2 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 Test by sending get ID
    0x0 0x1c 0x70 0x15 ID OK
    WriteImage OpenBK7231T_QIO_1.17.105.bin
    count 0/69632
    count 256/69632
    count 512/69632
    count 768/69632
    count 1024/69632


    count 69376/69632
    root@raspberrypi:~#

    and after that all is same like it was

    Added after 1 [minutes]:

    after finish i think that i need to have wifi with ssd openbkxxxxxxx but i dont have...i dont know whay
ADVERTISEMENT