<?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>HID and NUS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/44333/hid-and-nus</link><description>Hello, 
 I am attempting to incorporate NUS example (app_uart) into the HID keyboard example. The whole thing compiles with no warning, but when I add {BLE_UUID_NUS_SERVICE, NUS_SERVICE_UUID_TYPE} to m_adv_uuids, the adverstising never starts. I was able</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 Mar 2019 16:57:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/44333/hid-and-nus" /><item><title>RE: HID and NUS</title><link>https://devzone.nordicsemi.com/thread/176287?ContentTypeID=1</link><pubDate>Thu, 14 Mar 2019 16:57:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ceefddf0-0962-46e0-ab25-59c7a1225c0c</guid><dc:creator>Laurent Bourassa</dc:creator><description>&lt;p&gt;Thank you so much for your help. I initiated the NUS service before advertising it, as you said. I had another problem that followed where I did&amp;#39;nt have enough RAM. I was able to change it and now I have successfully implemented NUS with HID. Again, thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HID and NUS</title><link>https://devzone.nordicsemi.com/thread/176154?ContentTypeID=1</link><pubDate>Thu, 14 Mar 2019 11:33:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b217d087-be67-40eb-b1b8-404393b0d151</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I see. Then I assume the problem is that the SoftDevice has not been configured with the custom base UUID. This is done by&amp;nbsp;ble_nus_init(), so this has to be called before you configure the advertisement packet. You can see the same issue with the NUS example from the SDK if you change the order of the calls to&amp;nbsp;services_init() and advertising_init().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HID and NUS</title><link>https://devzone.nordicsemi.com/thread/175490?ContentTypeID=1</link><pubDate>Mon, 11 Mar 2019 21:34:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a2c6f1d-5956-48b5-8c35-67e77b990e2a</guid><dc:creator>Laurent Bourassa</dc:creator><description>&lt;p&gt;Ok, so I went further with the debugger. Inside uuid_list_encode(), there is two calls for the function uuid_list_sized_encode(). In that function, there is a call to another function, sd_ble_uuid_encode() that I&amp;#39;m pretty positive is the source of my problem. Looking in that last function, you see that it returns&amp;nbsp;NRF_ERROR_INVALID_PARAM when the UUID type is invalid.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1552340135461v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You can see that the type for NUS is 0x02 (BLE_UUID_TYPE_VENDOR_BEGIN). Somehow it doesn&amp;#39;t seem to recognize 0x02 as a valid type. I changed it to 0x01 (BLE_UUID_TYPE_BLE) with the debugger and the error was gone, but of course, I know 0x02 should work, normally.&lt;/p&gt;
