This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Stellaris Bluetopia Stack Transfer Speed

Hi,

I'm continuing a discussion from another thread.  I have been trying to achieve the 71KB/sec mentioned in the other discussion thread.  I have received information about configuring the blutopia stack's transmit and receive buffer sizes as well as the queued and max packets and how those two relate to each other.

I currently have the following configuration for those variables:

TX Buffer Size: 4000

RX Buffer Size: 6000

Max Packet Size: 1000

Max Data Packets: 6

Queued Data Packets Threshold: 2

Essentially, I have an ADC that I need to transfer 28bytes at 2000 samples per second, or 56KB/sec.  In the previous thread discussion, it was mentioned that internal testing of the Bluetopia stack achieved 71KB/sec.  I have not been able to get past about 47KB/sec.  It seems that the transmit buffer fills up exceedingly fast at this high data rate and causes the data transfer to slow down significantly.

I am using an interrupt driven system (no OS).  I handle the full transmit buffer situation by putting the bytes SPP_Data_Write didn't send back into my buffer.  I then continue to only buffer further data until the transmit buffer empty indication occurs.  By this point though, my buffer is getting pretty full and it seems that SPP can't keep up at this data rate.  I'm not sure what the next step is to get the data out faster.  Any help would be great appreciated.

Thanks,

Eric

