<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Advertisement packet too long</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/6722/advertisement-packet-too-long</link><description>Hi, 
 I&amp;#39;m trying to define a new service, and on the GAP settings, I would like to advertise my service, but I get an error message: advertisement packet too long.
What could be the reason? I only have 3 characteristics so far, but I would like to add</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 28 Apr 2015 09:51:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/6722/advertisement-packet-too-long" /><item><title>RE: Advertisement packet too long</title><link>https://devzone.nordicsemi.com/thread/23576?ContentTypeID=1</link><pubDate>Tue, 28 Apr 2015 09:51:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ade2ad7-1297-4c62-9426-3eba8f444f73</guid><dc:creator>CodyTheHun</dc:creator><description>&lt;p&gt;Thanks, I changed my packet to only advertise the main service, and the rest can be discovered after connecting.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advertisement packet too long</title><link>https://devzone.nordicsemi.com/thread/23575?ContentTypeID=1</link><pubDate>Sun, 26 Apr 2015 21:27:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:165eb6ea-7560-4cd5-86d6-32436c4ea7d3</guid><dc:creator>kerem</dc:creator><description>&lt;p&gt;I don&amp;#39;t think you&amp;#39;re supposed to broadcast all characteristics in a BLE packet nor try to fit them in. You should only broadcast what&amp;#39;s really needed, depending on your packet type. It&amp;#39;s probably only one UUID, maybe some major and minor values along with rssi is what you need to broadcast only, say if you&amp;#39;re trying to broadcast an ibeacon packet. Characteristics and services are values that should be read/written after bonding to the peripheral, one at a time. (The limit was 20 bytes per write operation if I&amp;#39;m not wrong).&lt;/p&gt;
&lt;p&gt;You should check your packet length by accounting for the fields, what you put in it, see &lt;a href="https://devzone.nordicsemi.com/question/75/whats-the-maximum-size-for-an-advertisement-package/?answer=76#post-id-76"&gt;Ole&amp;#39;s answer here&lt;/a&gt;. Your advertising packet cannot exceed 31 bytes. There is probably something wrong at the part you&amp;#39;re building it or you&amp;#39;re confused about what you should advertise. Please share that snippet so we can comment on it, instead of assuming.&lt;/p&gt;
&lt;p&gt;A BLE packet being broadcasted over the air is actually 47 bytes in total, but actual payload information you can put in it is limited by the packet&amp;#39;s structure;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;1 byte preamble&lt;/li&gt;
&lt;li&gt;4 byte access address&lt;/li&gt;
&lt;li&gt;2-39 bytes advertising channel PDU&lt;/li&gt;
&lt;li&gt;2 bytes (size and type of payload)&lt;/li&gt;
&lt;li&gt;37 bytes payload&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;37 = 6 bytes (mac address) + 31 bytes (data from your services, characteristics etc., not the service itself)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;3 bytes CRC&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In addition to checking how you build up your fields, you can also sniff your packets and see what&amp;#39;s really in them. If one packet is not enough you can always use the scan response data for an additional 31 bytes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>