- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to send 200 bytes, by doing it 20 bytes at a time. My questions is "How do I know it's OK to send the next 20 bytes?".
Here's what I'm doing. Is this correct?
#define ACCEL_DATA_SIZE 200
// Loaded with data in the Accelerometer interrupt
UINT8 accel_data[ACCEL_DATA_SIZE];
UINT8 i = 0;
while (i < ACCEL_DATA_SIZE) // Keep trying until all samples have been transmitted
{
if (blecm_getAvailableTxBuffers() > 0) // Only send if TX buffers available
{
bleprofile_sendNotification(HDLC_LOOPD_SERVICE_ACCEL_DATA_VALUE, (accel_data + i), 20);
i += 20;
}
}
But for some reason, the device just drops the connection in the middle of the transmission.
Is using "blecm_getAvailableTxBuffers() " the right thing? OR do I have to check or do something else?
Thanks!!
Gil
Solved! Go to Solution.
- Labels:
-
BLE_PROFILE_CFG
-
I2C
-
MasterSlave
-
SDK 2.X
-
WICED Sense
- Tags:
- ble
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK. I've solved the problem.
Upon getting the data in an interrupt handler for a device we use (accelerometer), I was attempting to send the data via Bluetooth from within that same interrupt. I assumed I would have time before the next interrupt happened, but that was not the case.
I changed the schem to just read the data from the FIFO in the accelerometer interrupt and put it in a buffer. The actual sending via BLE is now being done in the fine timer handler, and that works. I used part of the code from the "speed_test" example application.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: BCM20736S - change ATT_MTU
At the link above, there is long_characteristic sample application that has been modified to use characteristics of 208 bytes and and MTU size of 158 bytes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you. I will try to create one for 200 bytes.
But I should be able to send 20 bytes 10 times like I coded, right? Is there any limits? What am I doing wrong?
Thanks,
Gil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK. I've solved the problem.
Upon getting the data in an interrupt handler for a device we use (accelerometer), I was attempting to send the data via Bluetooth from within that same interrupt. I assumed I would have time before the next interrupt happened, but that was not the case.
I changed the schem to just read the data from the FIFO in the accelerometer interrupt and put it in a buffer. The actual sending via BLE is now being done in the fine timer handler, and that works. I used part of the code from the "speed_test" example application.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Excellent news. Thanks for updating the thread with the solution as I imagine this will help others as well.