This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

UCD3138064: protecting second 32KB of program flash using MFBALR17

Part Number: UCD3138064

hi, my program uses all 64KB for code. I would like to enable MFBALRx read only protection for both flash banks

flash bank 0 was easy: add TI example code to the asm loader

LDR		r4,c_mfbalr1_half0 ;point r4 at program flash base address register
MOV		r0,#0x62 ;make block size 32K, address 0, read only
STRH	r0,[r4]; store it there
.
.
.
c_mfbalr1_half0  .long 0xFFFFFE0E 	;low 16 bits of memory fine bank address low - FLASH#0

But I've got issues with flash bank 1: when I add slightly modified code in loader, CPU resets during it's execution

LDR		r4,c_mfbalr1_half0 ;point r4 at program flash base address register
MOV		r0,#0x62 ;make block size 32K, address 0, read only
STRH	r0,[r4]; store it there

LDR		r4,c_mfbalr17_half0 ;point r4 at program flash base address register
MOV		r0,#0x62 ;make block size 32K, address 0, read only
STRH	r0,[r4]; store it there
.
.
.
c_mfbalr1_half0  .long 0xFFFFFE0E 	;low 16 bits of memory fine bank address low - FLASH#0
c_mfbalr17_half0 .long 0xFFFFFE8E 	;low 16 bits of memory fine bank address low - FLASH#1

CPU is rebooted also during any write from function zero_out_integrity_word to MFBALR17 (DecRegs.MFBALR17.all = MFBALRX_BYTE0_BLOCK_SIZE_32K; )

is MFBALR17 specially protected from write?

  • I got it now, despite the reg is dedicated for flash bank 1 it has to have an address of flash bank 

    LDR		r4,c_mfbalr1_half0 ;point r4 at program flash base address register
    MOV		r0,#0x62 ;make block size 32K, address 0, read only
    STRH	r0,[r4]; store it there
    
    LDR		r4,c_mfbalr17_half0 ;point r4 at program flash base address register
    LDR		r0,c_mfbalr17_halt0_load
    STRH	r0,[r4]; store it there
    .
    .
    .
    c_mfbalr1_half0  .long 0xFFFFFE0E 	;low 16 bits of memory fine bank address low - FLASH#0
    c_mfbalr17_half0 .long 0xFFFFFE8E 	;low 16 bits of memory fine bank address low - FLASH#1
    c_mfbalr17_halt0_load .long 0x8062	;address of second bank + read only protection