<?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>mutex updating characteristic value in application memory</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/32805/mutex-updating-characteristic-value-in-application-memory</link><description>When using BLE_GATTS_VLOC_USER to store multi-word characteristic values that are updated by application code, what is the recommended way to prevent a partially updated value being sent to a client? 
 Options I&amp;#39;ve considered include (in decreasing order</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 09 May 2018 10:31:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/32805/mutex-updating-characteristic-value-in-application-memory" /><item><title>RE: mutex updating characteristic value in application memory</title><link>https://devzone.nordicsemi.com/thread/131471?ContentTypeID=1</link><pubDate>Wed, 09 May 2018 10:31:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc3a59ea-4c75-4c5a-a5f3-aae4db9c1a55</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Peter&lt;/p&gt;
&lt;p&gt;You might be able to use timeslots to do what you want.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Request a timeslot long enough to do your data update procedure, and you will know that the SoftDevice is not doing anything for the duration of the timeslot.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t tested it myself though, just a thought ;)&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: mutex updating characteristic value in application memory</title><link>https://devzone.nordicsemi.com/thread/127712?ContentTypeID=1</link><pubDate>Wed, 11 Apr 2018 04:02:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2aec01a-72d2-4795-9d17-e39b281593ce</guid><dc:creator>pabigot</dc:creator><description>&lt;p&gt;Ah.&amp;nbsp; OK, I can see that.&amp;nbsp; So it gives me the protection, but not the features I was actually looking for (eliminated duplicate&amp;nbsp;storage and overhead updating fast-changing values).&amp;nbsp; Disappointing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: mutex updating characteristic value in application memory</title><link>https://devzone.nordicsemi.com/thread/127708?ContentTypeID=1</link><pubDate>Wed, 11 Apr 2018 03:41:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c11d8382-0482-40ae-b1d0-d2f32994bfac</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;it can also be used to update a value in USER RAM, it doesn&amp;#39;t care where the value is, it just updates it. And it does it via a softdevice call which gives you the exact protection you&amp;#39;re looking for.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: mutex updating characteristic value in application memory</title><link>https://devzone.nordicsemi.com/thread/127389?ContentTypeID=1</link><pubDate>Mon, 09 Apr 2018 10:16:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a6e3dec-2007-48e1-b05c-54e9c993b86e</guid><dc:creator>pabigot</dc:creator><description>&lt;p&gt;Isn&amp;#39;t the purpose of&amp;nbsp;sd_ble_gatts_value_set()&amp;nbsp; primarily to update the a BLE_GATTS_VLOC_STACK value that&amp;#39;s in the SD&amp;#39;s RAM? It&amp;#39;s also used when the length of a BLE_GATTS_VLOC_USER value is changed, but that might never happen.&lt;/p&gt;
&lt;p&gt;As I understand it BLE_GATTS_VLOC_USER exists so the values stored in user space can be exposed as characteristics. Several cases where that might be wanted:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;values that are needed in the application in the same form they&amp;#39;re exposed as characteristics don&amp;#39;t have to be duplicated both user and SD RAM (here I&amp;#39;m thinking large structures containing sensor data)&lt;/li&gt;
&lt;li&gt;values that may be rarely read but are frequently updated (e.g. clocks) will always provide the current value without making the application constantly tell the SD &amp;quot;it changed again; it changed again; ...&amp;quot;&lt;/li&gt;
&lt;li&gt;the combination: in my case, a collected set of sensor data where pieces get updated at different times by application code that is decoupled from any communication infrastructure, so can&amp;#39;t easily inform the soft device of exactly which pieces were changed.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;BLE_GATTS_VLOC_USER appears to have a lot of potential, but only if there&amp;#39;s a way to ensure consistency when the soft device dips into the application memory to read the value.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: mutex updating characteristic value in application memory</title><link>https://devzone.nordicsemi.com/thread/127330?ContentTypeID=1</link><pubDate>Mon, 09 Apr 2018 04:54:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c1cecf41-504f-429e-8ba8-97e443b18721</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Pabigot,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Sorry for late response. Wouldn&amp;#39;t using&amp;nbsp;sd_ble_gatts_value_set() is a better way of avoiding the value of the characteristic being accessed when partly updated ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>