Hi all,
I have modified program in SimpleBLEProject. I am writing 20bytes data to characteristic4 and using counter to check if transmitted data is received in order at the central device and also if there is any missing bytes. Here is a my code for sending 20 bytes. send_File() is called every 100ms using timer.
static uint16 counter=0; //globally declared and initialised
static void send_File(void )
{
uint8 burstData[20] = {0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};
burstData[0] = (counter & 0xFF00)>>8; //MSB of count
burstData[1] = (counter & 0xFF); //LSB of count
counter++;
attHandleValueNoti_t nData;
nData.len = 20;
nData.handle = 20;
osal_memcpy( &nData.pValue, &burstData, 20 );
SimpleProfile_SetParameter( SIMPLEPROFILE_CHAR4,SIMPLEPROFILE_CHAR4_LEN , &nData.pValue );
if(counter >125)
{
counter = 0;
}
}
First 2 bytes(bytes 0 and 1 of burstData[ ]) denotes the count value of the packet being transmitted. Next 18bytes are constant value from 1-18.
I have attached sniffer log for this. Please look into the packets starting from packet no 1506 where peripheral starts counting and sending 20 bytes. As it can be seen in sniffer log for count value starting from{ 0x00(MSB) & 0x00(LSB)} up to count {0x00(MSB) & 0x36(LSB)}, packets are getting transmitted correctly and count is increasing but after that count is not increasing in order. Later, for each 3 counts, count is increamented in order and then count is increamented by 8. this process repeats. Can anyone please confirm if there is problem in processing counter variable or it is due to failure in sending 8 consecutive bytes at constant interval(after each 3 bytes sent).
i am not using "counter" variable for any other process. I have even tried changing variable name.
Every time i reset peripheral, correct consecutive count increment changes.
If anyone can suggest me some other idea to test if there is loss in packet will be highly appreciated. count1.psd
Thanks