<?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>Testing Flash and RAM</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/71882/testing-flash-and-ram</link><description>Hello, 
 I want to run a memory test whenever my device nrf52832 starts up to check for various faults like stuck at, transition and other faults in both flash and RAM. Does the CRC in flash check all the flash blocks including the .txt one or does it</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 02 Mar 2021 05:41:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/71882/testing-flash-and-ram" /><item><title>RE: Testing Flash and RAM</title><link>https://devzone.nordicsemi.com/thread/297034?ContentTypeID=1</link><pubDate>Tue, 02 Mar 2021 05:41:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d14163cc-9810-408c-9dd2-10b5e539be5d</guid><dc:creator>Charan</dc:creator><description>&lt;p&gt;Inside the nrf_dfu_bank0_start_addr, it uses the&amp;nbsp;MBR_SIZE parameter. I am not having any bootloader and hence, I don&amp;#39;t want to use MBR as well. What should to&amp;nbsp;SD_SIZE_GET()?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing Flash and RAM</title><link>https://devzone.nordicsemi.com/thread/296873?ContentTypeID=1</link><pubDate>Mon, 01 Mar 2021 14:01:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f4d816b-449f-464e-b003-7d98eb039013</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I can&amp;#39;t see anything in the crc_compute() that is DFU related, no. Give it a go, and let me know if it doesn&amp;#39;t work.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing Flash and RAM</title><link>https://devzone.nordicsemi.com/thread/296787?ContentTypeID=1</link><pubDate>Mon, 01 Mar 2021 09:59:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4115daf8-24bb-48c0-bc01-7b5050dd4452</guid><dc:creator>Charan</dc:creator><description>[quote userid="26071" url="~/f/nordic-q-a/71882/testing-flash-and-ram/296774#296774"]Where bank0_start_addr() is the start address of the applictaion (after the softdevice), and image_size is the size of the application.[/quote]
&lt;p&gt;Ok. Great. Thanks!!&lt;/p&gt;
&lt;p&gt;This is irrespective of whether I have bootloader or not right?&lt;br /&gt;I had seen this previously but since it had DFU in it, I thought a bootloader is necessary to implement it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing Flash and RAM</title><link>https://devzone.nordicsemi.com/thread/296774?ContentTypeID=1</link><pubDate>Mon, 01 Mar 2021 09:26:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1237b47-5137-4e8c-8089-6c5d1dcb5709</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I believe that you can choose whether to do it block by block, or as a whole image. Look at how it is used in&amp;nbsp;app_activate() in nrf_bootloader_fw_activation.c in the bootloader project found in SDK\examples\dfu\secure_bootloader\pca10040_s132_ble.&lt;/p&gt;
&lt;p&gt;It looks like this example uses the image&amp;#39;s (application&amp;#39;s) start address:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;crc = crc32_compute((uint8_t*)nrf_dfu_bank0_start_addr(), image_size, NULL);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Where bank0_start_addr() is the start address of the applictaion (after the softdevice), and image_size is the size of the application.&lt;/p&gt;
&lt;p&gt;If you look at the declaration of the crc32_compute():&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for calculating CRC-32 in blocks.
 *
 * Feed each consecutive data block into this function, along with the current value of p_crc as
 * returned by the previous call of this function. The first call of this function should pass NULL
 * as the initial value of the crc in p_crc.
 *
 * @param[in] p_data The input data block for computation.
 * @param[in] size   The size of the input data block in bytes.
 * @param[in] p_crc  The previous calculated CRC-32 value or NULL if first call.
 *
 * @return The updated CRC-32 value, based on the input supplied.
 */
