2020-06-28 05:48 AM
TLDR; The current tools for BLE in STM32CubeIDE and STM32CubeMX do not work properly for custom BLE profiles in the STM32WB55. When will the tools support it, and when will the documentation be updated with the current system?
Firstly, I would prefer to raise the following with the ST **Issues** system (referred to README.md in the fw packs), but I can't find it!
I am using the STM32CubeIDE to develop software for a small bluetooth project I am working on using the STM32WB55CGU (1M flash in UFQFPN48 package).
I was running through the STM32WB workshop MOOC (https://www.st.com/content/st_com/en/support/learning/stm32-education/stm32-moocs/STM32WB_workshop_MOOC.html, youtube playlist: https://www.youtube.com/playlist?list=PLnMKNibPkDnGRfqUO1Q_-1nW-tOKfDQbc), which is really good and helpful, UNTIL you get to section 4, "How to modify BLE profile", at which point the whole thing falls apart if you are using any of ST's tools from the last 6 months.
The issues I have observed (thus far) in the Device Configuration Tool (i.e. the CubeMX view in STM32CubeIDE) are as below. As far as I can tell these apply to STM32CubeMX as well.
Version information:
STM32CubeIde version 1.3.1, build 6291_20200406_0752 (UTC)
STM32CubeMX (tested separately), version 5.6.0
STM32Cube MCU Package for STM32Wb Series version 1.7.0 (these issues were also present, and raised, with version 1.5.0 at least)
Issues:
In STM32_WPAN -> BLE Application and Services, if Custom Template is Enabled, several new tabs appear:
BLE Pairing
BLE Advertising
BLE GATT
In the BLE GATT window, you can add new services. As you add a new service, you also get a new tab with the name of the service.
I have no problem with this, and it seems like a good way to approach setting up services. However, this has been present for at least 3 releases of the MCU package and still does not work. There is also literally zero supporting information (that I can find) on these changes. An update of the MOOC would go an awfully long way to making this functionality useful.
In the BLE Advertising tab, it seems to default to everything turned off. By turning bits on, it allows you run the code generation, and creates a variable "ad_data[]" int app_ble.c. This seems to replace the "manuf_data[]" variable used in the P2P server modes, but also used in the MOOC example on modify a BLE profile.
Unfortunately, trying to fill in the various entries on this tab cause the code generation to fail in a couple of different ways:
Looking at the other entries, it looks like the first value (which is valueNotSetted, and "Setted"? Really?) is actually the length of the entry plus 1, so it should be 5 in the CubeMX view, it does show "5" in the LENGTH field, but this doesn't make it into the code.
If you include AD_TYPE_ADVERTISING_INTERVAL, you can't change any of the settings (it is set to CFG_FAST_CONN_ADV_INTERVAL_MAX), the generation process seems to fail completely, although you don't get any outward error messages or feedback: In app_ble.c, 126 empty lines are empty, just after the file header, and the file ends with the following:
/**
* Advertising Data
*/
uint8_t ad_data[21] = {
2, AD_TYPE_TX_POWER_LEVEL, 0x1F /* 6dBm */, //Transmission Power
9, AD_TYPE_COMPLETE_LOCAL_NAME, 'C', 'O', 'R', 'O', 'R', 'I', '0', '1', //Complete name
3, AD_TYPE_APPEARANCE, 0x00, 0x00 /* UNKNOWN_APPEARANCE */,
3, AD_TYPE_ADVERTISING_INTERVAL, 0xA0, 0x
Expression res[2] is undefined on line 902, column 176 in stm32_wpan_ble_app_ble_c.ftl.
The problematic instruction:
----------
==> ${res[2]} [on line 902, column 174 in stm32_wpan_ble_app_ble_c.ftl]
----------
Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression res[2] is undefined on line 902, column 176 in stm32_wpan_ble_app_ble_c.ftl.
at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
at freemarker.core.Expression.getStringValue(Expression.java:118)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:208)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:208)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:208)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:208)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:208)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:208)
at freemarker.core.Environment.process(Environment.java:188)
at freemarker.template.Template.process(Template.java:237)
at com.st.microxplorer.codegenerator.CodeEngine.freemarkerDo(CodeEngine.java:277)
at com.st.microxplorer.codegenerator.CodeEngine.genCode(CodeEngine.java:194)
at com.st.microxplorer.codegenerator.CodeGenerator.generateOutputCode(CodeGenerator.java:3862)
at com.st.microxplorer.codegenerator.CodeGenerator.generateSpecificCode(CodeGenerator.java:3357)
at com.st.microxplorer.codegenerator.CodeGenerator.generateSpecificCodeFile(CodeGenerator.java:1297)
at com.st.microxplorer.codegenerator.CodeGenerator.generateCodeFiles(CodeGenerator.java:1499)
at com.st.microxplorer.codegenerator.CodeGenerator.generateDefaultConfig(CodeGenerator.java:7097)
at com.st.microxplorer.codegenerator.CodeGenerator.generateCode(CodeGenerator.java:1133)
at com.st.microxplorer.plugins.projectmanager.engine.ProjectBuilder.generateCode(ProjectBuilder.java:1768)
at com.st.microxplorer.plugins.projectmanager.engine.ProjectBuilder.createCode(ProjectBuilder.java:1636)
at com.st.microxplorer.plugins.projectmanager.engine.ProjectBuilder.createProject(ProjectBuilder.java:534)
at com.st.microxplorer.plugins.projectmanager.engine.ProjectBuilder.createProject(ProjectBuilder.java:347)
at com.st.microxplorer.plugins.projectmanager.engine.MainProjectManager.startGenerateCode(MainProjectManager.java:1339)
at com.st.microxplorer.plugins.projectmanager.engine.MainProjectManager$3.onCommandEntered(MainProjectManager.java:217)
at com.st.components.util.CommandLineManager$3.run(CommandLineManager.java:150)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Fundamentally, I have two questions:
There are other issues with the BLE setup (e.g. I can't define all 128 bits of a UUID, even I select it), but the above questions are more fundamental I think.
2021-05-30 09:11 PM
Hi,
I'm trying to apply the change that you suggest my device is scannable but I'm not able to connect to it from the ST BLE Sensor android app, I get error status 133.
My code is looking fine, running normally when I stop it, the code is in the sequencer expecting tasks.
I have activate the RTC wake-up tp be able to add the HW_TS_RTC_Wakeup_Handler() call but it's never call.
Do you have any hint to help me ?
Thanks you
Regards
2021-06-01 09:09 PM
I have solves my problem the error was there :
I was suspecting it before, but when you change this parameter and start the debugger it's just not work! you have to physically power off the board, and power on again.
2021-08-16 07:55 AM
Hello,
I am wondering if this workshop will be updated eventually? One year should be enough to do it.