cancel
Showing results for 
Search instead for 
Did you mean: 

Making STM32WB Discoverable

eleventen
Associate III

I'm working to complete the port of BlueNRG code to the STM32WB. I've gotten everything working up to the point where I make the device discoverable. The WB stack is returning an error, but there's no documentation to explain what this error could mean.

Here's the binary exchange:

# GAP discov  
00000000: 00 00 00 00 00 00 00 00 01 83 fc 0d 00 00 00 00 ........ ........ 
00000010: 00 00 00 00 00 ff ff ff ff ........ . 
#? complete 1 fc83 -> 42 ERR 
00000000: 04 0e 04 01 83 fc 42 00 ......B. 

The first 25 bytes are the command sent to the stack. There are eight bytes of pointers that aren't used, one byte for the message type which is BLE CMD, the two byte command code, one byte payload length, and then the parameters. I'm using all default parameters at this point in order to eliminate possible issues.

The response I get is code 42, which means parameter error. So, if the parameters are all defaults what could the parameter error be? I suppose I must be missing some kind of initialization that must precede this message. It would be really helpful to know what circumstances could cause this parameter error if it isn't the message itself.

Is there documentation to explain how what we need to do to make the WB stack discoverable? Also note that this command, 0xfc83, isn't explicitly documented for the STM32WB. The documentation I've found is among the BlueNRG documentation.

1 REPLY 1
eleventen
Associate III

By cross-checking my BlueNRG code with the HeartRate sample, I found that the culprit was in the GAP_INIT invocation.

The GAP_INIT message has a field called "Enable_Privacy". There is no explanation of this parameter, as far as I can tell. With the BlueNRG, it was acceptable to set this option true (0x01). With the STM32WB, setting it true must either be unsupported, or there may need to be other (or different) setup messages provided to the stack. Changing the "Enable_Privacy" to false (0x00) means that the discoverable message succeeds.