I want to write a simple code read protection for LPC5528, which can be enabled/disabled via USB.
Until now, I have only LPC55S28.
Afraid of bricking the device, I tried writing in customer area first.
I tried writing on a LPC55S28 via FFR this way:
DisableIRQ(); setcpu100MHz();
Status = FLASH_Init(&flashInstance); //returns 0
Status = FFR_Init(&flashInstance); //returns 0=ok
FLASH_GetProperty(&flashInstance, kFLASH_PropertyPflashPageSize, &PflashPageSize);
Status = FFR_InfieldPageWrite(&flashInstance, iap_FlashRam, len);
//returns 0x64. why?
iap_flashram contains a copy of the 0x09df00 region with modified data at offset 0x100. len is 32 bytes.
Solved! Go to Solution.
Hello Bressan,
Yes, the length must equal the page size.
There may be different length for other part flash page.
BR
Alice
For all users, which want to implement simple CRP (Code Read Protection) for LPC55xx / LPC55Sxx:
Disable debug, and fully read protection: CMPA cc_socu_pin / cc_socu_dflt to 0xFC0003FF / 0xFFFF0000
Reenable debug: CMPA cc_socu_pin / cc_socu_dflt to 0/0 and CFPA set all 0 and increase version.
Hello Bressan,
Yes, the length must equal the page size.
There may be different length for other part flash page.
BR
Alice
I was able to write, if len==0x200.
It seems, like I must write the full page at once. So, why is there a parameter for the length?