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.

Sample lost during continuous transmission at 2 kHz....

Hi,

we are developing an application consisting on connecting one or more (up to seven) Bluetooth modules (based on CC2564B) with a smartphone or tablet with Android O.S.

Each bluetooth module (Sensor Unit) transmits data at 64 kbps (at least) organized in packets of 128 bytes that are sent each 32 ms.

Data are sampled by means od two 16 bit external A/D at 2 kHz.

The application firmware side is based on the SPPDemo example included in the stack documentation.

At this time we are able to discover, connect and start sending data from one sensor unit to the server device (Samsung Galaxy Tab3) and connect up to seven devices at the same time BUT.....

analyzing the recorded data i found that there is 1 missed sample every 32 ms. I think that this is due to the fact that the packet sending (128 bytes) lasts around 750us while i need a sample each 500 us (sampling frequency is 2 kHz).....

Is this observation correct? How can i solve this problem?


There is a way to sample data while sending packet? I noticed that while sendig operation is in progress the default SPPDemo app stops scheduler and also interrupt so it is impossible to sample data during this operation.
If i want to not stop scheduler and interrupt (sampling timer) during the sending packet operation, what is the SPPDemo code that i need to change? there are some risks?

There are other options?

Thanks in advance!

  • Hi,

    I will check and get back to you.

    Regards,
    Gigi Joseph.
  • Giacinto,

    "analyzing the recorded data i found that there is 1 missed sample every 32 ms. I think that this is due to the fact that the packet sending (128 bytes) lasts around 750us while i need a sample each 500 us (sampling frequency is 2 kHz).....

    Is this observation correct? How can i solve this problem?"

    Single slot packets are sent every 1.25 milliseconds, I don't think the duration of tx/rx slot is your issue though. The SPP/RFCOMM protocol requires some overhead for acknowledgments and credits. The throughput capabilities of a connection depend on the type of packets that are used, but with nearly all devices you will see more than enough throughput for what you need, I've estimated your throughput needs at 2000 samples per second * 16 bits per sample = 32000 bits per second. Please see here to get an idea of the throughput capabilities at the SPP layer.

    Try adjusting the parameters documented on that page (UART buffer sizes, baud rate, and SPP configuration parameters) and see if this helps.

    "There is a way to sample data while sending packet? I noticed that while sendig operation is in progress the default SPPDemo app stops scheduler and also interrupt so it is impossible to sample data during this operation.

    If i want to not stop scheduler and interrupt (sampling timer) during the sending packet operation, what is the SPPDemo code that i need to change? there are some risks?

    There are other options?"

    Where do you see that the SPPDemo apps stops the scheduler while sending? The only time the app is stopped while sending is if the UART tx buffer is full. In which case the stack will spin and wait for more room to become available in the buffer while the tx interrupt transmits data. If you are seeing this occur then try increasing your UART tx buffer size in HCITRANS.c.

    Samuel

  • Hi Samuel,

    thanks for your correct and abservations. There was an error in my code and now it is solved