This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem initializing XPERCON

Hello all,

I have ran into a sticky problem that I hope someone can help me with.

I am using the Dave tool to create a project. I use the dpt file to generate the Start167.a66 file (via Keil). Within the Start167.a66 file are the following lines of code that are suppose to initialize the XPERCON register to 0xC01.

$SET (INIT_XPERCON = 1) ; Uv2/Dave
..
..
V_XPERCON EQU 3073 ; Uv2/Dave
...
...
$IF (INIT_XPERCON = 1)
; Improtant XPERCON must be set before SYSCON.XPEN is enabled
XPERCON  DEFR 0F024H

EXTR    #1
MOV     XPERCON,#V_XPERCON
$ENDIF
Within my main() function I interogate the XPERCON register and it contains 0x401. This is the reset value of the register so it seems that the EXTR/MOV instruction does not modify the register properly. I need the value 0xC01 so I can use the 6k block of XRAM.

As a test I place the following 2 instructions right between the MOV and the $ENDIF statements

MOV     R1,#3073
MOV     XPERCON, R1
These instructions work correctly. My main() function reads the value 0xC01 from the XPERCON register and the 6k block of XRAM works properly. This also tells me that I am not over-writing the XPERCON register after initialization.

I have stepped thru the code using the simulator and an in circuit emulator. Everything looks fine with those tools. Only when I run the code using the actual processor do I have the problems using the 6k block of XRAM and the XPERCON register.

Does anyone understand why the XPERCON register is not being initialized properly using the standard Start167.a66 code?

Thanks in advance,
Walt

0