Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 21937

MSP430G2553: Problem in writing on INFORMATION MEMORY

$
0
0

Part Number:MSP430G2553

Hello

I am trying to save few variables in INFO memory in msp430g2553. I am trying to write some data in memory
location 01000h and 01001h.

But when I write on one of above location the other one gets erased.

I have also tried omiting dummy write in subroutine FLASHWRITE1 in that case both memories are updated
successfully once but second time when i try to update contents of that location, nothing happens.

Please find code attached.


Regards

Dilraj

#include <msp430.h>


ORG 0200H ;
;


;-------------------------------------------------------------------------------
ORG 0F800h ; Program Reset
;-------------------------------------------------------------------------------
RESET              mov.w #0280h,SP                                                 ; Initialize stackpointer
StopWDT           mov.w #WDTPW+WDTHOLD,&WDTCTL                ; Stop WDT

moV                 #01000h,r8
mov.b               #010h,r7
call                   #FLASHWRITE1

mov                 #01001h,r8
mov.b              #011h,r7
call                 #FLASHWRITE1

mov                #01000h,r8
mov.b             #012h,r7
call                #FLASHWRITE1

mov               #01001h,r8
mov.b             #013h,r7
call                #FLASHWRITE1
JMP $


;=============================================================================

;=============================================================================
FLASHWRITE1
                       MOV         #FWKEY+FSSEL1+FN1,&FCTL2            ; SMCLK/2
                       MOV         #FWKEY,&FCTL3                                   ; Clear LOCK
                       MOV         #FWKEY+ERASE,&FCTL1
                       MOV.B      #0,0(R8)                                                 ;Dummy write
                       MOV         #FWKEY+WRT,&FCTL1                          ; Enable write
                       MOV.B      R7,0(R8)                                                ; write contents of R7 to memory location pointed by R8
                       MOV         #FWKEY,&FCTL1                                   ; Done. Clear WRT 
                       MOV         #FWKEY+LOCK,&FCTL3                       ;  Set LOCK
RET

-------------------------------------------------------

;-------------------------------------------------------------------------------
DELAY
MOV #0FFFH,R10
LV DEC R10 ; Decrement R5
JNZ LV ; Delay over?
RET

;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
ORG 0FFFEh ; MSP430 RESET Vector
DW RESET ;
END


Viewing all articles
Browse latest Browse all 21937

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>