Other Parts Discussed in Thread: MSP430F5438A
Throughput measurement on the current release of Bluetopia on MSP430
To achieve maximum throughput using Bluetopia while receiving data, read the data as soon as the application receives a data indication.
While sending data, write data using SPP_Data_Write as fast as possible. If SPP_Data_Write returns a value less than what you are trying to write, that means the outgoing path is full and the application should wait to write until more buffers are available. The stack will indicate that more space is available using the etPort_Buffer_Empty_Indication event in the SPP callback. Once you receive this event, you can send more data. The user will have to take care to send any unsent bytes in the previous call by using the return code of SPP_Data_Write.
The throughput depends on different parameters.
The first is the set of SPP parameters of RFCOMM frame size, Transmit Buffer and Receive Buffer. The current release has L2CAP MTU capped at a lower value to achieve some RAM targets and so it restricts the RFCOMM frame size to 50.
Note: The next release will have the enhancement to increase this value significantly allowing for better throughput. It is currently undergoing testing.
You can check the current values using GetConfigParams. Type the following in the command prompt
SPP+LE>GetConfigParams
It will return the following.
SPP_Get_Configuration_Parameters(): Success
MaximumFrameSize : 38 (0x26)
TransmitBufferSize : 38 (0x26)
ReceiveBufferSize : 38 (0x26)
You can set these values using SetConfigParams. For example, to set a RFCOMM frame size of 50, Transmit Buffer size of 300 and Receive Buffer size of 500, type the following in the command prompt
SPP+LE>SetConfigParams 50 300 300.
It will return the following.
SPP_Set_Configuration_Parameters(): Success
MaximumFrameSize : 50 (0x32)
TransmitBufferSize : 300 (0x12C)
ReceiveBufferSize : 500 (0x1F4)
You can set the baud rate the SPP is operating at by using the command SetBaudRate. For example to set a baud rate of 921600, type the following in the command prompt
SPP+LE>SetBaudRate 921600
It will return the following.
HCI_Reconfigure_Driver(921600): Success.
You can also try to tweak the UART buffer sizes in file HCITrans.C.
Change the
#define DEFAULT_INPUT_BUFFER_SIZE to 1042 and
#define DEFAULT_OUTPUT_BUFFER_SIZE to 384.
Note: Changing these values may cause the MSP-430 to run out of memory. You can increase the amount of memory allocated by changing the BTPS_MEMORY_BUFFER_SIZE. This option can be found in CCS 5 by going to Project->Properties->Advanced Options->Predefined Symbols. Double click on BTPS_MEMORY_BUFFER_SIZE in the pre-defined names to change it. If you are using IAR, Project->Options->C/C++ Compiler->Preprocessor(Press the arrow button if you can’t see it initially). We set it from 3600 to 9600 and was able to run all of the changes mentioned here. You should be able to set a RFCOMM frame size of 50, Transmit Buffer size of 300 and Receive Buffer size of 300 and have the DEFAULT_INPUT_BUFFER_SIZE and DEFAULT_OUTPUT_BUFFER_SIZE at default values in HCITRANS.C without increasing the memory.
Below is a table that notes some of the throughput values and parameter combinations.
Data Transfer from Sample Application to MSP-430
|
ConfigParams |
BaudRate |
UART Buffer Sizes |
Throughput |
|
50 100 300 |
921600 |
128,64 |
197Kbps |
|
50 100 300 |
460800 |
128,64 |
186Kbps |
|
50 100 300 |
921600 |
1042, 384 |
203Kbps |
|
50 100 300 |
460800 |
1042, 384 |
190Kbps |
|
50 300 300 |
921600 |
128,64 |
203Kbps |
|
50 300 300 |
460800 |
128,64 |
190Kbps |
|
50 300 300 |
921600 |
1042, 384 |
209Kbps |
|
50 300 300 |
460800 |
1042, 384 |
190Kbps |
|
50 300 500 |
921600 |
128,64 |
252Kbps |
|
50 300 500 |
921600 |
1042, 384 |
254Kbps |
Data Transfer from MSP-430 to Sample Application
|
ConfigParams |
BaudRate |
UART Buffer Sizes |
Throughput |
|
50 100 300 |
921600 |
128,64 |
158Kbps |
|
50 100 300 |
460800 |
128,64 |
150Kbps |
|
50 100 300 |
921600 |
1042, 384 |
159Kbps |
|
50 100 300 |
460800 |
1042, 384 |
150Kbps |
|
50 300 300 |
921600 |
128,64 |
198Kbps |
|
50 300 300 |
460800 |
128,64 |
192Kbps |
|
50 300 300 |
921600 |
1042, 384 |
203Kbps |
|
50 300 300 |
460800 |
1042, 384 |
193Kbps |
|
50 300 500 |
921600 |
1042, 384 |
203Kbps |
|
50 300 500 |
460800 |
1042, 384 |
193Kbps |
Any Increase of the transmit buffer beyond 300 doesn’t seem to improve throughput. Increasing the receiver buffer upto 500 improves throughput but doesn’t after 500. Ideally MaximumFrameSize of 50, TransmitBufferSize of 300, ReceiveBufferSize of 500 works for maximum sending and receiving.

