ISP and CRP1/CRP2

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ISP and CRP1/CRP2

2,185 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by masterboy on Thu Mar 21 06:49:49 MST 2013
Hi,

I have a question about ISP. Can I rewrite some sectors on flash when I have set CRP1/CRP2 or I have to erase whole flash and then save new data?
0 Kudos
Reply
11 Replies

2,081 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Mar 22 06:52:18 MST 2013

Quote: masterboy
Is it diffucult?



Don't known if that's difficult for you. It's a question of experience (= not difficult for someone with a few thousand hours programming experience) :)


Quote: masterboy
Do you know any usable  example?



No, I don't use LPC1347 and I prefer to do that with IAP ;) But Google is your friend :)
0 Kudos
Reply

2,081 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by masterboy on Fri Mar 22 04:25:59 MST 2013
It is good ideal but I dont have any experience how to write own bootloader. Is it diffucult? Do you know any usable example?
0 Kudos
Reply

2,081 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Mar 22 04:17:19 MST 2013
:confused:

Then write your own secondary bootloader, which is relocating vector table to another sector ;)
0 Kudos
Reply

2,081 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by masterboy on Fri Mar 22 04:08:01 MST 2013
It is problem. When I set CRP1/2/3 so I never cannot rewrite sector 0. This solution is unuseble because I need to update user program and data on flash memory separately.
0 Kudos
Reply

2,081 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Mar 22 03:50:50 MST 2013
No, bootloader is checking this sector for valid code and then starting program execution there :)

Sector 0 is where every flash executed program starts ;)
0 Kudos
Reply

2,081 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by masterboy on Fri Mar 22 02:23:21 MST 2013
In UM is written that I cannot write to Sector 0 in CRP1 mode. I suppose, that user code start in this sector or not? Can I set somewhere that the user code is store from sector 1? Is it possible?
0 Kudos
Reply

2,081 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Mar 21 11:30:29 MST 2013

Quote: masterboy
We are talking about ISP. I would like to rewrite part of flash user memory using ISP in mode CRP1. Is it possible?



What's not clear there :confused:

UM10524 Rev 4:

Quote:

Table 343. Code Read Protection (CRP) options

Description
CRP1 0x12345678 Access to chip via the SWD pins is disabled. This mode allows partial flash update using the following ISP commands and restrictions:

• Write to RAM command cannot access RAM below 0x1000 0300.
• Copy RAM to flash command can not write to Sector 0.
• Erase command can erase Sector 0 only when all sectors are selected for erase.
• Compare command is disabled.
• Read Memory command is disabled.

This mode is useful when CRP is required and flash field updates are needed but all sectors can not be erased. Since compare command is disabled in case of partial updates the secondary loader should implement checksum mechanism to verify the integrity of the flash.

0 Kudos
Reply

2,081 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by masterboy on Thu Mar 21 11:07:47 MST 2013
We are talking about ISP. I would like to rewrite part of flash user memory using ISP in mode CRP1. Is it possible?
For example:
Program and data are saved in user flash memory but each on other place. And now I need rewrite only part of memore where are data. I dont know is it possible rewrite only data part usin ISP. The memory is Code Protect 1.
0 Kudos
Reply

2,081 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Mar 21 09:40:50 MST 2013
#1 Update your UM to UM10524 LPC1315/16/17/45/46/47 User manual Rev. 4 — 12 March 2013 ;)

#2 Are we are talking about ISP or IAP :confused:

UM10524 Rev 4:

Quote:

21.12 Code Read Protection (CRP)
Code Read Protection is a mechanism that allows the user to enable different levels of
security in the system so that access to the on-chip flash and use of the ISP can be
restricted. When needed, CRP is invoked by programming a specific pattern in flash
location at 0x0000 02FC. [COLOR=Red]IAP commands are not affected by the code read protection.[/COLOR]

0 Kudos
Reply

2,081 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by masterboy on Thu Mar 21 09:19:52 MST 2013
OK, I forgot written that I use LPC1347 :) This uP has this table on page 369 (UM10524).
I have "divided" flash memory to two parts (program and data section). Data are on address 0x0000C000 and I have set CRP1. My question is, can I rewrite only data section without erase whole flash memory using ISP? I would like to update only data section.
0 Kudos
Reply

2,081 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ex-kayoda on Thu Mar 21 08:50:14 MST 2013

Quote: masterboy
Hi,

I have a question about ISP. Can I rewrite some sectors on flash when I have set CRP1/CRP2 or I have to erase whole flash and then save new data?



UM10524 Table 333. Code Read Protection (CRP) options is describing that  :)
0 Kudos
Reply