Need help in understanding the eddystone project

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
DhDa_2432241
Level 5
Level 5
5 likes given First like received First like given

Hello,
I am using CYBLE-012011 eval board and I have successfully transmitted beacons by making necessary changes to the eddyStone project for PSoC-4-BLE.
In eddyStone.c --> ConfigureAdvPacket(bool isPacketRegular), 

   
    

/* Service Data */
cyBle_discoveryData.advData[7] = 0x0E; /* Length */
cyBle_discoveryData.advData[8] = 0x16; /* Service Data */
cyBle_discoveryData.advData[9] = 0xAA; /* LSB - Eddystone Service */
cyBle_discoveryData.advData[10] = 0xFE; /* MSB - Eddystone Service */
cyBle_discoveryData.advData[11] = 0x10; /* Signifies Eddystone URL */
cyBle_discoveryData.advData[12] = 0xF2; /* Ranging data: -14dB*/
cyBle_discoveryData.advData[13] = 0x00; /* URL scheme- http://www. */
cyBle_discoveryData.advData[14] = 0x63; /* Encoded URL - 'c' */
cyBle_discoveryData.advData[15] = 0x79; /* Encoded URL - 'y' */
cyBle_discoveryData.advData[16] = 0x70; /* Encoded URL - 'p' */
cyBle_discoveryData.advData[17] = 0x72; /* Encoded URL - 'r' */
cyBle_discoveryData.advData[18] = 0x65; /* Encoded URL - 'e' */
cyBle_discoveryData.advData[19] = 0x73; /* Encoded URL - 's' */
cyBle_discoveryData.advData[20] = 0x73; /* Encoded URL - 's' */
cyBle_discoveryData.advData[21] = 0x00; /* Expansion - .com */
/* ADV packet length */
cyBle_discoveryData.advDataLen = 28;
 

   
   

After beaconing this shows in LOCATE android app as

URL in APP:
http://www.cypress.com/ (Eddystone-URL)

   

When I add more data and increase the cyBle_discoveryData.advDataLen accordingly, I am not able to see the entire data in the beacon URL. Say if I want to transmit a data Len of 28,

I have added more 's' characters from array index [22] to [26] and set index [27] to 0x00

cyBle_discoveryData.advDataLen = 28;

   

​URL in APP:
http://www.cypresss (Eddystone-URL)

I am missing data from array index [22]. What am I doing wrong? Are there any other flags which I should modify?

Thanks
Dheeraj

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Yes, E.pratt is correct.

   

For ex, figure in the ppt shows the adv data structure.

   

And cyBle_discoverData.advDataLen indicates the complete adv data length.

   

Thanks,
Anjana

View solution in original post

0 Likes
8 Replies
Anonymous
Not applicable

cyBle_discoveryData.advData[7] = 0x0E; /* Length */

   

Needs to be set to the length of data you are sending, so the value will need to change accordingly.

0 Likes

Got it. I thought that cyBle_discoveryData.advData[7] is the length of the service data(not including my data).

In the original example, service data is from index [0] to [13] which is 14 bytes(0xE)

​cyBle_discoveryData.advData[7]  = 0x0E;  // WHY? Shouldn't it be 8 bytes? Data is from [14] to [21]
The packet length is specified in cyBle_discoverData.advDataLen which is 22 bytes. 

Also with cyBle_discoveryData.advDataLen field set, I am getting random characters in my URL

 

0 Likes
Anonymous
Not applicable

cyBle_discoveryData.advData[7]  is the length of all bytes associated with the service being transmitted, which includes both the header flag bytes ([8],[9],[10],[11],[12],[13]).

   

cyBle_discoverData.advDataLen is the length of physical bytes to send over the radio (size of everything in the .advData[] array), whereas the .advData[7] field is the length of data/bytes following the length field (.advData[7]) which should be associated with this service (Null-delimiter is application-level, not byte level, and hence you need to be adjusting the lengths to match the data.)

   

If you aren't using the structure/array instance pointing to the correct data, then the default structure will probably contain invalid data. If you want more specifics, posting the project would help 🙂

0 Likes
lock attach
Attachments are accessible only for community members.

Hello,
Sorry I missed your reply. 

   
    


cyBle_discoveryData.advData[7]  is the length of all bytes associated with the service being transmitted, which includes both the header flag bytes ([8],[9],[10],[11],[12],[13]).

   
   

 So this indicates that this is only associated with service data and not the user data, which means it will be always 0xE. (for index 0 till 13).

   
    

cyBle_discoverData.advDataLen is the length of physical bytes to send over the radio (size of everything in the .advData[] array)

   
   

This means cyBle_discoveryData.advDataLen the total bytes from cyBle_discoveryData.advData[0] till the byte holding 0x00 which is .com char. I did follow this and I am still missing data. Please find my project in the attachments. 

Thanks
Dheeraj 

0 Likes
lock attach
Attachments are accessible only for community members.
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Yes, E.pratt is correct.

   

For ex, figure in the ppt shows the adv data structure.

   

And cyBle_discoverData.advDataLen indicates the complete adv data length.

   

Thanks,
Anjana

0 Likes
Anonymous
Not applicable

From what I can tell, it looks like you aren't setting the first 3 bytes of the advertisement packet. These need to be:

   

Length of Flags: 0x02

   

Flags data type value: 0x01

   

Flags data 0x06

   

​(Flags data type and flags data may be different than the values listed above, but you still need to set them correctly).

   

 

   

EDIT: The length byte of the "Service Data" is incorrect, it is set to "0x0E", but it should be set to "0x12" to fully list all of the service data.

0 Likes

Hello Pratt,

   

This line tells that flags are untouched. I couldn't find any code(at least in the application) setting [0], [1], [2] fields in the eddystone project. Okay so service data includes headers and the user payload. I got confused as I thought service data is only the first 14 bytes. I understood now. 

   

Thanks
Dheeraj

0 Likes
Anonymous
Not applicable

Ah, yes. They are setting the flag bytes in the BLE component.

   

The best way I've seen to understand the advertisement packet formats is to use the BLE component to add services graphically to the payload, and then see what the data shows/how it changes. Then, once you understand how each of the bytes works, you can manipulate them for your own use in code.