uint32_t crc32_compute(uint8_t const * p_data, uint32_t size, uint32_t const * p_crc);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You see that you can do this in blocks as well. If so, you would calculate the CRC of a block of a given size, using NULL as the starting CRC. Then when you want to calculate the next crc, you would use the previous CRC, and it will continue to use that CRC for the second block.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing Flash and RAM</title><link>https://devzone.nordicsemi.com/thread/296732?ContentTypeID=1</link><pubDate>Mon, 01 Mar 2021 06:25:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23b79b6f-9db3-48e7-b394-dcc2eaecfc6a</guid><dc:creator>Charan</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I was looking into the&amp;nbsp;&lt;span&gt;crc32_compute&amp;nbsp;all along and I am able to find the start and end address of flash memory and hence, the size as well. It seems that we have to feed the function as a data block which is where I am struggling. How would I feed the entire flash memory or at least the program memory (.text) as a block? Or is it fine if I just feed the starting address and the size of the block?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing Flash and RAM</title><link>https://devzone.nordicsemi.com/thread/296251?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2021 12:39:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79a31572-bc49-4ae5-9bee-e1e471c1ae19</guid><dc:creator>Edvin</dc:creator><description>[quote user="Havig"]What do you mean by outside the application[/quote]
&lt;p&gt;&amp;nbsp;Sorry. I meant &amp;quot;outside the bootloader&amp;quot;. That is, not using the bootloader.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing Flash and RAM</title><link>https://devzone.nordicsemi.com/thread/296232?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2021 12:05:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09b632eb-0727-4d25-860d-864787e806ff</guid><dc:creator>Charan</dc:creator><description>[quote userid="26071" url="~/f/nordic-q-a/71882/testing-flash-and-ram/295876#295876"]You would of course need to calculate it from outside the application[/quote]
&lt;p&gt;What do you mean by outside the application. I don&amp;#39;t think we will be using the bootloader, so I will be using the crc32_compute only.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing Flash and RAM</title><link>https://devzone.nordicsemi.com/thread/295876?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2021 14:58:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5be7284c-489a-45c7-b2af-c40b96d60558</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Ok. Either you need to either apply a bootloader, or you need to look at how the bootloader does the CRC calculations.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I guess the function&amp;nbsp;crc32_compute() from crc32.c in the SDK could be a way to go in your case. You would of course need to calculate it from outside the application, to know what the crc32_compute() will return, in order to check that it is still the same.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing Flash and RAM</title><link>https://devzone.nordicsemi.com/thread/295781?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2021 10:10:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96370eb1-f336-475e-885f-47f3a78a0171</guid><dc:creator>Charan</dc:creator><description>[quote userid="26071" url="~/f/nordic-q-a/71882/testing-flash-and-ram/295770#295770"]Or is it to prevent someone from injecting faulty software to your chip?[/quote]
&lt;p&gt;No I am using read back protection for the same.&lt;/p&gt;
&lt;p&gt;As per standards in the compliance, I need to check for codes in flash and RAM.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing Flash and RAM</title><link>https://devzone.nordicsemi.com/thread/295770?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2021 09:55:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4cd7fc4-a5ab-4804-bec0-c4198e14f639</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;&lt;span&gt;So did you plan to have a bootloader before delivering the project? Either way, I think you should read through and follow this guide:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/nordic/short-range-guides/b/software-development-kit/posts/getting-started-with-nordics-secure-dfu-bootloader"&gt;Getting started with Nordic&amp;#39;s Secure Bootloader&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;A couple of hints:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;1: Make sure that you are able to build Makefile projects from the command line (the guide briefly explains how to set it up)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2: In order to run an application while you have a bootloader programmed, you either have to have transferred the application via DFU, or you need to &lt;a href="https://infocenter.nordicsemi.com/topic/ug_nrfutil/UG/nrfutil/nrfutil_settings_generate_display.html"&gt;generate bootloader settings&lt;/a&gt; and program it.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Your initial request is a bit unusual. What will you do in case there is a CRC error in the application flash? What makes you think it will happen? Are you sending it into space (cosmic radiation)? Or is it to prevent someone from injecting faulty software to your chip?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing Flash and RAM</title><link>https://devzone.nordicsemi.com/thread/295730?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2021 04:46:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0de035bb-ce83-4b81-93ee-bd7391226fc1</guid><dc:creator>Charan</dc:creator><description>&lt;p&gt;Hmm, thanks a lot&lt;/p&gt;
&lt;p&gt;I will look into the bootloader description and check if it&amp;#39;s possible. Right now, I dont have a bootloader and we are so close to delivering our project. How long will it take to add a bootloader to the application without any errors and is there any measures I might have to follow in doing the same?&lt;/p&gt;
&lt;p&gt;Second question is how do I access RAM address via software and read and write data to it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing Flash and RAM</title><link>https://devzone.nordicsemi.com/thread/295647?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 15:03:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3612472-29b0-47d0-aaf1-07ef66eeb046</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;It is not really a typical thing to do this on the nRFs (at least that is my impression). That being said, there is nothing preventing you from doing so.&lt;/p&gt;
&lt;p&gt;If you are going to do this, I would split it into two parts:&lt;/p&gt;
&lt;p&gt;1. CRC check of the application. We do have a bootloader that can do this. Actually, if you plan to use a bootloader at all, I would recommend that you just use the option to check the CRC on every reboot, instead of only when a new image is received, which is the default behavior. What you would to is to set these settings from the bootloader&amp;#39;s sdk_config.h to 0:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#ifndef NRF_BL_APP_CRC_CHECK_SKIPPED_ON_GPREGRET2
#define NRF_BL_APP_CRC_CHECK_SKIPPED_ON_GPREGRET2 1
#endif

// &amp;lt;q&amp;gt; NRF_BL_APP_CRC_CHECK_SKIPPED_ON_SYSTEMOFF_RESET  - Skip integrity check of the application when waking up from the System Off state.
 

// &amp;lt;i&amp;gt; Only CRC checks can be skipped. For other boot validation types, the reset state is ignored.

#ifndef NRF_BL_APP_CRC_CHECK_SKIPPED_ON_SYSTEMOFF_RESET
#define NRF_BL_APP_CRC_CHECK_SKIPPED_ON_SYSTEMOFF_RESET 1
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;However, if you have not used the bootloader before, I suggest you get that up and running with the default settings before you start to adjust it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t want to do this using the bootloader, I think you should look at how the bootloader checks the CRC of the application, and somehow try to replicate this from your application.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;2: You said that you want to check the CRC of your peer manager. The peer manager uses FDS (Flash Data Storage) to store it&amp;#39;s data. The FDS actually has an option to check CRC of the records that are stored, so you would just need to make sure that this is enabled in your application&amp;#39;s FDS settings in sdk_config.h. Set:&lt;/p&gt;
&lt;p&gt;FDS_CRC_CHECK_ON_READ to 1&lt;/p&gt;
&lt;p&gt;and alternatively:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;FDS_CRC_CHECK_ON_WRITE to 1 as well.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>