Discussion in "Project Help" started by    Utsavi    Jun 12, 2017.
Mon Jun 12 2017, 04:06 pm

I am working on PXAG-49 IAP.

To erase blocks I write like.,

MOV R6H, #40H //indicates blocks to erase
MOV R0H, #01H //Erase Command
OR AUXR, #80H //ENBOOT set
CALL 0FFF0H     //call bootROM

(Note that I write above assembly code in my .c file with help of #pragma asm/endasm)

When I am calling 0FFF0H program doing nothing.No erase operation performed. XAG-49 bootROM is at 0xFFF0 address(PGM_MTP).

One more thing on reading PXAG-49 datasheet, I read line which I dont understand that is.,


Setting the ENBOOT bit in the AUXR register enables the Boot
ROM and activates the on-chip VPP generator if VPP is connected to
VDD rather than 12 V externally. The PWR_VLD flag indicates that
VPP is available for programming and erase operations. This flag
should be checked prior to calling the Boot ROM for programming
and erase services. When ENBOOT is set, it typically takes
5 microseconds for the internal programming voltage to be ready

Is PWR_VLD already Enabled? My Vdd is connected to Vpp directly. will PWR_VLD bit be 1 or 0 for Vpp connected to Vdd?

Erase is not working. Is there any settings to do?

Utsavi Bharuchwala

[ Edited Mon Jun 12 2017, 05:15 pm ]
Mon Jun 12 2017, 11:48 pm
If Vpp is connected to 12 volts PWR_VLD should be 1
If Vpp is connected to 5 volts PWR_VLD should be 0

If Vpp is connected to 5 volts, set ENBOOT ,
then wait until PWR_VLD is set.
R6L should be 0.

Tue Jun 13 2017, 05:32 pm

Thanks for reply.

Yes,I disabled all interrupt.
I set R0H to #01H, R6H to #00H, R6L to #00H
I wait till PWR_VLR set to 1.
On PWR_VLD set, I called bootROM,
I cleared ENBOOT.
I checked R4L, which is not 0 ....!!!!

Means Erase is not done... Why?

Why bootROM is not erasing block? I did every steps which are mentioned in datasheet,though I am unable to erase..

[ Edited Tue Jun 13 2017, 05:42 pm ]
Tue Jun 13 2017, 11:01 pm
Yes that should have worked.
Can you post your full code just to double check.
Have you found any example code on-line ?
According to this document in circuit erasing may be unreliable.
Wed Jun 14 2017, 10:05 am

Thanks for reply. Erasing blocks is called as auto erasing? And Yes for simplicity, I was erasing only block 0. As mentioned in my previous I move R6H to 00H. will it not erased this block?

Wii this create problem in erasing block 0 and block 1 ??

I am using 27MHz crystal oscillator. WDT is not enabled in my program.

I want a patch for xaAutoBlockErase234() function.Please provide me link to download.

My erase code is below,

	 MOV.b R0H,#01H
	 MOV.b R6H,#00H    ;;Erase block 0
	 MOV.b R6L,#00H
 	 OR.b AUXR ,#080H  ;;set ENBOOT 
       MOV.b R3L,AUXR         
       AND.b R3L ,#020H 
       CJNE.b	R3L,#020H,REPEAT_STEP	;; checked PWR_VLD prior calling bootROM
       AND.b AUXR, #07FH  ;;clear ENBOOT
       CJNE.b R4L, #00,EraseFail

Utsavi Bharuchwala

Wed Jun 14 2017, 05:22 pm
Hello ExperimenterUK,

Please note that, I also assigned crystal frequency to R0L register(MOV.b R0L, #27 ) according to AN716_1.pdf (page 7)file attached below,which is also not working.

Utsavi Bharuchwala

Thu Jun 15 2017, 01:39 am
I can't find much on the Web about the XA-G49
and nothing more about IAP erasing.

We seem to be at the "try anything" stage.

I would try:

Use a fixed delay after setting ENBOOT , say 10mS.
Try erasing other blocks.
A lower crystal speed , say under 10MHz
Connect Vpp to 12 volts.

Do the the other 0xfff0 functions work ?

"I want a patch for xaAutoBlockErase234() function.Please provide me link to download."
I couldn't find any trace of it.
You could try NXP (Philips) technical support.
Thu Jun 22 2017, 05:44 pm
Hello ExperimenterUK,

Thanks for your support. From code written upper erase is performed ok. There was problem in my debug.And because of that value of R0H value was changing. But now erase was OK.

Now I want to try erase 2 blocks my code is below...What i note is sometimes block 2 is unable to erase.

MOV.b R1L, #00H  

	MOV.b R0L, #27
	MOV.b R0H,#01H			  
	MOV.b R6H,R1L
	MOV.b R6L,#00H
 	OR.b AUXR ,#080H  
        MOV.b R3L,AUXR
        AND.b R3L ,#020H 
        CJNE.b R3L,#020H,REPEAT_STEP1	 
        CALL PGM_MTP

        AND.b AUXR, #07FH  
      	CJNE R4L, #00, EraseFail	

       	CJNE R1L, #020H, GO4NEXT
	JMP EraseOver

GO4NEXT: ADD.b R1L, #020H
	 JMP EraseAgain

By doing blank check in WinISP i can see that Part 2000H not erased message.. why this is so??

Should I need to check PWR_VLD bits every time on erasing each blocks?


Utsavi Bharuchwala

Sat Jun 24 2017, 01:49 am
>Should I need to check PWR_VLD bits every time on erasing each blocks?

I think so, and you don't save anything by not checking.

I'm happy to hear you have made great progress.
From reading the data sheet it is not clear whether the block address
goes in R6 high or R6 low.. try R6 low.

One thing to consider, unless a call guarantees the registers are
not changed you should assume they will change.
Use a memory location, not R1L for the block number.
I know its a short piece of code that you know very well,
but add comments to describe what you are doing.

Let us know how you get on.

[ Edited Sat Jun 24 2017, 02:12 am ]
Thu Jun 29 2017, 05:59 pm
Hello ExperimenterUK,

Thanks for reply. My Erase part to done. Now I am Programming Data Bytes. Small file say 5 to 6 lines .hex file I am successfully able to program.

But when I take a large file say of 375 lines .hex file, I am unable to Program it.Say my programming Bytes fails from line number 321 having address of 29FEH, sometimes from 20 having address of 2BF2H etc. My R4L is not coming 00.

How can trace the reason of program failure?

Note: I am erasing 0 and 1 block . My .hex file has 2D37H Ending Range (note from WinISP by Loading hex file) which is in range of Block 0 and 1.

Its not like that, Block 0 or 1 is not erased, because Programming at address say., 2A0FH and at address say., 0084H is done.

And no address is above 3000H in my hex file.

Utsavi Bharuchwala

Get Social


Powered by e107 Forum System



Sun Feb 05 2023, 04:57 am
Sat Feb 04 2023, 01:56 pm
Sat Feb 04 2023, 11:52 am
Sat Feb 04 2023, 02:28 am
Sat Feb 04 2023, 02:14 am
Fri Feb 03 2023, 07:52 pm
Thu Feb 02 2023, 10:32 pm
Thu Feb 02 2023, 12:58 am