<?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 S132 ble app gloable variable value loss in timer</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/25140/nrf52832-s132-ble-app-gloable-variable-value-loss-in-timer</link><description>Hi: 
 I am using nrf52832 and I met a strange problem: 
 SDK version: nRF5_SDK_12.2.0_f012efa 
 
 
 First experiment(NO BLE): 
 using example peripheral/timer: 
 code change in main.c as the follows: 
 bool g_timer_Flag = true;

/**
 * @brief</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 15 Sep 2017 12:50:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/25140/nrf52832-s132-ble-app-gloable-variable-value-loss-in-timer" /><item><title>RE: nrf52832 S132 ble app gloable variable value loss in timer</title><link>https://devzone.nordicsemi.com/thread/99030?ContentTypeID=1</link><pubDate>Fri, 15 Sep 2017 12:50:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f30b8543-310e-4de2-8dc9-fb812b758014</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/questions/sort:relevance-desc/query:debug%20softdevice/"&gt;You cannot debug while you have the softdevice enabled&lt;/a&gt;. If you stop at a breakpoint it will break your BLE link and the system will most likely reset. When your system resets in general, it is most likely because a function in your application asserts. Such asserts you can debug &lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/"&gt;like this&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 S132 ble app gloable variable value loss in timer</title><link>https://devzone.nordicsemi.com/thread/99029?ContentTypeID=1</link><pubDate>Thu, 14 Sep 2017 22:56:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d875a653-451e-489f-a708-389608ced628</guid><dc:creator>rc</dc:creator><description>&lt;p&gt;I find that when the breakpoint hit for the first time,press continue, the ble will disconnect and the system restart, so, the value reset to init state true, can you reproduce?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 S132 ble app gloable variable value loss in timer</title><link>https://devzone.nordicsemi.com/thread/99028?ContentTypeID=1</link><pubDate>Wed, 13 Sep 2017 10:45:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f718862-0929-41c7-8ce6-137112f47c47</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure if I understand your issue. You are expecting to hit the break point only once since g_timer_Flag is set to false after the first time? I&amp;#39;m not able to reproduce it. My breakpoint is only hit once even though I transfer several strings, or disconnect and reconnect before transmitting more strings.&lt;/p&gt;
&lt;p&gt;Since nus_data_handler() is called from an interrupt context it might help to declare g_timer_Flag as &lt;a href="https://barrgroup.com/Embedded-Systems/How-To/C-Volatile-Keyword"&gt;&amp;#39;volatile&amp;#39;&lt;/a&gt; though.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>