<?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 crashing when writing to an array</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/52969/nrf52832-crashing-when-writing-to-an-array</link><description>Hi Everyone, 
 I am having problems writing to an array in NRF52832 without causing the program crashing at run time. 
 I declare the array to be 512 uint8_t long 
 
 then I copy data into the array using FlashPageRead, which reads a page from the NAND</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 08 Oct 2019 11:29:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/52969/nrf52832-crashing-when-writing-to-an-array" /><item><title>RE: NRF52832 crashing when writing to an array</title><link>https://devzone.nordicsemi.com/thread/213887?ContentTypeID=1</link><pubDate>Tue, 08 Oct 2019 11:29:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32900b69-76b8-4b3e-8786-5e552ac0197e</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There is not much information to go on here. You write that your code is stuck in the loop waiting for&amp;nbsp;err to be 0, and that is returned from a function called&amp;nbsp;FlashPageRead() which you have not posted. Please provide more information and code so that we can better understand what is happening.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52832 crashing when writing to an array</title><link>https://devzone.nordicsemi.com/thread/213640?ContentTypeID=1</link><pubDate>Mon, 07 Oct 2019 12:02:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d6a4c57-e48a-4d16-9782-5904b53e0502</guid><dc:creator>bryanhsieh</dc:creator><description>&lt;p&gt;I am not using RTOS, but just J-Link RTT which doesnt seem to give any errors, not too sure if there is an option related to system errors that I could enable, can only see peripheral related debugging.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To verify the error, I changed the array size one by one till I got the system to work. I tried debugging it but I couldn&amp;#39;t get anything useful out of it. The debugger just hangs on the while( err != 0 ); line as shown by the CMP in disassembly, even though its value is 0.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1570449769329v1.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52832 crashing when writing to an array</title><link>https://devzone.nordicsemi.com/thread/213631?ContentTypeID=1</link><pubDate>Mon, 07 Oct 2019 11:43:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b176eb9-de7a-43f7-9ab9-5c8730bb6fd2</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;A post on debugging nRF crashes:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/10729/my-device-is-freezing-and-restarting"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/10729/my-device-is-freezing-and-restarting&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52832 crashing when writing to an array</title><link>https://devzone.nordicsemi.com/thread/213628?ContentTypeID=1</link><pubDate>Mon, 07 Oct 2019 11:33:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9200b21-8869-419c-ad58-f488b569b374</guid><dc:creator>awneil</dc:creator><description>[quote userid="23740" url="~/f/nordic-q-a/52969/nrf52832-crashing-when-writing-to-an-array"]I suspect to be memory out of bounds exception[/quote]
&lt;p&gt;So what debugging have you done to verify if that actually is the case ?&lt;/p&gt;
&lt;p&gt;Are you using an RTOS or something? There isn&amp;#39;t a &amp;quot;&lt;span&gt;memory out of bounds exception&amp;quot; as such on the Cortex-M4.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But you could be causing a buffer overrun, leading to memory corruption - which, in turn, could cause stuff to crash.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you use a &amp;#39;Debug&amp;#39; build configuration, do you get any useful logs ?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>