EZ-Serial Creating New GATT Service and associated characteristics

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

cross mob
Anonymous
Not applicable

Hi There,

I've been using the EZ-Serial module (PSoC4) for testing my platform and it has been amazing. Of late I've run into a road block while trying to create a custom GATT service and associated characteristics. I use binary mode for transacting and here are the list of commands that I sent and the responses I got.

sending command to add local service -

['0xc0', '0x19', '0x5', '0x1', '0x0', '0x28', '0x1', '0x0', '0x0', '0x0', '0x0', '0x10', '0x0', '0x0L', '0xb1L', '0xcL', '0x20L', '0x0L', '0x8L', '0x9aL', '0x9eL', '0xe2L', '0x11L', '0x15L', '0xa1L', '0x44L', '0x44L', '0x44L', '0x55L']

gatts_create_attr attr response --

['0xc0', '0x6', '0x5', '0x1', '0x10', '0x1', '0x1e', '0x0', '0x8', '0x0', '0x9c']

validity =  0x8 -- Indicates I need a characteristic definition

sending command to add local chr --

['0xc0', '0x19', '0x5', '0x1', '0x3', '0x28', '0x1', '0x0', '0x12', '0x0', '0x0', '0x10', '0x0', '0x1L', '0xb1L', '0xcL', '0x20L', '0x0L', '0x8L', '0x9aL', '0x9eL', '0xe2L', '0x11L', '0x15L', '0xa1L', '0x44L', '0x44L', '0x44L', '0x55L']

gatts_create_attr attr response --

['0xc0', '0x6', '0x5', '0x1', '0x10', '0x1', '0x1e', '0x0', '0xd', '0x0', '0xa1']

validity =  0xd  -- Indicates invalid attribute length

sending command to add local chr value attr --

['0xc0', '0xb', '0x5', '0x1', '0x1', '0x0', '0x1', '0x1', '0x12', '0x14', '0x0', '0x0', '0x0', '0x0', '0x0']

gatts_create_attr attr response --

['0xc0', '0x6', '0x5', '0x1', '0x10', '0x1', '0x1e', '0x0', '0x8', '0x0', '0x9c']

validity =  0x8

sending command to add local chr cccd attr --

['0xc0', '0xb', '0x5', '0x1', '0x2', '0x29', '0x1', '0x1', '0xa', '0x2', '0x0', '0x0', '0x0', '0x0', '0x0']

gatts_create_attr attr response --

['0xc0', '0x6', '0x5', '0x1', '0x10', '0x1', '0x1e', '0x0', '0x8', '0x0', '0x9c']

validity =  0x8

sending command to add local chr (second characteristic) --

['0xc0', '0x19', '0x5', '0x1', '0x3', '0x28', '0x1', '0x0', '0x6', '0x0', '0x0', '0x10', '0x0', '0x2L', '0xb1L', '0xcL', '0x20L', '0x0L', '0x8L', '0x9aL', '0x9eL', '0xe2L', '0x11L', '0x15L', '0xa1L', '0x44L', '0x44L', '0x44L', '0x55L']

gatts_create_attr attr response --

['0xc0', '0x6', '0x5', '0x1', '0x10', '0x1', '0x1e', '0x0', '0xd', '0x0', '0xa1']

validity =  0xd

sending command to add local chr value attr --

['0xc0', '0xb', '0x5', '0x1', '0x1', '0x0', '0x1', '0x1', '0x6', '0x14', '0x0', '0x0', '0x0', '0x0', '0x0']

gatts_create_attr attr response --

['0xc0', '0x6', '0x5', '0x1', '0x10', '0x1', '0x1e', '0x0', '0x8', '0x0', '0x9c']

validity =  0x8

-----

As you can see, I'm trying to follow pretty much the same template that the dump_db command tells me to, but still looks like somewhere the system is not happy with what I'm sending. The error on invalid attribute length while defining a new characteristic also occurs if I use the /CAC command (text mode).

My requirements -- create one service and two characteristics. On one characteristic, I want to send out notifications and want to receive data from a connected client on the other.

It will be great if you can help me resolve this issue.

Thanks.

Saranyan.

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

The root cause is the parameter l is not set in customer’s binary command data.

