STMicroelectronics / BlueSTSDK_Python

Bluetooth Low Energy Sensors Technology Software Development Kit (Python version for Linux Gateways)
https://www.st.com/en/embedded-software/bluest-sdk.html
BSD 3-Clause "New" or "Revised" License
61 stars 19 forks source link

P-NUCLEO-WB55 - update firmware via BLE and read characteristic #21

Open pawelm87 opened 4 years ago

pawelm87 commented 4 years ago

Hi all

I have nucleo board with STM32WB55 chip with original bootloader from ST - STM_OTA. I can update program via bla using STM32CubeMonitor-RF and it's work fine for me. Now I would like to use Your script to load firmware via BLE and STM_OTA bootloader, but I have got some trouble.

In advertaising mode my device have name STM_OTA (the default ST bootlader) so I changed name of device :

IOT_DEVICE_NAME = 'TAI_110' -> IOT_DEVICE_NAME = 'STM_OTA'

after that I changed name of my bin file with new firmware:

FIRMWARE_FOLDER = '/home/ppawel/download/STM_OTA/'
FIRMWARE_EXTENSION = '.bin'
FIRMWARE_FILENAMES = ['test1'
]

After run script "example_ble_x.py" I used "user interfeis - terminal" to choose what I need - update firmware and which bin file, and after that the script crash:

~/Downloads/BlueSTSDK_Python/blue_st_examples $ sudo python3 example_ble_6.py 

##################
# BlueST Example #
##################

Scanning Bluetooth devices...

Discovery started.
New device discovered: STM_OTA.
Discovery stopped.

Connecting to STM_OTA...
Device STM_OTA connected.
Connection done.

Features:
No features found.
1) Firmware upgrade

Select an action ('0' to quit): 1   
1)node-stm32wb55

Select a firmware ('0' to cancel): 1

Upgrading firmware...
1
<bound method Node.get_debug of <blue_st_sdk.node.Node object at 0x7647b490>>
none
2
Traceback (most recent call last):
  File "example_ble_6.py", line 327, in main
    upgrade_console.add_listener(upgrade_console_listener)
AttributeError: 'NoneType' object has no attribute 'add_listener'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "example_ble_6.py", line 391, in <module>
    main(sys.argv[1:])
  File "example_ble_6.py", line 346, in main
    upgrade_console.remove_listener(upgrade_console_listener)
AttributeError: 'NoneType' object has no attribute 'remove_listener'
Device STM_OTA disconnected.
Exception ignored in: <function Peripheral.__del__ at 0x76572108>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 630, in __del__
  File "/usr/local/lib/python3.7/dist-packages/blue_st_sdk/node.py", line 555, in disconnect
  File "/usr/local/lib/python3.7/dist-packages/blue_st_sdk/node.py", line 398, in _update_node_status
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 151, in submit
RuntimeError: cannot schedule new futures after shutdown

I have some question:

  1. This script work/is compatible with this board (STM32WB55 and STM OTA bootloader) ??

  2. How I can access to ble characteristic via scripts ??

Thanks for help for everyone