Maximum attribute length

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

cross mob
ArTc_3305816
Level 2
Level 2
5 likes given First like given

Hi

I'm having an issue with Bluetooth transmission where my program is erroring out after the 20th iteration. I found out the setting max_attr_len in the file wiced_app_cfg.c.

The default value is 20. when changing this setting, there is no change in the behavior of my code. on the 20th iteration the system is throwing WICED_BT_GATT_CONGESTED once followed by WICED_BT_GATT_INTERNAL_ERROR for the rest of the loop.

I noticed that in the comment section there is a reference to gki_cfg which I am not able to locate in any of the files.

Has anyone had to deal with this issue before?

Thank you for your time and assistance.

0 Likes
1 Solution

Hello,

Max attribute length / Max MTU size decides on how much data can be send on single transmission . In your case it's not about the data size, its about how frequently you are sending the data . I think that was expected behavior. Too many Notification data cannot be sent quickly enough.

You need to monitor congestion event(congested or cleared). If congested, you need to stop sending and wait congestion clear.

In application layer,

Can you try a work around. Application should do two things

1. monitor GATT_CONGEST_EVT.  ( Refer wiced_bt_gatt.h file)

This event will have this struct data.

typedef struct

{

  uint16_t conn_id; /**< ID of the connection */

  wiced_bool_t congested; /**< congestion state */

} wiced_bt_gatt_congestion_event_t;

If you receive "congested = true", please do not send BLE data.

Once congestion is removed, GATT_CONGEST_EVT event with "congested = FALSE" will be generated and forwarded to application.

2. Check return value of wiced_bt_gatt_send_notification()

As you already done, please check return value of wiced_bt_gatt_send_notification function.

If you got congested error, please wait uncongestion event.

Can you try this method and see ?

Thanks,
Anjana

View solution in original post

3 Replies
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

The max_attr_len is the max length for the attribute packet. It should not cause the error.

Could you share your project or some logs?

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

Hi

Please find attached my project.

0 Likes

Hello,

Max attribute length / Max MTU size decides on how much data can be send on single transmission . In your case it's not about the data size, its about how frequently you are sending the data . I think that was expected behavior. Too many Notification data cannot be sent quickly enough.

You need to monitor congestion event(congested or cleared). If congested, you need to stop sending and wait congestion clear.

In application layer,

Can you try a work around. Application should do two things

1. monitor GATT_CONGEST_EVT.  ( Refer wiced_bt_gatt.h file)

This event will have this struct data.

typedef struct

{

  uint16_t conn_id; /**< ID of the connection */

  wiced_bool_t congested; /**< congestion state */

} wiced_bt_gatt_congestion_event_t;

If you receive "congested = true", please do not send BLE data.

Once congestion is removed, GATT_CONGEST_EVT event with "congested = FALSE" will be generated and forwarded to application.

2. Check return value of wiced_bt_gatt_send_notification()

As you already done, please check return value of wiced_bt_gatt_send_notification function.

If you got congested error, please wait uncongestion event.

Can you try this method and see ?

Thanks,
Anjana