<?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>Copying variables</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/41092/copying-variables</link><description>Hi, 
 I have a strange issue. I am reading values from an accelerometer. The read values go into an array which is uint8 and 7 bytes long. 
 The values are read ok and they exist in the array. When I try to move the individual values to regular uint8</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 03 Dec 2018 13:12:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/41092/copying-variables" /><item><title>RE: Copying variables</title><link>https://devzone.nordicsemi.com/thread/159969?ContentTypeID=1</link><pubDate>Mon, 03 Dec 2018 13:12:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa33631b-9ffe-41b1-aa68-07044383626b</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;It&amp;#39;s the first I have seen of this. Can you modify one of the&amp;nbsp;\nRF5_SDK_15.2.0_9412b96\examples such that I can recreate it here?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Copying variables</title><link>https://devzone.nordicsemi.com/thread/159805?ContentTypeID=1</link><pubDate>Sat, 01 Dec 2018 15:54:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9c6c923-df84-449e-ab58-0b0782649d22</guid><dc:creator>iQd</dc:creator><description>&lt;p&gt;I am having a strange behaviour also elsewhere.&lt;/p&gt;
&lt;p&gt;I make an if conditional:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if (var1 != buffer[1] || var2 != buffer[2] || var3 != buffer[3] || var4 != buffer[4] || var5 != buffer[5] || var6 != buffer[6])
    {
        // do something.
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;var1...var6 are uint8, buffer[x] array is uint8 as well.&lt;br /&gt;Even though the var1...6 variables have the SAME values as the comparison buffer indexes, the code in the if conditional will be run.&lt;/p&gt;
&lt;p&gt;I have tested the above problem and this on three different machines, they work the same way.&lt;/p&gt;
&lt;p&gt;Only if I break this conditional statement into six separate blocks where I compare only one variable to one array index, AND add a 50us delay before that - the code actually works.&lt;/p&gt;
&lt;p&gt;I have entered the Twilight Zone somehow, I cannot even trust a processor run it&amp;#39;s code without random issues.&lt;br /&gt;I tried this also on another Nordic 52832 DK board - same effect.&lt;/p&gt;
&lt;p&gt;What could I have so much wrong that code starts behaving like this?&lt;br /&gt;I get no errors, code compiles normally and runs otherwise ok.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Copying variables</title><link>https://devzone.nordicsemi.com/thread/159766?ContentTypeID=1</link><pubDate>Fri, 30 Nov 2018 17:27:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:944c2cc8-40f5-4355-9004-87fd33e4b379</guid><dc:creator>iQd</dc:creator><description>&lt;p&gt;I tested how low I can go with the delays and still get values copied ok.&lt;/p&gt;
&lt;p&gt;It seems that 5 us is the limit between working code and non-working code.&lt;/p&gt;
&lt;p&gt;If I set the delay to 2 us, only one or two variable values are copied.&lt;br /&gt;Delay of 3 us will make all but the first two variables copied ok.&lt;br /&gt;Delay of 4 us will make only the two last array indexes copied ok.&lt;/p&gt;
&lt;p&gt;When the delay is 5 us, all values are copied ok and the code actually works.&lt;/p&gt;
&lt;p&gt;I have never seen an issue like this, I lose valuable time with this kind of problems that should not even exist.&amp;nbsp;&lt;br /&gt;This is not even the first time this happens with the 52832, I am starting to lose trust in the 52832.&lt;/p&gt;
&lt;p&gt;I had earlier a similar issue where, at startup I set a variable to a certain value, nothing else touches this variable until the main loop.&lt;br /&gt;Then, at the main loop when I check the value, the variable is&amp;nbsp;somehow changed to a different value.&lt;br /&gt;I was able to go around this only by setting the variable to the value I want, two times&amp;nbsp;right before the main loop.&lt;/p&gt;
&lt;p&gt;I am using the Nordic DK board, Segger v3.40 in Windows 7 x64, GNU ARM Embedded Toolchain version 7-2017-q4-major.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>