<?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>Nrf52832 resets after implementing Advanced buttons as HID device</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/34216/nrf52832-resets-after-implementing-advanced-buttons-as-hid-device</link><description>I added the corresponding function in ble_app_hids_mouse in the ble_app_template project, and added the function to send Advanced buttons, as shown in the following program, but each time I press the button to call the function mouse_media_key_send(MM_KEY_VOL_UP</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 16 May 2018 14:04:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/34216/nrf52832-resets-after-implementing-advanced-buttons-as-hid-device" /><item><title>RE: Nrf52832 resets after implementing Advanced buttons as HID device</title><link>https://devzone.nordicsemi.com/thread/132306?ContentTypeID=1</link><pubDate>Wed, 16 May 2018 14:04:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7573b62e-04ea-4b23-a74a-f4373b14138a</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sorry for the late reply. Have you set the optimization level to &amp;#39;0&amp;#39;? Debugging code with high optimization isn&amp;#39;t always straight-forward.&lt;/p&gt;
&lt;p&gt;Could you try setting a breakpoint at any instance of NVIC_SystemReset in your code?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf52832 resets after implementing Advanced buttons as HID device</title><link>https://devzone.nordicsemi.com/thread/131728?ContentTypeID=1</link><pubDate>Fri, 11 May 2018 14:04:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f53e3aef-8ab3-4ddc-a75e-58875720f836</guid><dc:creator>Jim</dc:creator><description>&lt;p&gt;I have added DEBUG, but without any errors, i treset directly&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf52832 resets after implementing Advanced buttons as HID device</title><link>https://devzone.nordicsemi.com/thread/131712?ContentTypeID=1</link><pubDate>Fri, 11 May 2018 12:39:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4fb691da-3e5b-440f-a9ca-931808c120f7</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;All your indexes and IDs look good.&lt;/p&gt;
&lt;p&gt;Could you check the err_code return and see where it fails? This can be done by adding &amp;quot;DEBUG&amp;quot; to your preprocessor defines, and then you should end up in the app_error_handler (and file/err_code/line_number can be read out in m_error variable).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf52832 resets after implementing Advanced buttons as HID device</title><link>https://devzone.nordicsemi.com/thread/131694?ContentTypeID=1</link><pubDate>Fri, 11 May 2018 10:31:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b74cd59c-0d05-4997-8bd4-723321bfbf79</guid><dc:creator>Jim</dc:creator><description>&lt;p&gt;I still don&amp;#39;t quite understand what you mean. The following are the settings in my program. How do I modify it? Thank you very much.&lt;/p&gt;
&lt;p&gt;#define INPUT_REP_BUTTONS_INDEX 0 /**&amp;lt; Index of Mouse Input Report containing button data. */&lt;br /&gt;#define INPUT_REP_MOVEMENT_INDEX 1 /**&amp;lt; Index of Mouse Input Report containing movement data. */&lt;br /&gt;#define INPUT_REP_MPLAYER_INDEX 2 /**&amp;lt; Index of Mouse Input Report containing media player data. */&lt;br /&gt;#define INPUT_REP_REF_BUTTONS_ID 1 /**&amp;lt; Id of reference to Mouse Input Report containing button data. */&lt;br /&gt;#define INPUT_REP_REF_MOVEMENT_ID 2 /**&amp;lt; Id of reference to Mouse Input Report containing movement data. */&lt;br /&gt;#define INPUT_REP_REF_MPLAYER_ID 3 /**&amp;lt; Id of reference to Mouse Input Report containing media player data. */&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;static void hids_init(void)&lt;br /&gt;{&lt;br /&gt; ret_code_t err_code;&lt;br /&gt; ble_hids_init_t hids_init_obj;&lt;br /&gt; ble_hids_inp_rep_init_t inp_rep_array[INPUT_REPORT_COUNT];&lt;br /&gt; ble_hids_inp_rep_init_t * p_input_report;&lt;br /&gt; uint8_t hid_info_flags;&lt;/p&gt;
&lt;p&gt;static uint8_t rep_map_data[] =&lt;br /&gt; {&lt;/p&gt;
&lt;p&gt;0x05, 0x01, // Usage Page (Generic Desktop)&lt;/p&gt;
&lt;p&gt;0x09, 0x02, // Usage (Mouse)&lt;/p&gt;
&lt;p&gt;0xA1, 0x01, // Collection (Application)&lt;/p&gt;
&lt;p&gt;// Report ID 1: Mouse buttons + scroll/pan&lt;br /&gt; 0x85, 0x01, // Report Id 1&lt;br /&gt; 0x09, 0x01, // Usage (Pointer)&lt;br /&gt; 0xA1, 0x00, // Collection (Physical)&lt;br /&gt; 0x95, 0x05, // Report Count (3)&lt;br /&gt; 0x75, 0x01, // Report Size (1)&lt;br /&gt; 0x05, 0x09, // Usage Page (Buttons)&lt;br /&gt; 0x19, 0x01, // Usage Minimum (01)&lt;br /&gt; 0x29, 0x05, // Usage Maximum (05)&lt;br /&gt; 0x15, 0x00, // Logical Minimum (0)&lt;br /&gt; 0x25, 0x01, // Logical Maximum (1)&lt;br /&gt; 0x81, 0x02, // Input (Data, Variable, Absolute)&lt;br /&gt; 0x95, 0x01, // Report Count (1)&lt;br /&gt; 0x75, 0x03, // Report Size (3)&lt;br /&gt; 0x81, 0x01, // Input (Constant) for padding&lt;br /&gt; 0x75, 0x08, // Report Size (8)&lt;br /&gt; 0x95, 0x01, // Report Count (1)&lt;br /&gt; 0x05, 0x01, // Usage Page (Generic Desktop)&lt;br /&gt; 0x09, 0x38, // Usage (Wheel)&lt;br /&gt; 0x15, 0x81, // Logical Minimum (-127)&lt;br /&gt; 0x25, 0x7F, // Logical Maximum (127)&lt;br /&gt; 0x81, 0x06, // Input (Data, Variable, Relative)&lt;br /&gt; 0x05, 0x0C, // Usage Page (Consumer)&lt;br /&gt; 0x0A, 0x38, 0x02, // Usage (AC Pan)&lt;br /&gt; 0x95, 0x01, // Report Count (1)&lt;br /&gt; 0x81, 0x06, // Input (Data,Value,Relative,Bit Field)&lt;br /&gt; 0xC0, // End Collection (Physical)&lt;/p&gt;
&lt;p&gt;// Report ID 2: Mouse motion&lt;br /&gt; 0x85, 0x02, // Report Id 2&lt;br /&gt; 0x09, 0x01, // Usage (Pointer)&lt;br /&gt; 0xA1, 0x00, // Collection (Physical)&lt;br /&gt; 0x75, 0x0C, // Report Size (12)&lt;br /&gt; 0x95, 0x02, // Report Count (2)&lt;br /&gt; 0x05, 0x01, // Usage Page (Generic Desktop)&lt;br /&gt; 0x09, 0x30, // Usage (X)&lt;br /&gt; 0x09, 0x31, // Usage (Y)&lt;br /&gt; 0x16, 0x01, 0xF8, // Logical maximum (2047)&lt;br /&gt; 0x26, 0xFF, 0x07, // Logical minimum (-2047)&lt;br /&gt; 0x81, 0x06, // Input (Data, Variable, Relative)&lt;br /&gt; 0xC0, // End Collection (Physical)&lt;br /&gt; 0xC0, // End Collection (Application)&lt;/p&gt;
&lt;p&gt;// Report ID 3: Advanced buttons&lt;br /&gt; 0x05, 0x0C, // Usage Page (Consumer)&lt;br /&gt; 0x09, 0x01, // Usage (Consumer Control)&lt;br /&gt; 0xA1, 0x01, // Collection (Application)&lt;br /&gt; 0x85, 0x03, // Report Id (3)&lt;br /&gt; 0x15, 0x00, // Logical minimum (0)&lt;br /&gt; 0x25, 0x01, // Logical maximum (1)&lt;br /&gt; 0x75, 0x01, // Report Size (1)&lt;br /&gt; 0x95, 0x01, // Report Count (1)&lt;/p&gt;
&lt;p&gt;0x09, 0xCD, // Usage (Play/Pause)&lt;br /&gt; 0x81, 0x06, // Input (Data,Value,Relative,Bit Field)&lt;br /&gt; 0x0A, 0x83, 0x01, // Usage (AL Consumer Control Configuration)&lt;br /&gt; 0x81, 0x06, // Input (Data,Value,Relative,Bit Field)&lt;br /&gt; 0x09, 0xB5, // Usage (Scan Next Track)&lt;br /&gt; 0x81, 0x06, // Input (Data,Value,Relative,Bit Field)&lt;br /&gt; 0x09, 0xB6, // Usage (Scan Previous Track)&lt;br /&gt; 0x81, 0x06, // Input (Data,Value,Relative,Bit Field)&lt;/p&gt;
&lt;p&gt;0x09, 0xEA, // Usage (Volume Down)&lt;br /&gt; 0x81, 0x06, // Input (Data,Value,Relative,Bit Field)&lt;br /&gt; 0x09, 0xE9, // Usage (Volume Up)&lt;br /&gt; 0x81, 0x06, // Input (Data,Value,Relative,Bit Field)&lt;br /&gt; 0x0A, 0x25, 0x02, // Usage (AC Forward)&lt;br /&gt; 0x81, 0x06, // Input (Data,Value,Relative,Bit Field)&lt;br /&gt; 0x0A, 0x24, 0x02, // Usage (AC Back)&lt;br /&gt; 0x81, 0x06, // Input (Data,Value,Relative,Bit Field)&lt;br /&gt; 0xC0 // End Collection&lt;br /&gt; };&lt;/p&gt;
&lt;p&gt;memset(inp_rep_array, 0, sizeof(inp_rep_array));&lt;br /&gt; // Initialize HID Service.&lt;br /&gt; p_input_report = &amp;amp;inp_rep_array[INPUT_REP_BUTTONS_INDEX];&lt;br /&gt; p_input_report-&amp;gt;max_len = INPUT_REP_BUTTONS_LEN;&lt;br /&gt; p_input_report-&amp;gt;rep_ref.report_id = INPUT_REP_REF_BUTTONS_ID;&lt;br /&gt; p_input_report-&amp;gt;rep_ref.report_type = BLE_HIDS_REP_TYPE_INPUT;&lt;/p&gt;
&lt;p&gt;BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&amp;amp;p_input_report-&amp;gt;security_mode.cccd_write_perm);&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&amp;amp;p_input_report-&amp;gt;security_mode.read_perm);&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&amp;amp;p_input_report-&amp;gt;security_mode.write_perm);&lt;/p&gt;
&lt;p&gt;//鼠标上的滑轮&lt;br /&gt; p_input_report = &amp;amp;inp_rep_array[INPUT_REP_MOVEMENT_INDEX];&lt;br /&gt; p_input_report-&amp;gt;max_len = INPUT_REP_MOVEMENT_LEN;&lt;br /&gt; p_input_report-&amp;gt;rep_ref.report_id = INPUT_REP_REF_MOVEMENT_ID;&lt;br /&gt; p_input_report-&amp;gt;rep_ref.report_type = BLE_HIDS_REP_TYPE_INPUT;&lt;/p&gt;
&lt;p&gt;BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&amp;amp;p_input_report-&amp;gt;security_mode.cccd_write_perm);&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&amp;amp;p_input_report-&amp;gt;security_mode.read_perm);&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&amp;amp;p_input_report-&amp;gt;security_mode.write_perm);&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; p_input_report = &amp;amp;inp_rep_array[INPUT_REP_MPLAYER_INDEX];&lt;br /&gt; p_input_report-&amp;gt;max_len = INPUT_REP_MEDIA_PLAYER_LEN;&lt;br /&gt; p_input_report-&amp;gt;rep_ref.report_id = INPUT_REP_REF_MPLAYER_ID;&lt;br /&gt; p_input_report-&amp;gt;rep_ref.report_type = BLE_HIDS_REP_TYPE_INPUT;&lt;/p&gt;
&lt;p&gt;BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&amp;amp;p_input_report-&amp;gt;security_mode.cccd_write_perm);&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&amp;amp;p_input_report-&amp;gt;security_mode.read_perm);&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&amp;amp;p_input_report-&amp;gt;security_mode.write_perm);&lt;/p&gt;
&lt;p&gt;hid_info_flags = HID_INFO_FLAG_REMOTE_WAKE_MSK | HID_INFO_FLAG_NORMALLY_CONNECTABLE_MSK;&lt;/p&gt;
&lt;p&gt;memset(&amp;amp;hids_init_obj, 0, sizeof(hids_init_obj));&lt;/p&gt;
&lt;p&gt;hids_init_obj.evt_handler = on_hids_evt;&lt;br /&gt; hids_init_obj.error_handler = service_error_handler;&lt;br /&gt; hids_init_obj.is_kb = false;&lt;br /&gt; hids_init_obj.is_mouse = true;&lt;br /&gt; hids_init_obj.inp_rep_count = INPUT_REPORT_COUNT;&lt;br /&gt; hids_init_obj.p_inp_rep_array = inp_rep_array;&lt;br /&gt; hids_init_obj.outp_rep_count = 0;&lt;br /&gt; hids_init_obj.p_outp_rep_array = NULL;&lt;br /&gt; hids_init_obj.feature_rep_count = 0;&lt;br /&gt; hids_init_obj.p_feature_rep_array = NULL;&lt;br /&gt; hids_init_obj.rep_map.data_len = sizeof(rep_map_data);&lt;br /&gt; hids_init_obj.rep_map.p_data = rep_map_data;&lt;br /&gt; hids_init_obj.hid_information.bcd_hid = BASE_USB_HID_SPEC_VERSION;&lt;br /&gt; hids_init_obj.hid_information.b_country_code = 0;&lt;br /&gt; hids_init_obj.hid_information.flags = hid_info_flags;&lt;br /&gt; hids_init_obj.included_services_count = 0;&lt;br /&gt; hids_init_obj.p_included_services_array = NULL;&lt;/p&gt;
&lt;p&gt;BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&amp;amp;hids_init_obj.rep_map.security_mode.read_perm);&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&amp;amp;hids_init_obj.rep_map.security_mode.write_perm);&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&amp;amp;hids_init_obj.hid_information.security_mode.read_perm);&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&amp;amp;hids_init_obj.hid_information.security_mode.write_perm);&lt;/p&gt;
&lt;p&gt;BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&lt;br /&gt; &amp;amp;hids_init_obj.security_mode_boot_mouse_inp_rep.cccd_write_perm);&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&lt;br /&gt; &amp;amp;hids_init_obj.security_mode_boot_mouse_inp_rep.read_perm);&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&lt;br /&gt; &amp;amp;hids_init_obj.security_mode_boot_mouse_inp_rep.write_perm);&lt;/p&gt;
&lt;p&gt;BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&amp;amp;hids_init_obj.security_mode_protocol.read_perm);&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&amp;amp;hids_init_obj.security_mode_protocol.write_perm);&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&amp;amp;hids_init_obj.security_mode_ctrl_point.read_perm);&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&amp;amp;hids_init_obj.security_mode_ctrl_point.write_perm);&lt;/p&gt;
&lt;p&gt;err_code = ble_hids_init(&amp;amp;m_hids, &amp;amp;hids_init_obj);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;br /&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf52832 resets after implementing Advanced buttons as HID device</title><link>https://devzone.nordicsemi.com/thread/131688?ContentTypeID=1</link><pubDate>Fri, 11 May 2018 10:09:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1871676-dbc2-4d4a-8b77-335963f7fd85</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Jim,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What is the value of the index&amp;#39;es and REPORT_IDs?&lt;/p&gt;
&lt;p&gt;USB REPORT_IDs (set in main.c::hids_init()) cannot be explicitly set to &amp;#39;0&amp;#39;, and need to start at 1 and upwards.&lt;/p&gt;
&lt;p&gt;However, in BLE-context, you should start at 0, so you need to separate these:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define INPUT_REP_BUTTONS_INDEX         0                                           /**&amp;lt; Index of Mouse Input Report containing button data. */
#define INPUT_REP_MOVEMENT_INDEX        1                                           /**&amp;lt; Index of Mouse Input Report containing movement data. */
#define INPUT_REP_MPLAYER_INDEX         2                                           /**&amp;lt; Index of Mouse Input Report containing media player data. */
#define INPUT_REP_REF_BUTTONS_ID        1                                           /**&amp;lt; Id of reference to Mouse Input Report containing button data. */
#define INPUT_REP_REF_MOVEMENT_ID       2                                           /**&amp;lt; Id of reference to Mouse Input Report containing movement data. */
#define INPUT_REP_REF_MPLAYER_ID        3                                           /**&amp;lt; Id of reference to Mouse Input Report containing media player data. */
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>