Please do following in text mode or binary mode and refer attached picture by CySmart.

/cac,t=2800,r=1,w=0,c=0,l=0010,d=0000b10c2000089a9ee21115a1444444

[C0 19 05 01 00 28 01 00 00 10 00 10 00 00 00 B1 0C 20 00 08 9A 9E E2 11 15 A1 44 44 44 53]

/cac,t=2803,r=1,w=0,c=12,l=0010,d=0100b10c2000089a9ee21115a1444444

[C0 19 05 01 03 28 01 00 12 10 00 10 00 01 00 B1 0C 20 00 08 9A 9E E2 11 15 A1 44 44 44 69]

/cac,t=0000,r=0,w=1,c=12,l=0014,d=

[C0 09 05 01 00 00 00 01 12 14 00 00 00 8F]

/cac,t=2900,r=1,w=1,c=a,l=0002,d=

[C0 09 05 01 00 29 01 01 0A 02 00 00 00 9F]

/cac,t=2803,r=1,w=0,c=12,l=0010,d=0200b10c2000089a9ee21115a1444444

[C0 19 05 01 03 28 01 00 12 10 00 10 00 02 00 B1 0C 20 00 08 9A 9E E2 11 15 A1 44 44 44 6A]

/cac,t=0000,r=0,w=1,c=6,l=0014,d=

[C0 09 05 01 00 00 00 01 06 14 00 00 00 83]

/cac,t=2900,r=1,w=1,c=a,l=0002,d=

[C0 09 05 01 00 29 01 01 0A 02 00 00 00 9F]

View solution in original post

0 Likes
6 Replies
Anonymous
Not applicable

If every single command you send is coming back with an "invalid" response, then either your first command (or setup command before what you posted) is incorrect, or there is something incorrectly configured. I would think that following the dump_db example exactly would work at least for some of the commands if not all.

0 Likes
Anonymous
Not applicable

No, the first response is correct. The validity code is 0x08, indicating that characteristic definition is needed. This is the right response. But it is from the characteristic declaration that I have issues. The validity indicates that the supplied attribute length is invalid. But there is no length needed as per the document. So that's why I went ahead with the other attr definitions and yet kept getting invalid messages.

In fact I did follow the dump_db example to the tee.

If you someone could help, it will be great.

Thanks.

Saranyan.

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

The root cause is the parameter l is not set in customer’s binary command data.

Please do following in text mode or binary mode and refer attached picture by CySmart.

/cac,t=2800,r=1,w=0,c=0,l=0010,d=0000b10c2000089a9ee21115a1444444

[C0 19 05 01 00 28 01 00 00 10 00 10 00 00 00 B1 0C 20 00 08 9A 9E E2 11 15 A1 44 44 44 53]

/cac,t=2803,r=1,w=0,c=12,l=0010,d=0100b10c2000089a9ee21115a1444444

[C0 19 05 01 03 28 01 00 12 10 00 10 00 01 00 B1 0C 20 00 08 9A 9E E2 11 15 A1 44 44 44 69]

/cac,t=0000,r=0,w=1,c=12,l=0014,d=

[C0 09 05 01 00 00 00 01 12 14 00 00 00 8F]

/cac,t=2900,r=1,w=1,c=a,l=0002,d=

[C0 09 05 01 00 29 01 01 0A 02 00 00 00 9F]

/cac,t=2803,r=1,w=0,c=12,l=0010,d=0200b10c2000089a9ee21115a1444444

[C0 19 05 01 03 28 01 00 12 10 00 10 00 02 00 B1 0C 20 00 08 9A 9E E2 11 15 A1 44 44 44 6A]

/cac,t=0000,r=0,w=1,c=6,l=0014,d=

[C0 09 05 01 00 00 00 01 06 14 00 00 00 83]

/cac,t=2900,r=1,w=1,c=a,l=0002,d=

[C0 09 05 01 00 29 01 01 0A 02 00 00 00 9F]

0 Likes
Anonymous
Not applicable

Hi Madhu, i tried your solution, but it still does not work. Please take a look at what I'm sending now --

sending command to add local service

