Can't transmit maximum length advertising packet

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
6 posts / 0 new
Last post
mark.bloechl
Offline
Last seen:1 year 7 months ago
加入:2015-12-09 16:33
Can't transmit maximum length advertising packet

I'm trying to transmit a max length (31B) advertising packet. With the 3 mandatory bytes for advertising flags, it seems like I should be able to transmit 28 bytes of my own, but when I try to send more than 26 it doesn't work--it doesn't seem to be advertising at all. The weird thing is that when I receive the 26B advertisement on a DA14580 configured as a central, I can see the end of my data (\x06\x01) and then space for the two spare bytes in the buffer, but when I increase my advertisement to 27 or 28 bytes I get nothing.
Here's what I have for my 26B advertisement:
#define USER_ADVERTISE_DATA "\x19\xff\x31\x01\x97\x30\xcf\x43\xea\x36\x00\x12\x34\x56\x78\x92\x01\x02\x02\x02\x02\x00\x00\x00\x06\x01"
To try 28B I just added two 'ff' bytes (and increased the field length byte):
#define USER_ADVERTISE_DATA "\x1b\xff\x31\x01\x97\x30\xcf\x43\xea\x36\x00\x12\x34\x56\x78\x92\x01\x02\x02\x02\x02\x00\x00\x00\x06\x01\xff\xff"

Device:
STS_Dialog(未验证)
Hi mark.bloechl,

Hi mark.bloechl,

The 2 scenarios have been checked and worked fine, please give me more informaton what do you mean " configured as a central"?You set the DA14580 as central?

Thanks,

STS_DIalog.

mark.bloechl
Offline
Last seen:1 year 7 months ago
加入:2015-12-09 16:33
Hi,

Hi,

I have 2 DA14580's: one configured as a peripheral and one as a central. The code for both was taken from the DSPS example project. When I try to advertise more than 26 user bytes from the peripheral-configured unit and receive it on the central-configured unit, it does not work. When I'm at 26 bytes or below, it does. The only difference between the two instances is the size of USER_ADVERTISE_DATA. I don't believe the unit is advertising at all when I set the advertisement length to >26B, though, because I can't see it on a phone either.

Thanks!
Mark

MHv_Dialog
Offline
Last seen:2 months 3 weeks ago
工作人员
加入:2013-12-06 15:10
Hi Mark,

Hi Mark,

的DA14580 stack automatically prepends the advertising data with 3 bytes for flags (length+type+flags = 3 bytes) which then leaves you with only 28 bytes remaining. For the remaining data you need at least 2 bytes to indicate payload length and advertise data type. This leaves you with 26 bytes of payload.

It is possible to prevent the stack from adding the 3 bytes for flags by implementing a work around deep inside the SDK, but the Bluetooth specification dictates that you must have the flags in your advertisement when your peripheral is connectable. If you really need to control all 31bytes in your advertising, I can provide the workaround.

/MHv

mark.bloechl
Offline
Last seen:1 year 7 months ago
加入:2015-12-09 16:33
The length and data type

The length and data type fields were included in my advertisement strings (i.e. when I said 26 bytes that was 1B length + 1B type + 24B payload, ditto for the 28 byte string).

MHv_Dialog
Offline
Last seen:2 months 3 weeks ago
工作人员
加入:2013-12-06 15:10
Sorry for not reading your

Sorry for not reading your post carefully.

I just copied your 28byte string into a clean extraction of the SDK504 (empty peripheral template project) and it advertises the entire string without issues.

/// Advertising service data
/// Advertising AD type flags, shall not be set in advertising data
#define USER_ADVERTISE_DATA "\x1b\xff\x31\x01\x97\x30\xcf\x43\xea\x36\x00\x12\x34\x56\x78\x92\x01\x02\x02\x02\x02\x00\x00\x00\x06\x01\xff\xff"

/// Advertising data length - maximum 28 bytes, 3 bytes are reserved to set
#define USER_ADVERTISE_DATA_LEN (sizeof(USER_ADVERTISE_DATA)-1)

/MHv