cancel
Showing results for 
Search instead for 
Did you mean: 

Hi, I am using STM32WB55 custom board,

AM.12
Associate III

I have to configure it as a Client. Can please someone help me with the starting guide for the client configuration like how to establish connection with server and how to write attribute to server, everywhere I found only starting guide for server only.

Thank You,

Arief

1 ACCEPTED SOLUTION

Accepted Solutions
Ghofrane GSOURI
ST Employee

Hello @Community member​ 

First let me thank you for posting.

To configure the STM32WB55 as a BLE client using the CubeMX software, you'll need to perform the following steps:

  1. First, you'll need to use the CubeMX tool to configure the necessary peripherals and generate the initial project for your STM32WB55 board. Make sure to enable the BLE module and configure it as a client.
  2. Next, you'll need to use the generated code to establish a connection with the server. You can do this by using the provided BLE stack to scan for available BLE devices and connect to the desired server device.
  3. Once connected, you can use the provided stack to write attributes to the server. Each attribute is represented by a unique handle, and you can use the stack's API to write the value of the attribute to the server.
  4. The stack will also provide a way to check the status of the connection and the current state of the device(client)
  5. In the end of your application use disconnect API provided by stack to disconnect the connection.

0693W00000Y7whmQAB.pngThe process for establishing a connection with a BLE server using a BLE wireless stack will depend on the specific stack you are using, but in general, you will need to perform the following steps:

  1. Initialize the stack by calling the appropriate initialization function. This will typically include configuring the underlying transport (UART, SPI, etc.) and initializing any internal data structures.
  2. Start the stack by calling the appropriate start function. This will typically include starting any underlying protocols (such as the link layer or host controller interface) and setting the device in discovery mode.
  3. Start scanning for nearby devices. This can typically be done by calling a function such as StartScan() and specifying the type of scan (passive or active) and the duration of the scan.
  4. Once the scan is complete, you can retrieve the list of discovered devices by calling a function such as GetDiscoveredDevices(). You can then iterate through the list and connect to the desired server device.
  5. To connect to a specific server device, you can call a function such as Connect() and pass in the address of the server device. The stack should handle the connection process, including initiating the connection request, sending connection parameters, and authenticating the connection.
  6. You should also check for the events or callbacks from stack indicating the status of the connection and take appropriate actions.
  7. Once connected, you can then proceed to write attributes to the server.

Thx

Ghofrane

View solution in original post

4 REPLIES 4
Ghofrane GSOURI
ST Employee

Hello @Community member​ 

First let me thank you for posting.

To configure the STM32WB55 as a BLE client using the CubeMX software, you'll need to perform the following steps:

  1. First, you'll need to use the CubeMX tool to configure the necessary peripherals and generate the initial project for your STM32WB55 board. Make sure to enable the BLE module and configure it as a client.
  2. Next, you'll need to use the generated code to establish a connection with the server. You can do this by using the provided BLE stack to scan for available BLE devices and connect to the desired server device.
  3. Once connected, you can use the provided stack to write attributes to the server. Each attribute is represented by a unique handle, and you can use the stack's API to write the value of the attribute to the server.
  4. The stack will also provide a way to check the status of the connection and the current state of the device(client)
  5. In the end of your application use disconnect API provided by stack to disconnect the connection.

0693W00000Y7whmQAB.pngThe process for establishing a connection with a BLE server using a BLE wireless stack will depend on the specific stack you are using, but in general, you will need to perform the following steps:

  1. Initialize the stack by calling the appropriate initialization function. This will typically include configuring the underlying transport (UART, SPI, etc.) and initializing any internal data structures.
  2. Start the stack by calling the appropriate start function. This will typically include starting any underlying protocols (such as the link layer or host controller interface) and setting the device in discovery mode.
  3. Start scanning for nearby devices. This can typically be done by calling a function such as StartScan() and specifying the type of scan (passive or active) and the duration of the scan.
  4. Once the scan is complete, you can retrieve the list of discovered devices by calling a function such as GetDiscoveredDevices(). You can then iterate through the list and connect to the desired server device.
  5. To connect to a specific server device, you can call a function such as Connect() and pass in the address of the server device. The stack should handle the connection process, including initiating the connection request, sending connection parameters, and authenticating the connection.
  6. You should also check for the events or callbacks from stack indicating the status of the connection and take appropriate actions.
  7. Once connected, you can then proceed to write attributes to the server.

Thx

Ghofrane

AM.12
Associate III

Hi Ghofrane,

Thank you for making me understand the flow.

I have joined the server, once the join is successful after a few sec it enters into HardFault_Handler. I am trying to find out the reason but I didn't get it.

Can you please help me solve this?

Thank you,

Arief

Ghofrane GSOURI
ST Employee

Hello @Community member​ 

Actually it is difficult to determine the specific cause of the HardFault_Handler issue without more information about your code but try to review your code to ensure that there are no memory leaks or buffer overflows that could cause a HardFault.

Make sure that the communication between the STM32WB55 and the server device is working properly by checking the connection parameters and debugging the communication process.

Thx

Ghofrane

AM.12
Associate III

I have just modified the filtering advertised device data and

BleApplicationContext.DeviceServerFound = 0x01;

No other modifications.