Previous Discussion for Reference: http://e2e.ti.com/support/low_power_rf/f/660/p/125308/484108.aspx#484108

 

  • Hello Eric,

    We are trying to reproduce this issue. Is it possible for us to take a look at your Bluetooth related code (maybe pseudo code) ? We will check with TI what the preferred way to exchange files is.

    Best Regards,

    Stonestreet One.

  • For now, I can add some pseudo code for you:

    I need to read data at 2000 SPS from an ADC.  The ADC gives me a data ready interrupt every 500us.  At each interrupt, I copy 28 bytes into a ring buffer.

    About every 10ms, I read all available bytes out of the ring buffer and send them over the SPP connection.  I have pasted the code below with some edits to remove anything specific to my application:

    int bytes_txd = 0;

    DWord_t iTotalBytes;

    Byte_t * packets;    

    /* TX is busy until either all bytes are written or the Transmit Buffer Empty event occurs */

    if(spp_tx_busy)

    {

    return;

    }

    iTotalBytes = RingBufUsed(&packet_buffer);

        if(iTotalBytes == 0)

        {

            return;

        }

     

    packets = (Byte_t*)BTPS_AllocateMemory(iTotalBytes);

    RingBufRead(&packet_buffer, packets, iTotalBytes);

    RingBufFlush(&packet_buffer);

    spp_tx_busy = true;

    /* Transmit data */

    bytes_txd = SPP_Data_Write(BLUETOOTH_STACK_ID, iBTTServerID, iTotalBytes, packets);

    if(bytes_txd != 0)

    {

         if(bytes_txd == iTotalBytes)

         {

         spp_tx_busy = false;

         }

    }

     

    if(iTotalBytes - bytes_txd > 0)

    {

    /* Write Data not sent back to ring buffer */

    RingBufWrite(&packet_buffer, &packets[bytes_txd], iTotalBytes - bytes_txd);

    }

    /* Free packet memory */

    BTPS_FreeMemory(packets);

    As stated above, while collecting data, the code listed is called every 10ms.  If not all data can be sent, I simply write that data back into the buffer which is fine since I flushed it right after the read (not really necessary since I read all of the bytes out of the buffer).  Also note that spp_tx_busy is a static local variable to the .c file containing this function.

    At 250SPS and 500SPS I don't really run into the situation where SPP_Write_Data can't keep up and returns a non zero value.  At 1000SPS, it works at the required data rate, but SPP_Data_Write does get backed up a little bit and I have to wait for some Transmit Buffer Empty Indications.  At 2000SPS, I hit the SPP transmit buffer full situation so quickly and often that the data rate drops off quickly and my local ring buffer fills up to the point where I start losing data.

    Let me know if you have any more questions.  I can get this to occur by removing the ADC from the equation and attempting to send any data at a rate of 56KB/sec.

    Thanks,

    Eric

  • Hi Eric,

    We have now finished writing an application that gives user  more control to do throughput testing. It is undergoing testing at the moment and we should be able to release it to you in 2 days. It is ported for no OS version and should help you resolve your issues. 

    Best Regards,

    Stonestreet One.

  • Hi,

    Has this been released?  If so, where might I find it?

    Thanks,

    Eric

  • Hello Eric,

         We do apologize for the delay. Given the required internal TI process to deliver new apps, we are experiencing a delay. The current estimated date to deliver this sample app is November 4th.  Would that be ok? I am trying to speed up the process. 

    Regards,

    ~Miguel

  • Hi Miguel,

    That is quite far away but I think it will be fine.  Thank you for the update.

    Best,

    Eric

  • Thank you for your patience. I will update this thread as soon as the package is out.

    Regards,

    ~Miguel

  • Hi Eric,

     

    We needed some more information about your setup. What is the remote device that you are connecting to? Do you have any control over the parameters of that device? Is it possible to know the negotiated frame size. We want to make sure that we are able to give a solution and numbers to help you achieve the data rate as the remote side parameters will have an impact on these calculations. Please let us know.

     

    Best Regards,

    Stonestreet One. 

  • My device is talking to a Windows PC application.  I don't believe it has control over anything useful.  In talking with the developer of the application, he has looked around for ways to obtain configuration parameters and/or set them as well as determining the negotiated frame size, but none of that seems readily available from the Windows Bluetooth Stack.  So, unfortunately, other than telling you we are connecting to Windows using SPP, I don't have any more details to provide.

    Eric

     

  • Hi Eric,

    Do you know which stack is used by the Windows PC application? Is it the Microsoft stack?  

    From the traces it looked like you are never able to send more than 768 bytes once you reach the buffer full loop. That felt like the negotiated frame size is smaller and you may not have a lot of credits to send more data and so a bottleneck could arise over there. 

    Have you tried sending it to any other windows application? Stacks would let you set up SPP servers and you can connect to them and try sending data. Just curious to know if you have tried with different applications and have seen any differences.

    (Also wanted to confirm that  you have changed the local parameters before any SPP connection.)

    Best Regards,

    Stonestreet One.

  • I believe it is the Microsoft stack.

    The SPP server is created on the embedded device and the Windows Application connects to the server port.

    I have tried this directly before using PuTTY and another small application I wrote.  All three have had very similar results in their ability to receive data from the SPP Server running on the embedded device.

    So yes, I have tried with other applications.

    Thanks for your continued help on this matter.

    Eric

  • Hi Eric,

    So you are using SPP server on Stellaris that Microsoft stack is connecting to if I understood it correctly. 

    We did a test to check the frame size for a windows stack connecting to an application running on windows and saw that the frame size was 600+.

    I would like to confirm if you changed the parameters on the Stellaris side before registering the server? You can also confirm the parameters by making a call to SPP_Get_Configuration_Parameters. Is it possible for you to confirm the parameters and let us know what these are?  

     

    Best Regards,

     

    Stonestreet One. 

  • Yes, you understood how it works correctly.

    I am changing the parameters before starting the SPP server.

    I have set the parameters to the following values:

    Max Frame Size: 1000

    Transmit Buffer Size: 4000

    Receive Buffer Size: 6000

    Max Data Packets: 6

    Queued Data Packets: 2

    When verifying this, I noticed that they were not getting set correctly.  I have fixed this and it is working correctly now.  Thanks for the help.  I figured it was something easy.

  • Hi Eric,

    When you say it is working correctly, are you referring only to the setting of parameters or are you able to achieve the required data rate?  Hoping for the latter as still unable to reproduce the issue here :)

    Thanks,

    Stonestreet One. 

     

  • The latter.  :)

    Sorry for all the confusion here.  Thanks again for the help.

  • No problem Eric. 

    Sorry for not checking if the parameters were changed successfully earlier. We are happy that the issue is resolved for you, please do not hesitate to contact us if you have any other questions.

    Best Regards,

    Stonestreet One.