<?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>How can I send hid data with TIMER1_IRQHandler  strict every 8ms?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/1913/how-can-i-send-hid-data-with-timer1_irqhandler-strict-every-8ms</link><description>I find it unstable to send hid data, even if I set timer 1 every 8ms to send hid data. 
 I can catch data bag from wireshark it seems that interval of two data even close to 1ms. 
 How can this happen? 
 but if I set timer every 15ms, it become more</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 19 Mar 2014 12:26:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/1913/how-can-i-send-hid-data-with-timer1_irqhandler-strict-every-8ms" /><item><title>RE: How can I send hid data with TIMER1_IRQHandler  strict every 8ms?</title><link>https://devzone.nordicsemi.com/thread/8230?ContentTypeID=1</link><pubDate>Wed, 19 Mar 2014 12:26:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8f12741-b771-4dc3-ad8f-c085ac6e0d10</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;There&amp;#39;s a bit of chaos in your development process now, as I see it.
You should revert a couple of steps back, and start implementing the radio notification again, and set it up properly.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The connection interval is set by the master. The slave can reject a connection if the master cannot provide the requested limits and disconnect the link, which is most likely what you&amp;#39;re seeing. Try upping your max_conn_interval.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You should setup radio_notification with the desired distance before the event handler is fired (set up in your ble_radio_notification_init function.
Since the handler will be called twice per interval (one before, and one after a interval has happened), you should only send mouse data every other time the radio_notification handler is called.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Slave latency is a part of the bluetooth specification. This allows the slave to skip connection intervals if no new data is to be sent. You can read more about this feature in the Core-spec.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Best regards
Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I send hid data with TIMER1_IRQHandler  strict every 8ms?</title><link>https://devzone.nordicsemi.com/thread/8229?ContentTypeID=1</link><pubDate>Wed, 19 Mar 2014 09:17:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f3b6018-d4a6-41a1-bd3d-d3574e7a7f47</guid><dc:creator>gootoomoon</dc:creator><description>&lt;p&gt;I try code above ,if I set MIN_CONN_INTERVAL  MAX_CONN_INTERVAL the same val I will get error 13 (Operation timed out) when run&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void bond_manager_error_handler(uint32_t nrf_error)
{
    APP_ERROR_HANDLER(nrf_error);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;#define MIN_CONN_INTERVAL               MSEC_TO_UNITS(7.5, UNIT_1_25_MS)            /&lt;strong&gt;&amp;lt; Minimum connection interval (7.5 ms). */
#define MAX_CONN_INTERVAL               MSEC_TO_UNITS(7.5, UNIT_1_25_MS)             /&lt;/strong&gt;&amp;lt; Maximum connection interval (7.5 ms). */&lt;/p&gt;
&lt;p&gt;So how can I set interval to7.5ms or 8ms and send just one package in a interval ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I send hid data with TIMER1_IRQHandler  strict every 8ms?</title><link>https://devzone.nordicsemi.com/thread/8228?ContentTypeID=1</link><pubDate>Wed, 19 Mar 2014 05:07:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aff05ff9-c2bc-47ef-b887-a13c91da0e85</guid><dc:creator>gootoomoon</dc:creator><description>&lt;p&gt;I have search  the &amp;quot;S110_SoftDevice_Specification_v1.2&amp;quot; and find what you said &amp;quot;Radio Notification&amp;quot; on page 14&lt;/p&gt;
&lt;p&gt;And it said that in Table 14,
when t(ndist) =5500, and t(interval) = 7.5 it will send just 1 packet between a  interval&lt;/p&gt;
&lt;p&gt;so I set  CONN_INTERVAL like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
#define MIN_CONN_INTERVAL                MSEC_TO_UNITS(7.5, UNIT_1_25_MS)            
#define MAX_CONN_INTERVAL               MSEC_TO_UNITS(7.5, UNIT_1_25_MS)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But I don&amp;#39;t know where to set    t(ndist)&lt;/p&gt;
&lt;p&gt;In  &amp;quot;static void gap_params_init(void)&amp;quot; I cant find any params of  t(ndist)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL;
    gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL;
    gap_conn_params.slave_latency     = SLAVE_LATENCY;
    gap_conn_params.conn_sup_timeout  = CONN_SUP_TIMEOUT;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And what&amp;#39;s &amp;quot;SLAVE_LATENCY&amp;quot; mean? Where and  how can I use it?&lt;/p&gt;
&lt;p&gt;I just want send 1 packet in one interval(7.5ms) ,&lt;/p&gt;
&lt;p&gt;Does &amp;quot;Radio Notification &amp;quot; will be ACTIVE every 7.5ms when I set  CONN_INTERVAL like above?&lt;/p&gt;
&lt;p&gt;This is the most difficult problem we meet.&lt;/p&gt;
&lt;p&gt;Best regards.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I send hid data with TIMER1_IRQHandler  strict every 8ms?</title><link>https://devzone.nordicsemi.com/thread/8227?ContentTypeID=1</link><pubDate>Tue, 18 Mar 2014 16:09:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:497d2881-a56c-4df3-a181-4bf26a2494fc</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;radio_active states if the connection event has just happened, or is just about to happen. If this is active, then the handler is executed right before a connection interval is to happen.&lt;/p&gt;
&lt;p&gt;you should only push data if radio_active == true (or false).
If you try to push data on both events, you will end up sending twice as many packets.&lt;/p&gt;
&lt;p&gt;-H&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I send hid data with TIMER1_IRQHandler  strict every 8ms?</title><link>https://devzone.nordicsemi.com/thread/8222?ContentTypeID=1</link><pubDate>Tue, 18 Mar 2014 15:20:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac321db1-61c4-46c7-950b-e02bd0e5f1af</guid><dc:creator>gootoomoon</dc:creator><description>&lt;p&gt;I try this code&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void mouse_send_on_radio_active_evt(bool radio_active)
{
          m_radio_active = radio_active;
	  mouse_sensor_send();
}

/**@brief Function for initializing the Radio Notification event.
 */
static void radio_notification_init(void)
{
    uint32_t err_code;


    err_code = ble_radio_notification_init(NRF_APP_PRIORITY_HIGH,
                                           NRF_RADIO_NOTIFICATION_DISTANCE_4560US,
                                           mouse_send_on_radio_active_evt);

  	APP_ERROR_CHECK(err_code);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and try to executed mouse_sensor_send();  before the connection interval occurs but it&amp;#39;s not work as I expected.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I send hid data with TIMER1_IRQHandler  strict every 8ms?</title><link>https://devzone.nordicsemi.com/thread/8226?ContentTypeID=1</link><pubDate>Tue, 18 Mar 2014 15:06:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:babc88df-38c3-494a-a77d-7866c5d3a502</guid><dc:creator>gootoomoon</dc:creator><description>&lt;p&gt;just like       nrf51_sdk_v4_4_2_33551 ?&lt;/p&gt;
&lt;p&gt;init like this&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void radio_notification_init(void)
{
    uint32_t err_code;

    err_code = ble_radio_notification_init(NRF_APP_PRIORITY_HIGH,
                                           NRF_RADIO_NOTIFICATION_DISTANCE_4560US,
                                           ble_flash_on_radio_active_evt);

  	APP_ERROR_CHECK(err_code);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and send data in ble_flash_on_radio_active_evt() ?&lt;/p&gt;
&lt;p&gt;Does ble_flash_on_radio_active_evt()  will be  executed  before the connection interval occurs&lt;/p&gt;
&lt;p&gt;what does&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void ble_flash_on_radio_active_evt(bool radio_active)
{
    m_radio_active = radio_active;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;do?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I send hid data with TIMER1_IRQHandler  strict every 8ms?</title><link>https://devzone.nordicsemi.com/thread/8225?ContentTypeID=1</link><pubDate>Tue, 18 Mar 2014 14:49:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03722c0b-8572-408f-a83d-c370978689ec</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;The library is located here:
C:\Nordic Semiconductor\nRF51 SDK_v5.1.0.36092\Nordic\nrf51822\Source\ble&lt;/p&gt;
&lt;p&gt;Just add it to your project and initialize it, and the handler will then be executed x us before the connection interval occurs.&lt;/p&gt;
&lt;p&gt;-H&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I send hid data with TIMER1_IRQHandler  strict every 8ms?</title><link>https://devzone.nordicsemi.com/thread/8224?ContentTypeID=1</link><pubDate>Tue, 18 Mar 2014 13:47:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:edf9720c-8693-4319-b918-02ea1ac8da98</guid><dc:creator>gootoomoon</dc:creator><description>&lt;p&gt;You mean this?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define MIN_CONN_INTERVAL               MSEC_TO_UNITS(7.5, UNIT_1_25_MS)            /**&amp;lt; Minimum connection interval (7.5 ms). */
#define MAX_CONN_INTERVAL               MSEC_TO_UNITS(15, UNIT_1_25_MS)             /**&amp;lt; Maximum connection interval (15 ms). */

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And I can find &amp;quot;ble_radio_notification&amp;quot; be  used in  nrf51_sdk_v4_4_2_33551\nrf51822\Board\nrf6310\ble\ble_app_hids_mouse  but not in nrf51_sdk_v5_1_0_36092&lt;/p&gt;
&lt;p&gt;where can I receive the radio notification event?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I send hid data with TIMER1_IRQHandler  strict every 8ms?</title><link>https://devzone.nordicsemi.com/thread/8223?ContentTypeID=1</link><pubDate>Tue, 18 Mar 2014 11:35:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9562ea57-5529-4dd8-b610-7db3133f0e77</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You should send mouse-movement each connection interval, not hard code it.
I suspect that your link is not getting a optimal connection interval, which makes the mouse seem sloppy.&lt;/p&gt;
&lt;p&gt;Try:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Check your connection interval, you should have &amp;lt; 15 ms.&lt;/li&gt;
&lt;li&gt;Send mouse data on the radio notification event (setup to happen x us before connection interval occurs) using the ble_radio_notification library&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Best regards
Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>