cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB data throughput issues

Matt Blessinger
Associate III

I have 2 STM32WB nucleo boards I'm using for testing data throughput speed. I'm running the BLE_DataThroughput example application in STM32CubeIDE v1.4.1 with STM32WB firmware v1.8.0.

One board is programmed as the client (central) and the other as the server (peripheral). Out of the box the example works. I can connect to both of them with PuTTY and see they connect to each other quickly. I press button 1 on the server and it starts transferring data to the client and I see the data rate in the client's terminal window. Pressing button 2 changing the PHY from 1 Mbps to 2 Mbps and vice versa.

The problem I'm having is the data rates appear unreliable for 1 Mbps and very slow for 2 Mbps. For 1 Mbps I'm getting this in the terminal. The data rate is all over the place and sometimes it goes up to 96,000 bytes/s. According to the calculations here (https://www.novelbits.io/bluetooth-5-speed-maximum-throughput/), I estimate a max data rate of 97,600 bytes/s for 1 Mbps PHY on BLE 5. So that seems about right but the variability in the data rate is bad.

DT = 30744 bytes/s lost = 0
DT = 22204 bytes/s lost = 0
DT = 43676 bytes/s lost = 0
DT = 42212 bytes/s lost = 0
DT = 67588 bytes/s lost = 0
DT = 28548 bytes/s lost = 0
DT = 68564 bytes/s lost = 0
DT = 58804 bytes/s lost = 0
DT = 27328 bytes/s lost = 0
DT = 50752 bytes/s lost = 0

With the PHY set to 2 Mbps, I get this data rate in the client's terminal. That is extremely low. According to that website the max should be about 172,000 bytes/s.

DT = 2196 bytes/s lost = 0
DT = 2196 bytes/s lost = 0
DT = 1464 bytes/s lost = 0
DT = 2196 bytes/s lost = 0
DT = 2196 bytes/s lost = 0
DT = 1708 bytes/s lost = 0
DT = 2196 bytes/s lost = 0
DT = 2196 bytes/s lost = 0
DT = 2196 bytes/s lost = 0
DT = 2196 bytes/s lost = 0

I then altered the code according to ST's AN5289 section 7.6.5 pasted below. I added to the button 2 callback to set the connection interval to 50ms. I changed DATA_NOTIFICATION_MAX_PACKET_SIZE in app_conf.h to 244. I changed hci_le_set_data_length to be (conn_handle, 251, 2120) in app_ble.c. CFG_BLE_MAX_ATT_MTU is already 250 in app_conf.h and changes upon connection.

0693W000003OmFxQAK.png

When I now press button 2, the server terminal gives this. There is no change in the data rate in the client's terminal window.

change PHY
Read_PHY success
PHY Param  TX= 1, RX= 1
hci_le_set_phy PHY Param  TX= 2, RX= 2
set PHY cmd ok
change conn update to 50ms
BLE_SVC_L2CAP_Conn_Update(), Successfully
EVT_UPDATE_PHY_COMPLETE, success

I don't understand why 1 Mbps transmission is erratic and 2 Mbps is slow. One thing I haven't seen is how many packets are sent per a connection interval and if that is limited for some reason.

My end application is to have the server continuously read from an SPI sensor and transfer to the client as fast as possible.

Thank you for any help!

7 REPLIES 7
Remi QUINTIN
ST Employee

The max throughput is achieved when the connection interval is set to 400ms. The value mentioned in the application note (50ms) is not the right value.

Regarding the low bit rate measured when the PHY is set to 2 Mbps, did you compile your code with 2 modifications in the app_conf.h file.

#define CFG_TX_PHY   2

#define CFG_RX_PHY   2

If not, please try again with these 2 changes and let us know.

in the end, both boards(Central and peripheral) should be close enough to achieve the highest throughput.

The throughput should be the same for both ways (periph-> central and central->periph).

You can check this in the debug trace of the peripheral.

Babu Alikapati
Associate

Dear Remi,

I too have same issue. i had same exercise same as the original post and modified as you suggested. but i didn't see any change in throughput. For PHY = 1 or 2 and any connection interval (7.5ms, 50ms and 400ms) throughput remains same as 32610.

Please let me know how can i see change in throughput.

Best Regards

AB

I have the same issue.

I used the tips from AN5289, but it didn't solve a problem. Throughput remains low for about 20 kbit/s.

Could you please let me know what could be a reason?

Best Regards

Den

Eason WANG
ST Employee

Hi,

I tried the STM32WBCube V1.13.3 and can be got the expected results. 

PHY configed as 1M :

DT = 97200 bytes/s lost = 0 

DT = 96720 bytes/s lost = 0 

DT = 92880 bytes/s lost = 0 

DT = 97680 bytes/s lost = 0 

DT = 92400 bytes/s lost = 0 

PHY condifured as 2M

DT = 171120 bytes/s lost = 0 

DT = 172320 bytes/s lost = 0 

DT = 171120 bytes/s lost = 0 

DT = 172320 bytes/s lost = 0 

DT = 171120 bytes/s lost = 0 

DT = 172320 bytes/s lost = 0 

Kolab
Senior

@Community member​ @Eason WANG​  could you please explain the steps to show those DT values on the gatt server terminal when using a board-smartphone connection?

Kolab
Senior

@Eason WANG​ I'm also using STM32WBCube V1.13.3 on the nucleo board and LightBlue app on the phone. I get these results when writting Hello World to the charasteristic. I find them odd campared to yours.0693W00000aJJQPQA4.png

vijay3
Associate III

hi matt 

i am using stm32wb55 as both server and client i want to send send some strings from client to server it was connected from data throughput example 

i just want to know how to code to send the data from client o server