This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Testing Flash and RAM

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 only use CRC for reading and writing to the flash? Or is there any other way to check the credibility of the flash and RAM

I read that you can create a checksum of the entire flash. My question is how can I create a checksum for the entire flash region or at least the region where the code and the peer manager is stored? As far as RAM is considered, it looks like I have to do any of the March tests. How do I access the RAM region via software?

Also, last question, suppose I am doing march test. Will doing this in main before initializing the modules affect the global variables assigned?

  • You would of course need to calculate it from outside the application

    What do you mean by outside the application. I don't think we will be using the bootloader, so I will be using the crc32_compute only.

  • Charan said:
    What do you mean by outside the application

     Sorry. I meant "outside the bootloader". That is, not using the bootloader. 

  • Hello,

    I was looking into the crc32_compute 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?

  • Hello,

    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 app_activate() in nrf_bootloader_fw_activation.c in the bootloader project found in SDK\examples\dfu\secure_bootloader\pca10040_s132_ble.

    It looks like this example uses the image's (application's) start address: 

    crc = crc32_compute((uint8_t*)nrf_dfu_bank0_start_addr(), image_size, NULL);

    Where bank0_start_addr() is the start address of the applictaion (after the softdevice), and image_size is the size of the application.

    If you look at the declaration of the crc32_compute():

    /**@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);

    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.

    Best regards,

    Edvin

  • Where bank0_start_addr() is the start address of the applictaion (after the softdevice), and image_size is the size of the application.

    Ok. Great. Thanks!!

    This is irrespective of whether I have bootloader or not right?
    I had seen this previously but since it had DFU in it, I thought a bootloader is necessary to implement it.

Related