Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

Flash block write from RAM issue

$
0
0

Hi all,

I'm attempting to use the write block mode for transmitting a block of data from RAM to flash.  I have a filled array RAM_table_byte[64] in my RAM and I followed the block write flow outlined in the msp430g2452 family guide. When I execute this code, and read the values back from flash, only the first byte is has the correct data and the rest have 0xFF values.  

I saw a few posts online stating the same problem, but I couldn't find a solution! Thanks for any help

I verified my write byte/word, read, and erase functions work properly.

//ERASE segment 1 (starting at 0xFC00)

void write_flash_block(UINT16 flashAddress, UINT8 length )

{
UINT8 i; // Use as write counter
char* Flash_ptr;
Flash_ptr = (char*) flashAddress; // Initialize Flash pointer to 0xFC00- start of Segment 1
while(FCTL3 & BUSY); // Check Flash BUSY bit
FCTL3 = FWKEY;  
FCTL1 = FWKEY + BLKWRT + WRT; // Enable block-write operation
for(i = 0; i < 64; i++)
{
while(!(FCTL3 & WAIT)); // WAIT until Flash is ready
*Flash_ptr = RAM_table_byte[i]; // Write value to flash
Flash_ptr++; // Double-increment Flash pointer
}
while(FCTL3 & BUSY); // Check Flash BUSY bit
FCTL1 = FWKEY; // Clear BLKWRT & WRT bits
FCTL3 = FWKEY + LOCK; // Reset LOCK bit
}


Viewing all articles
Browse latest Browse all 262198

Trending Articles



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