Discussion in "Project Help" started by    Utsavi    Jun 12, 2017.
Mon Jun 12 2017, 10:36 AM

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, 11:45 AM ]
Mon Jun 12 2017, 06:18 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, 12:02 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, 12:12 PM ]
Tue Jun 13 2017, 05:31 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, 04:35 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, 11:52 AM
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

Wed Jun 14 2017, 08:09 PM
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, 12:14 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

Fri Jun 23 2017, 08:19 PM
>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 Fri Jun 23 2017, 08:42 PM ]
Thu Jun 29 2017, 12:29 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


Sat Jul 21 2018, 11:51 AM
Dibakar Bhanja Chowdhury
By using a 555 timer how can I expand the range of the mobile phone jammer? Please reply me asap
Sun May 20 2018, 03:31 PM
how to write and execute a program that read the keypad button and display the number on 7 segment on intel8051 at89s52 in assembly language?
Thu May 17 2018, 12:06 PM
sir iwant to ask about controller of three phase supply by using back to back thyristor instead of triac....will u give me some guideline?
Sat Apr 28 2018, 06:24 PM
ashutosh jain
IR Remote Switch using TV remote (RC5 Protocol) is not working properly. opp1 & opp2 is in problem.plz help
Sat Apr 28 2018, 01:39 AM
@kaiserslautern Post in forum
Wed Apr 25 2018, 12:39 PM
Hello everyone, using software uart is a very good idea for a second serial port. Thank you so much. I would kindly like to know how to connect this port to the PC?
Sun Apr 22 2018, 01:20 AM
This is a community site. Feel free to help anyone needing advice
Thu Mar 29 2018, 04:17 PM
please help me for the configuration bits for dspic30f2010
Thu Mar 29 2018, 04:15 PM
can any one using dspic30f2010.
Thu Mar 29 2018, 11:33 AM
can anybody give solar tracking in 8051 using proteus and keil to mail [email protected]



Tue May 22 2018, 02:30 AM
Sun Apr 29 2018, 07:09 PM
Sat Apr 28 2018, 12:41 PM
Sat Apr 21 2018, 03:35 PM
Fri Apr 20 2018, 02:38 PM
Sat Apr 14 2018, 12:47 AM
Wed Apr 04 2018, 07:51 PM
Mon Apr 02 2018, 06:27 AM


Guests: 36, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 37998
Newest member: bdmehta
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Jul 17 2018, 08:31 PM
Thank you.I'm happy it worked out for you.
LAMBO Avatar
Posted By LAMBO
Tue Jul 17 2018, 09:52 AM
hi sir sorry for the late reply thank u sir for he...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Jul 12 2018, 08:27 PM
I'm glad we got there in the end :)>whats differen...
LAMBO Avatar
Posted By LAMBO
Thu Jul 12 2018, 06:51 AM
hi sir as u mentioned above to change crystal and ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Jul 10 2018, 07:20 PM
I assume you meant a AT89S52.It seems to me that...
LAMBO Avatar
Posted By LAMBO
Tue Jul 10 2018, 06:06 AM
hi sir i have checked now much of the distortion ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Jul 09 2018, 06:55 PM
Okay that is very interesting.I have attached two ...
LAMBO Avatar
Posted By LAMBO
Mon Jul 09 2018, 08:14 AM
hi sir as u mentioned above program i have tried ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Jul 06 2018, 11:58 PM
Okay..That motor creates a lot of sparks which mig...
LAMBO Avatar
Posted By LAMBO
Fri Jul 06 2018, 01:33 PM
hi sir as u told >Try the original code againi hav...