2022-10-28 07:39 AM
Hi community,
I have a device with STM32WB55 that has worked successfully with mbed-os for over two years (since the mbed-os 5 version). I decided to do an update of the FUS and STM BLE stack because I was using the old 1.2.0 version and started having problems with the firmware update by BLE_OTA with the new application from ST and from own BLE Web API tool and own Python CLI tool. I did an update of STM BLE stack to the current version 1.14.1.
[INFO][BLWB]: WIRELESS COPROCESSOR FW VERSION ID = 1.14.1
[INFO][BLWB]: WIRELESS COPROCESSOR FW STACK TYPE = 1 (ROM size 0xc3000)
After this action, BLE stopped working with mbed-os, when other functionalities of the firmware work fine. To determine what happened I preapred 2 devices. One of them is with BLE stack 1.2.0 (how it worked for 2 years) and second one with BLE stack 1.14.1. and I began to make a comparison of this two.
During BLE initialization, the program exchanges information with the BLE Stack on the other core via HCIDriver. This is where I found the differences in the responses received by HCIDriver. To the point.
For the case of the BLE 1.2.0 stack, all responses (events) that the HCIDriver receives are of type ‘Command Complete event’ (HCI_COMMAND_COMPLETE_EVENT). Example below:
[DBG ][BLE_WB]: TX >> BLE CMD >> Type: 1 / Cmd: 202A / Len: 0
[DBG ][BLE_WB]: Payload:
[DBG ][BLE_WB]: Command complete event, cmd: 0e:05:01:2a:20:00:0f:00:94:26:00:20:00:00:00:00:00:00:00:00
For the case of the BLE 1.14.1 stack, some of the responses (events) that HCIDriver receives are of type 'Command Status event' (HCI_COMMAND_STATUS_EVENT) instead of 'Command Complete event'. Example below:
[DBG ][BLE_WB]: TX >> BLE CMD >> Type: 1 / Cmd: 202A / Len: 0
[DBG ][BLE_WB]: Payload:
[DBG ][BLE_WB]: Command Status event, status:1, opcode=0x202A
0f:04:01:01:2a:20:00:00:94:26:00:20:00:00:00:00:00:00:00:00
Below are the BLE all opcodes to which I get responses like ‘Command Status event’ instead of ‘Command Complete event’ how it was for BLE stack 1.2.0:
[INFO][BLWB]: Command Status event, status:1, opcode=0x2002
[INFO][BLWB]: Command Status event, status:1, opcode=0x201C
[INFO][BLWB]: Command Status event, status:1, opcode=0x200F
[INFO][BLWB]: Command Status event, status:1, opcode=0x2003
[INFO][BLWB]: Command Status event, status:1, opcode=0x202A
[INFO][BLWB]: Command Status event, status:1, opcode=0x2005
The rest of the responses from HCIDriver for the tested stacks are the same.
Following up on this lead, I opened the official documentation from ST - AN5270 Rev 16 and responses for all commands shown above should be of type 'Command Complete event' (HCI_COMMAND_COMPLETE_EVENT) because that's where the information needed to initialize the BLE is located. What I receive, which is a 'Command Status event' do not have the required information and, moreover, is not what I should receive according to the documentation. In addition, all the responses I get as 'Command status event' are the same even though the queries through HCIDriver are different.
Want to launch a new BLE stack with mbed-os all commands that returned 'Command Status event' I captured in mbed-os and substituted the data needed for the configuration from a working device with stack 1.2.0. After that, the BLE initialized correctly, even started GATT Server. Although I had successes in the code the device does not broadcast.
2022-11-08 02:30 AM
Hello,
Which type of BLE stack are you using (full, full extended, hci...)? I think you used a BLE stack which didn't support these commands that's why you received HCI_COMMAND_STATUS_EVENT.
Best Regards
2022-11-08 03:31 AM
Hi Remy,
I am using full version of BLE Stack 'stm32wb5x_BLE_Stack_full_fw.bin'. I took into consideration that this version may not support everything, however, the documentation does not describe this in detail. And yet the full name itself says it all, and those queries to HCI that I described are rather basic. Moreover, I use the full version because the BLE_OTA application has been created for this version, which I use as a bootloader to load our application. If I were to attempt to work with the 'full extended' version, I need to have information that these commands actually work with this extended version, and I would need to get help on how to modify the BLE_OTA application to run with the BLE Stack 'full extended' version. I'll give it a try with the 'full extended' version and let you know if I get the answers according to the documentation or as I had before.
Kind regards
Pawel
2022-11-08 06:26 AM
Hello,
To know which application commands interface (ACI) and host commands interface (HCI) are supported according to Bluetooth® LE stack variant, please refer to table 1 of AN5270 and see the link between wireless coprocessor binaries and Bluetooth® LE stack variant in part 1.1 of this wiki page.
In your case, you should use the BLE Full extended to support all the commands you need, you can refer to part 1.3 of the wiki page to see application modification which should be done to use extended binary.
Best Regards
2022-11-10 05:45 AM
Hi Remy,
I did the tests and I already know that the BLE Stack full extended version works correctly with mbed-os 5 and mbed-os 6. The problem with HCI answers was that the full version (not extended) did not support all queries to HCI. However now I have another problem. As I mentioned I use the BLE_OTA application from ST to load my own application. This application, according to the documentation, works only with the stack version full (not extended). I need the full extended version and now need to adapt the BLE_OTA application to this exteded BLE stack version. I found only a few sentences in the 'Release_Notes.html' file from the package 'STM32Cube_FW_WB...'. Below info from release notes file:
'- stm32wb5x_BLE_Stack_full_extended_fw.bin
Warning: To use this binary, it is necessary to adapt the scatter file in the BLE
applications as:
- The RAM_A shared range shall be reduced to memory range [0x20030000:0x200307FF]
- The Mail-box buffers(MB_MEM1, MB_MEM2) shall be located in RAM_B shared defined in memory range [0x20038000:0x2003A7FF]
- The RAM_B shared shall be added to Total_RAM_region'
I tried to customize BLE_OTA according to this description above, but the BLE_OTA application doesn't want to work for me so far with the BLE full_extended stack version.
Kind regards
Pawel
2022-11-10 07:52 AM
Hello,
You can refer to this wiki page which describe the modification which should be done in scatter file to adapt the application to work with BLE Full extended stack. You should modify the BLE_Ota application and your application.
Best Regards