<?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>Event vs Interrupt</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/58800/event-vs-interrupt</link><description>Hi All, 
 I am developing a data acquisition system in which my device generates an interrupt for every 5ms upon its data is ready. I store one second long data in local buffer and write it into external flash memory every 1 second. 
 I am bit confused</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 11 Mar 2020 09:22:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/58800/event-vs-interrupt" /><item><title>RE: Event vs Interrupt</title><link>https://devzone.nordicsemi.com/thread/239280?ContentTypeID=1</link><pubDate>Wed, 11 Mar 2020 09:22:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a785e9f3-e336-4b0c-9571-6b69c32fbd98</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Lakshmikanth,&lt;/p&gt;
[quote user="Satyavolu"]Having said that, Do I need to modify hrm_encode() API too for accommodating long measurements&amp;nbsp;?&amp;nbsp;[/quote]
&lt;p&gt;That is up to you. You could also call it repeatedly.&lt;/p&gt;
[quote user="Satyavolu"]Another observation is&amp;nbsp;INITIAL_VALUE_HRM value has been set as &amp;#39;0&amp;quot; in ble_hrs.c not 20. Please confirm.&amp;nbsp;[/quote]
&lt;p&gt;No, it can be any value.&lt;/p&gt;
&lt;p&gt;Please note that when doing these modifications your device will no longer implement the standardized HRM service, so you must also change the UUID to a custom UUID in order for the device to be Bluetooth qualifiable.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Event vs Interrupt</title><link>https://devzone.nordicsemi.com/thread/239199?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 16:49:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecb3ccd9-a609-4f75-bedf-e4c3319fe06e</guid><dc:creator>Lakshmikanth Satyavolu</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;After going through the implementation of&amp;nbsp;&lt;strong&gt;ble_hrs_heart_rate_measurement_send&lt;/strong&gt;&lt;span&gt;&amp;nbsp; and&amp;nbsp;&lt;strong&gt;hrm_encode API,&amp;nbsp;&lt;/strong&gt; I realized those are supporting only uint16_t width heart rate measurement.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Having said that, Do I need to modify hrm_encode() API too for accommodating long measurements&amp;nbsp;?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Another observation is&amp;nbsp;INITIAL_VALUE_HRM value has been set as &amp;#39;0&amp;quot; in ble_hrs.c not 20. Please confirm.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Lakshmikanth.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Event vs Interrupt</title><link>https://devzone.nordicsemi.com/thread/239188?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 16:09:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:39b55edd-0526-4f37-9bd9-27755ee48c1f</guid><dc:creator>Lakshmikanth Satyavolu</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;Perfect. At this point interoperability is not an issue for us. I will try implementing new API for this requirement.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Lakshmikanth&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Event vs Interrupt</title><link>https://devzone.nordicsemi.com/thread/238992?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 08:08:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7717fb9-2f92-4dbc-9a8b-326fc66f1a6f</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="Satyavolu"]To send 20 bytes packet, should I call &lt;strong&gt;ble_hrs_heart_rate_measurement_send&lt;/strong&gt; 10 times with two bytes each??&amp;nbsp;[/quote]
&lt;p&gt;No, that would send shorter packets. But it would be in line with the standardized heart rate service (which is what you want in most products).&lt;/p&gt;
[quote user="Satyavolu"]When ATT_MTU is 23, I think I should be able to send all 23 bytes buffer in one&amp;nbsp;&lt;strong&gt;ble_hrs_heart_rate_measurement_send&lt;/strong&gt;&lt;span&gt;&amp;nbsp;API call. Which is bit confusing for me. Please clarify.&amp;nbsp;&lt;/span&gt;[/quote]
&lt;p&gt;Yes, you could. The only problem is that putting more samples in a long heart rate measurement characteristic, so that you can notify them all at once is not in line with the standard service. If you don&amp;#39;t need to be interoperable with anything not made by yourself, then there is no problem doing this. Referring to SDK 16, the implementation in ble_hrs.c already support a heart rate characteristic length of 20 (INITIAL_VALUE_HRM), so there is no need to modify the characteristic length. The only thing you would need to do was to modify&amp;nbsp;ble_hrs_heart_rate_measurement_send() or make a similar function that takes the input as a pointer and length instead of a&amp;nbsp;uint16_t.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Event vs Interrupt</title><link>https://devzone.nordicsemi.com/thread/238933?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 18:18:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05f35441-97a1-4ccb-ae2c-834b9c8cad83</guid><dc:creator>Lakshmikanth Satyavolu</dc:creator><description>&lt;p&gt;Hi Einar,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Here is my requirement.&lt;/p&gt;
&lt;p&gt;My sensor samples are 3 bytes wide each. I want to encapsulate 6 samples = 18 bytes and 2 bytes header total 20 bytes.&lt;/p&gt;
&lt;p&gt;In &lt;em&gt;&lt;strong&gt;ble_hrs_heart_rate_measurement_send(ble_hrs_t * p_hrs, uint16_t heart_rate)&lt;/strong&gt;&lt;/em&gt;,I guess the parameter heart_rate is the data, which takes two bytes. Correct me if I am wrong. &lt;/p&gt;
&lt;p&gt;To send 20 bytes packet, should I call &lt;strong&gt;ble_hrs_heart_rate_measurement_send&lt;/strong&gt; 10 times with two bytes each??&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When ATT_MTU is 23, I think I should be able to send all 23 bytes buffer in one&amp;nbsp;&lt;strong&gt;ble_hrs_heart_rate_measurement_send&lt;/strong&gt;&lt;span&gt;&amp;nbsp;API call. Which is bit confusing for me. Please clarify.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Lakshmikanth.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Event vs Interrupt</title><link>https://devzone.nordicsemi.com/thread/238857?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 14:03:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b488729-48f9-4be2-b59e-ef428a23b6bc</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Lakshmi,&lt;/p&gt;
[quote user="Satyavolu"]Can you suggest an example application if any, or API to be used for to write into FIFO please?&amp;nbsp;[/quote]
&lt;p&gt;Assuming we are talking about notifications here, just send more notifications, and they will be put in a FIFO in the SoftDevice. This is not something you need to think of, other than handling a full FIFO, where you get&amp;nbsp;NRF_ERROR_RESOURCES returned from the call to sd_ble_gatts_hvx().&lt;/p&gt;
&lt;p&gt;If this does not answer your question, then please elaborate exactly what you want (remembering that there is no more than one ATT packet in a single LL packet, as mentioned before).&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Event vs Interrupt</title><link>https://devzone.nordicsemi.com/thread/238803?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 12:47:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd35100a-3430-42af-9f7e-9d6669ea72d1</guid><dc:creator>Lakshmikanth Satyavolu</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Einar Thorsrud&lt;/p&gt;
&lt;p&gt;Can you suggest an example application if any, or API to be used for to write into FIFO please?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Lakshmi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Event vs Interrupt</title><link>https://devzone.nordicsemi.com/thread/238724?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 08:11:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5dd60fc3-f446-4744-accc-2e2cddd9df0c</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Lakshmi,&lt;/p&gt;
[quote user="Satyavolu"]Assuming default ATT_MTU 23 bytes has been set in this example, how to send a 20bytes packet in one shot?[/quote]
&lt;p&gt;In that case, you would need to send all this data in one notification. This is because even though an ATT&amp;nbsp;packet can span multiple link layer (LL) packets, there cannot be multiple ATT packets in a single LL packet. But if you do that, your device will not comply with the Heart Rate Profile. So I suspect a better solution is to send several notifications and use a configuration that allows multiple packets per connection event if you really need to get the data simultaneously. It will give you a bit more overhead (unless interoperability is irrelevant for your application).&lt;/p&gt;
[quote user="Satyavolu"]Is there any internal FIFO available in BLE stack to fill the data to be continuously sent in 20bytes chunks or more by setting ATT_MTU to its max value? Because I have to send real time data continuously. But I am not sure how to use&amp;nbsp;&lt;em&gt;&lt;strong&gt;ble_hrs_heart_rate_measurement_send &lt;/strong&gt;&lt;/em&gt;API to achieve this.&amp;nbsp;[/quote]
&lt;p&gt;There is a FIFO of &lt;em&gt;LL packets&lt;/em&gt;, so if you fill it with several packets, it will be sent in one connection interval if there is time (and there are no retransmissions).&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Event vs Interrupt</title><link>https://devzone.nordicsemi.com/thread/238639?ContentTypeID=1</link><pubDate>Sat, 07 Mar 2020 12:33:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:900a93c3-d603-495d-bfe5-c619be0766f9</guid><dc:creator>Lakshmikanth Satyavolu</dc:creator><description>&lt;p&gt;Hi Einar Thorsrud,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for the information. It was very useful to get started.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Currently&amp;nbsp; I am using heartrate application. I have below queries.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In this application,&amp;nbsp;&amp;nbsp;&lt;em&gt;&lt;strong&gt;ble_hrs_heart_rate_measurement_send(&amp;amp;m_hrs, heart_rate)&amp;nbsp;&lt;/strong&gt;&lt;/em&gt; is used to send the measurement to the central. But it seems it is sending only two byte value (which is &lt;strong&gt;heart_rate&lt;/strong&gt; parameter in this case)when each time it gets called.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But my application needs to send more data for each time the heartrate_timer expires.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Assuming default ATT_MTU 23 bytes has been set in this example, how to send a 20bytes packet in one shot?&lt;/p&gt;
&lt;p&gt;Is there any internal FIFO available in BLE stack to fill the data to be continuously sent in 20bytes chunks or more by setting ATT_MTU to its max value? Because I have to send real time data continuously. But I am not sure how to use&amp;nbsp;&lt;em&gt;&lt;strong&gt;ble_hrs_heart_rate_measurement_send &lt;/strong&gt;&lt;/em&gt;API to achieve this.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please help me.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Lakshmi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Event vs Interrupt</title><link>https://devzone.nordicsemi.com/thread/238613?ContentTypeID=1</link><pubDate>Fri, 06 Mar 2020 18:23:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a017bedc-d2a8-4fe9-a7ba-7e1502165bcb</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Laskhmi,&lt;/p&gt;
[quote user=""]My interrupt is generated every&amp;nbsp; 5ms infinitely, and I cannot afford any single interrupt to lose. I would like to know how can I configure my interrupt handling mechanism to avoid data loss?&amp;nbsp;[/quote]
&lt;p&gt;5 ms is quite a long time, so it should not be a problem to ensure that you never miss any of these interrupts. However, it might be that the interrupt processing is delayed a bit, but that may not be a problem? You can refer to the &lt;a href="https://infocenter.nordicsemi.com/topic/sds_s132/SDS/s1xx/processor_avail_interrupt_latency/processor_avail_interrupt_latency.html"&gt;Interrupt model and processor availability&lt;/a&gt;&amp;nbsp;in the SoftDevice documentation to see the maximum time the SoftDevice will delay the application, and as you see that is in any case significantly less, giving you a lot of margin.&lt;/p&gt;
[quote user=""]If I use PPI with Timer to count the interrupts I have missed from my peripheral, how can I retrieve data from my device at later point?&amp;nbsp;[/quote]
&lt;p&gt;That depends on the peripheral. But I do not see this a&amp;nbsp;likely problem since the frequency of the interrupt is so slow.&amp;nbsp;&lt;/p&gt;
[quote user=""]What is a softdevice? how it can interrupt the application?&amp;nbsp;[/quote]
&lt;p&gt;A SoftDevice is Nordic&amp;#39;s proprietary BLE stack. It needs to have the highest interrupt priority since Bluetooth has strict timing requirements, and several low-level radio interrupts need to be serviced in a timely manner.&lt;/p&gt;
[quote user=""]I need some help understanding event. Previously i was using a processor where any GPIO can be configured for external interrupts which is very straight forward. In nRF it seems there is no interrupt concept for GPIO rather they call it as event.&amp;nbsp;[/quote]
&lt;p&gt;You can think of interrupts and events in the same way. When the application gets a. SoftDevice event, it is actually a software interrupt. And when there is a pin change interrupt form a GPIO, the SDK driver you typically use will have it&amp;#39;s interrupted routine run, and this will call the applications event handler in the interrupt context. So it is in practice the same. (If you look at the terms used in the ARM documentation, you will also see interrupts and events used. In this case, it is also essentially the same, but some minimal differences. In the nRF peripheral HW context, the difference is bigger, since you can have HW events that trigger interrupts or not, depending on the configuration. But that is probably not relevant for your question in this case.)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>