&lt;p&gt;Now I need help resolving why it doesn&amp;#39;t accept 0x02 as a valid type...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HID and NUS</title><link>https://devzone.nordicsemi.com/thread/175211?ContentTypeID=1</link><pubDate>Sun, 10 Mar 2019 17:27:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7df7d1f-4934-4904-8ca3-c092e5d49b70</guid><dc:creator>Laurent Bourassa</dc:creator><description>&lt;p&gt;Hello Einar, yes, that seems to be the function that returns the error. More specifically, it&amp;#39;s the If Statement that encodes the complete&amp;nbsp;UUID&amp;nbsp;list.&lt;/p&gt;
&lt;p&gt;This statement calls the function&amp;nbsp;uuid_list_encode() so I went further to see what could be the problem. This function is in two parts, one for encoding 16 bits UUIDs and the other for encoding 128 bits&amp;nbsp;UUIDs.&lt;/p&gt;
&lt;p&gt;When encoding my first service, HID, the debugger will enter this function, execute the 16 bits and 128 bits sections with no failure. However, when encoding the NUS service, it enters the same function but fails at the 16 bits encoding and skips over the 128 bits encoding, resulting in the error code 0x07.&lt;/p&gt;
&lt;p&gt;Is there a way to specify which encoding to use for NUS without impacting the encoding for HID?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HID and NUS</title><link>https://devzone.nordicsemi.com/thread/174494?ContentTypeID=1</link><pubDate>Wed, 06 Mar 2019 10:20:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5180773d-48a1-47e3-8233-c5b36df7ebd1</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;OK, so you get&amp;nbsp;NRF_ERROR_INVALID_PARAM returned from&amp;nbsp;ble_advertising_init()? Which SDK are you using?&lt;/p&gt;
&lt;p&gt;Assuming SDK 15.2, this means that the error probably comes from&amp;nbsp;ble_advdata_encode(). That function is responsible for encoding the advertisement packet and is quite easy to understand. Essentially there is an if statement for each field, so you can&amp;nbsp;check with a debugger which fails (which is invalid).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HID and NUS</title><link>https://devzone.nordicsemi.com/thread/174333?ContentTypeID=1</link><pubDate>Tue, 05 Mar 2019 15:16:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6084f096-670b-4032-b50a-f8ef616a89ad</guid><dc:creator>Laurent Bourassa</dc:creator><description>&lt;p&gt;Hello, yes it is still the same error and it is the same function as before that returns it.&lt;/p&gt;
&lt;p&gt;I have shortened the advertising packet as much as I think I could :&lt;/p&gt;
&lt;p&gt;No device name = 0 byte&lt;/p&gt;
&lt;p&gt;-BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE flag = 3 bytes(?)&lt;/p&gt;
&lt;p&gt;-HID = 4 bytes (Altough I have two reports for this profile, could it make it longer? Let&amp;#39;s assume 8)&lt;/p&gt;
&lt;p&gt;-BAS = Not sure about this one, I did not find where it says it is advertised, but I would assume it takes 4 more bytes...&lt;/p&gt;
&lt;p&gt;-NUS = For the sake of testing, I have reduced&amp;nbsp;BLE_NUS_MAX_DATA_LEN to 1. I don&amp;#39;t know if the fact that there is both RX and TX extends the space taken by the NUS, I assume it does. For my application I don&amp;#39;t need TX. (data(1) + manufacturer ID(2) + length(1) + type(2?) = 6 bytes?)&lt;/p&gt;
&lt;p&gt;In total I think that would make 17-21 bytes, no? I must be wrong because if so it should work if it&amp;#39;s under 31 bytes...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HID and NUS</title><link>https://devzone.nordicsemi.com/thread/174296?ContentTypeID=1</link><pubDate>Tue, 05 Mar 2019 14:12:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80109930-58b5-4d4e-9a83-00f38b7b9c53</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Which function returns the error code now? and is it still&amp;nbsp;NRF_ERROR_INVALID_PARAM?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HID and NUS</title><link>https://devzone.nordicsemi.com/thread/174114?ContentTypeID=1</link><pubDate>Tue, 05 Mar 2019 02:26:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41fb1407-f786-4910-91a1-0b98ff971f5a</guid><dc:creator>Laurent Bourassa</dc:creator><description>&lt;p&gt;&lt;span&gt;Sorry, I see now what you mean. I have found out&amp;nbsp;&lt;/span&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/7066/setting-tx_power_level#post-id-37997"&gt;here&lt;/a&gt;&lt;span&gt;&amp;nbsp;what is the advertising packet. I know how to reduce the size taken by my device name, but it&amp;#39;s not enough. I would need to reduce the data field of the NUS, but I&amp;#39;m not sure where to edit that. Probably in ble_nus.h. I will continue to look.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HID and NUS</title><link>https://devzone.nordicsemi.com/thread/174112?ContentTypeID=1</link><pubDate>Tue, 05 Mar 2019 01:57:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:611aa2ab-b4a5-4379-b7cd-f45e77bf917d</guid><dc:creator>Laurent Bourassa</dc:creator><description>&lt;p&gt;Hello, the error code is 0x07, which if I get right is&amp;nbsp;NRF_ERROR_INVALID_PARAM.&amp;nbsp;If I am not mistaken, since the NUS is a vendor defined UUID, it has a length of 128 bits, while the HID has 16 bits, right? I&amp;#39;m not quite sure how I am supposed to merge these two.&lt;/p&gt;
&lt;p&gt;I attempted to replicate the ble_app_uart example where it uses a NUS profile, and temporarily commented out the HID part to see if I could make it work alone, but with no success.&amp;nbsp;When you say &amp;quot;Too much in the advertising packet&amp;quot;, you&amp;#39;re talking about the advertising uuid list, correct?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HID and NUS</title><link>https://devzone.nordicsemi.com/thread/173855?ContentTypeID=1</link><pubDate>Sun, 03 Mar 2019 22:50:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6218d024-eb50-4df0-bb57-fe3d03a113de</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;well you could just debug through to find out where the error is returned or look at the error code to see which one it is. Most likely you&amp;#39;ve put too much in the advertising packet and overfilled it so you&amp;#39;re getting an error that there&amp;#39;s no space.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>