Seeking Effective Flash Protection Methods for 54L05 Chip

Hello everyone,
I am currently working on implementing the flash protection feature for the 54L05 chip. My objective is to safeguard the code storage area from unintended erasure or overwriting during program execution. I have attempted to use the fprotect_area function for this purpose. However, upon verification, I found that the protected area can still be erased or written to. Could anyone share some ideas or alternative solutions to achieve effective flash protection?
P.S. The SDK version I am using is 3.0.0.
Thank you in advance for your valuable input!
Parents Reply
  • Hi Ozzy,

    I will try to answer while Hieu is away. I am not sure if I understood the question right but if you are asking about the maximum flash size that can be used with fprotect_area and its alignment restrictions then both start and length address needs be multiple of 4KB (0x1000) and the whole RRAM can be used to be protected (using address is 0x0 and length as 0x80000)

Children
  • #define pro_len (0x1000 *400)
    void flash_test(void)
    {
    	printf("Lock 0x%x from 0\n",pro_len);
    	errno = fprotect_area(0x0000, pro_len);
    	if (errno) {
    		printf("Failed lock err %d\n", errno);
    	}
    	else{
    		printf("Lock ok\n");
    	}
    }

    Hello,
    Thanks for your reply. I followed your suggestion and tried again. Here is my code. When I run the flash_test() function, the printout shows "Failed lock err -22", which seems to be a "not enough storage" error. Do you have any constructive suggestions? Thanks!
    Looking forward to your reply.
    Ozzy
  • Hi,
    Are you still looking into this issue? Our project is about to enter mass production, and the flash protection feature is of great significance to us. We look forward to your reply!
    Ozzy
  • Sorry for late reply. The pro_len size is clearly wrong as 0x1000 = 4096 and multiplied by 400 gives you about 1.6 MB and you do not have this much storage in nRF54L05. As mentioned here, you have only 0.5MB of storage on this SoC so max value you can use on pro_len is (0x80000)

  • Hi, thanks for your reply!
    As soon as I read your response, I immediately spotted the mistake in my code and made the necessary corrections. However, the outcome is still not satisfactory. I set the length to (0x1000*0x80), but it still returns an error code of -22. After verification, I found that the code only works effectively when the length (pro_len) is less than or equal to (0x1000*0x07).
    Looking forward to your reply!
    Ozzy

    #define pro_len (0x1000 *0x80) 
    /*
    To ensure the operation is successful, 
    the value of this macro definition needs
    to be less than or equal to 0x7000.
    */
    void flash_test(void)
    {
    	printf("Lock 0x%x from 0\n",pro_len);
    	errno = fprotect_area(0x0000, pro_len);
    	if (errno) {
    		printf("Failed lock err %d\n", errno);
    	}
    	else{
    		printf("Lock ok\n");
    	}
    }
Related