['0xc0', '0x19', '0x5', '0x1', '0x0', '0x28', '0x1', '0x0', '0x0', '0x10', '0x0', '0x10', '0x0', '0x0L', '0xb1L', '0xcL', '0x20L', '0x0L', '0x8L', '0x9aL', '0x9eL', '0xe2L', '0x11L', '0x15L', '0xa1L', '0x44L', '0x44L', '0x44L', '0x55L']

response --

['0xc0', '0x6', '0x5', '0x1', '0x10', '0x1', '0x1e', '0x0', '0x8', '0x0', '0x9c']

validity =  0x8

sending command to add local chr

['0xc0', '0x19', '0x5', '0x1', '0x3', '0x28', '0x1', '0x0', '0x12', '0x10', '0x0', '0x10', '0x0', '0x1L', '0xb1L', '0xcL', '0x20L', '0x0L', '0x8L', '0x9aL', '0x9eL', '0xe2L', '0x11L', '0x15L', '0xa1L', '0x44L', '0x44L', '0x44L', '0x55L']

response --

['0xc0', '0x6', '0x5', '0x1', '0x10', '0x1', '0x1e', '0x0', '0xd', '0x0', '0xa1']

validity =  0xd

sending attr 0x0000

['0xc0', '0x9', '0x5', '0x1', '0x0', '0x0', '0x0', '0x1', '0x12', '0x14', '0x0', '0x0', '0x0']

response --

['0xc0', '0x6', '0x5', '0x1', '0x10', '0x1', '0x1e', '0x0', '0x8', '0x0', '0x9c']

validity =  0x8

sending attr 2900

['0xc0', '0x9', '0x5', '0x1', '0x0', '0x29', '0x1', '0x1', '0xa', '0x2', '0x0', '0x0', '0x0']

response --

['0xc0', '0x6', '0x5', '0x1', '0x10', '0x1', '0x1e', '0x0', '0x8', '0x0', '0x9c']

validity =  0x8

adding the second characteristic

['0xc0', '0x19', '0x5', '0x1', '0x3', '0x28', '0x1', '0x0', '0x12', '0x10', '0x0', '0x10', '0x0', '0x2L', '0xb1L', '0xcL', '0x20L', '0x0L', '0x8L', '0x9aL', '0x9eL', '0xe2L', '0x11L', '0x15L', '0xa1L', '0x44L', '0x44L', '0x44L', '0x55L']

response --

['0xc0', '0x6', '0x5', '0x1', '0x10', '0x1', '0x1e', '0x0', '0xd', '0x0', '0xa1']

validity =  0xd

sending attr 0x0000

['0xc0', '0x9', '0x5', '0x1', '0x0', '0x0', '0x0', '0x1', '0x6', '0x14', '0x0', '0x0', '0x0']

response --

['0xc0', '0x6', '0x5', '0x1', '0x10', '0x1', '0x1e', '0x0', '0x8', '0x0', '0x9c']

validity =  0x8

sending attr 0x2900

['0xc0', '0x9', '0x5', '0x1', '0x0', '0x29', '0x1', '0x1', '0xa', '0x2', '0x0', '0x0', '0x0']

response --

['0xc0', '0x6', '0x5', '0x1', '0x10', '0x1', '0x1e', '0x0', '0x8', '0x0', '0x9c']

validity =  0x8

I did send the length parameter earlier too, but from your reponse, two things emerged. The length parameter is 0x0010 for both characteristic and service declarations. Earlier, these used to be 0x0000. And secondly, the length for the longuinta is unnecessary for attribute declarations. I did all these, yet I'm getting errors. Will be great if you can help.

Thanks.

Saranyan.

0 Likes
Anonymous
Not applicable

Hi Saranyan,

were you ever able to solve this problem? Following Madhu's step, I was still also unsuccessful in adding my characteristic. What is quite interesting to me though is that I have another module where I was able to add a characteristic without issue. Sorry to revive and old post, it just seems as though this one wasn't completely solved?

0 Likes
Anonymous
Not applicable

Just incase anyone runs into this problem, it seems that on the board I was experiencing this issue, it had firmware 1.0.2 loaded on it, and so the API for creating attributes is slightly different from what it currently is... at least I'm pretty sure this is what the problem was.

0 Likes