LPC802 Writing flash

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC802 Writing flash

1,628 次查看
Caroline22
Contributor II

Hello,

I have results like below with iap example in MCUXpresso with LPC802M001JDH16FP

- only change in code example:

#define DEMO_IAP_FLASH_SECTOR (0)

Do you know what is the reason of such error?

 

0x00002000: 1A400849 4152D307 4601D3FA 47704610 | I.@...RA...F.FpG

0x00002010: 18400849 1892D2F7 1840D3FA 46104601 | I.@.......@..F.F

0x00002020: 0FCB4770 4249D000 D5001002 40534240 | pG....IB....@BS@

0x00002030: F7FFB508 BC0CFFD4 D3001052 2A004240 | ........R...@B.*

0x00002040: 4249D500 46F44718 F0002000 4760F801 | ..IB.G.F. ....`G

0x00002050: 46844770 D3093A04 D1070783 0A0B0609 | pG.F.:..........

0x00002060: 0C0B4319 3A044319 D2FCC002 D0033204 | .C...C.:.....2..

0x00002070: 30017001 D1FB3A01 47704660 42402001 | .p.0.:..`FpG. @B

0x00002080: 20014770 47704240 42402001 20014770 | pG. @BpG. @BpG.

0x00002090: 47704240 42402001 20014770 47704240 | @BpG. @BpG. @BpG

0x000020A0: 47700010 45535341 45205452 524F5252 | ..pGASSERT ERROR

0x000020B0: 25202220 000A2073 41490A0D 6C462050 | " %s ....IAP Fl

0x000020C0: 20687361 6D617865 0D656C70 0000000A | ash example.....

0x000020D0: 72570A0D 6E697469 6C662067 20687361 | ..Writing flash

0x000020E0: 74636573 2520726F 000A0D64 72570A0D | sector %d.....Wr

0x000020F0: 20657469 66206F74 6873616C 67617020 | ite to flash pag

0x00002100: 61662065 64656C69 00000A0D 65530A0D | e failed......Se

0x00002110: 726F7463 72657620 20796669 6C696166 | ctor verify fail

0x00002120: 0A0D6465 00000000 72450A0D 6E697361 | ed........Erasin

0x00002130: 61702067 31206567 206E6920 73616C66 | g page 1 in flas

0x00002140: 65732068 726F7463 0D642520 0000000A | h sector %d.....

0x00002150: 61500A0D 65206567 65736172 69616620 | ..Page erase fai

0x00002160: 0D64656C 0000000A 6E450A0D 666F2064 | led.......End of

0x00002170: 50414920 616C4620 45206873 706D6178 | IAP Flash Examp

0x00002180: 0A0D656C FFFFFF00 6C73662E 6F6C635F | le.......fsl_clo

0x00002190: 632E6B63 3130313A 62203A20 00657361 | ck.c:101 : base.

0x000021A0: 6C73662E 6F6C635F 632E6B63 3634313A | .fsl_clock.c:146

0x000021B0: 66203A20 65736C61 FFFFFF00 6C73662E | : false.....fsl

 

With 1st and 2nd sectors i have results:

#define DEMO_IAP_FLASH_SECTOR (1)

"Break at address "0xfffffffe" with no debug information available, or outside of program code."

or

#define DEMO_IAP_FLASH_SECTOR (2)

goes to:

#if defined(__REDLIB__)
void __assertion_failed(char *failedExpr)
{
(void)PRINTF("ASSERT ERROR \" %s \n", failedExpr);
for (;;)
{
__BKPT(0);
}
}

 

Are these sectors blocked? I can't find such information.

标记 (3)
0 项奖励
回复
6 回复数

1,612 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Caroline22,

About writing flash, recommend you first refer to iap_flash demo under SDK, change code base on the demo, and if still have issue, please describe it more clearly.

 

BR

Alice

0 项奖励
回复

1,605 次查看
Caroline22
Contributor II

Hello,

 

Thanks for replying.

I used iap_flash, SDK.

Only change I made in iap_flash example, line 19:

#define DEMO_IAP_FLASH_SECTOR (0)

(in example there is: #define DEMO_IAP_FLASH_SECTOR (14)).

I have results like above in flash (from 0x2000) - could you help me why the results look like that? what can be the reason?

 

 

0 项奖励
回复

1,599 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Caroline22,

Because your application code is in sector 0, you can not erase it.

 

BR

Alice

0 项奖励
回复

1,590 次查看
Caroline22
Contributor II

Hello,

I tried also with 1,2,3,6,8 sectors, instead of 14 - the same result (result as above; 10-14 sectors are empty) - I found that IAP_EraseSector doesn't work for 1,2,3,6,8 sectors (I watched flash addresses in Memory Monitor).

#define DEMO_IAP_FLASH_SECTOR (14) - works ok

Are 10-14 sectors only available for writing? 

0 项奖励
回复

1,580 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Caroline22 

As frank said, you can not  erase/program the sector which execute code. Except copy code into RAM to run.

 

BR

Alice

0 项奖励
回复

1,586 次查看
frank_m
Senior Contributor III

Look up the datasheet of your MCU, and it's Flash layout.

Flash sectors are only the erase units for the programming process.

All sectors of one Flash bank are subjected to the programming voltage during erase/program, which means you cannot execute code from any affected sector at the same time.

Either use sector 14 which seems to work, or load your erase/flash code (probably only one function) into RAM and execute it there.

0 项奖励
回复