cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to access the flash registers in BSL mode ST10F276E

dhiller
Associate II
Posted on November 14, 2006 at 04:57

Unable to access the flash registers in BSL mode ST10F276E

6 REPLIES 6
dhiller
Associate II
Posted on November 07, 2006 at 14:33

I am trying to make a bootstrap loader that talks to an In-Circuit tester through one of the parallel ports. I have an ST10F276E

I got the BSL mode working and all of the ports talk to the ICT.

My next hurdle is programming the IFLASH. It seems that I am not able to access any of the flash control registers E0000-E0006.

See the 2 instructions in the code below that make the ST10F276E go off into East Hyperspace.

SYSCON DEFR 0FF12h ; SYSCON register

XPERCON DEFR 0F024h ; XPERCON register

XPEREMU EQU 0EB7Eh ; XPEREMU register, cant DEFR this reg.

PROGRAM_IFLASH:

PUSH R0

; Do as the book says to access flash control registers at 0E:00XXh

MOV R0,#02h ; Set XPEN in SYSCON

OR SYSCON,R0

MOV R0,#20h ; Set XFLASHEN in XPERCON register

OR XPERCON,R0

MOV R0,XPERCON ; Make XPEREMU match XPERCON

MOV XPEREMU,R0 ;<--- This instruction causes ST10F276 to hang

XOR R0,R0 ; Point to 1st flash control register

EXTS #0Eh,#4 ; <---- ST10 hangs if address E0000h is selected

; Override segment 0E:XXXX

MOV R1,[R0+] ; Get contents of all flash control

MOV R2,[R0+]

MOV R3,[R0+]

MOV R4,[R0]

MOV RL0,RL1

CALL OUT_PORT ; Send it to the ICT port, byte at a time

MOV RL0,RH1

CALL OUT_PORT

MOV RL0,RL2

CALL OUT_PORT

MOV RL0,RH2

CALL OUT_PORT

MOV RL0,RL3

CALL OUT_PORT

MOV RL0,RH3

CALL OUT_PORT

MOV RL0,RL4

CALL OUT_PORT

MOV RL0,RH4

CALL OUT_PORT

POP R0

RET

najoua
Associate II
Posted on November 08, 2006 at 03:51

Hello,

In your code, the XFLASHEN bit in XPERCON register is set after setting XPEN bit in SYSCON register.

The XPERCON register must be defined before the SYSCON register because Register XPERCON cannot be changed after the global enabling of X-Peripherals, i.e. after setting bit XPEN in SYSCON register.

If XFLASHEN bit is set after the global enabling with XPEN-bit in

SYSCON register, no address space is occupied by the XFLASH where the flash registers are located.

So, to be able to accede Flash registers, just change the order of setting the two bits XPEN and XFLASHEN:

MOV R0,#20h ; Set XFLASHEN in XPERCON register

OR XPERCON,R0

MOV R0,#02h ; Set XPEN in SYSCON

OR SYSCON,R0

see the discussion forum on the following link:

http://www.stmcu.com/forums-cat-2903-5.html&start=20

Regards,

Najoua.

[ This message was edited by: Najoua on 08-11-2006 08:22 ]

[ This message was edited by: Najoua on 08-11-2006 08:50 ]

dhiller
Associate II
Posted on November 08, 2006 at 11:02

Najoua,

I reversed the order of XPEN and XPERCON but it still hangs.

I also made a point to clear the XPEN bit before I started just to be

sure.

Got any other ideas?

SYSCON DEFR 0FF12h ; SYSCON register

XPERCON DEFR 0F024h ; XPERCON register

XPEREMU EQU 0EB7Eh ; XPEREMU register

PROGRAM_IFLASH:

PUSH R0

MOV R0,#0FFFDh ; Clear XPEN in SYSCON

AND SYSCON,R0

MOV R0,#20h ; Set XFLASHEN in XPERCON register

OR XPERCON,R0

MOV R0,XPERCON ; Make XPEREMU match XPERCON

MOV XPEREMU,R0 ; < This instruction hangs the ST10

MOV R0,#02h ; Set XPEN in SYSCON

OR SYSCON,R0 ;

XOR R0,R0 ; Point to 1st flash register

; Override segment 0E:XXXX

; for next 4 instructions

EXTS #0Eh,#4 ; < if any segment greater than 8, ST10 hangs

MOV R1,[R0+]

MOV R2,[R0+]

MOV R3,[R0+]

MOV R4,[R0]

MOV RL0,RL1

CALL OUT_PORT

MOV RL0,RH1

CALL OUT_PORT

MOV RL0,RL2

CALL OUT_PORT

MOV RL0,RH2

CALL OUT_PORT

MOV RL0,RL3

CALL OUT_PORT

MOV RL0,RH3

CALL OUT_PORT

MOV RL0,RL4

CALL OUT_PORT

MOV RL0,RH4

CALL OUT_PORT

POP R0

RET

:-Y

najoua
Associate II
Posted on November 08, 2006 at 12:21

As I am seeing, you are setting and clearing bit VISIBLE (bitfield 1) in SYSCON register and not XPEN bit (bitfield 2) so:

- MOV R0,#0FFFDh should be replaced by MOV R0,#0FFFBh

- MOV R0,#02h should be replaced by MOV R0,#04h

Najoua.

dhiller
Associate II
Posted on November 13, 2006 at 18:08

Najoua,

Your last advice seemed to work, I was flipping the wrong bit in the SYSCON. I still had one instruction that hangs the ST10 (see below). However when I commented this one out I was able to access all of the flash control registers, and my project was a technical success.

One question still remains. Do I really need to make XPEREMU match XPERCON?

MOV R0,XPERCON ; Make XPEREMU match XPERCON

;MOV XPEREMU,R0 ; < This instruction hangs the ST10

Dudley

:D

najoua
Associate II
Posted on November 14, 2006 at 04:57

You need to make XPEREMU match XPERCON only for emulation purposes:

Once the XPEN bit of SYSCON register is set and at least one of the X-peripherals (except memories) is activated, the register XPEREMU must be written with the same content of XPERCON: this is mandatory in order to allow a correct EMULATION of the new set of features introduced on the X-BUS for the new ST10 generation. Of course, XPEREMU must be programmed after XPERCON and after SYSCON, in such a way the final configuration for X-Peripherals is stored in XPEREMU and used for the emulation

hardware setup.

Najoua.