cancel
Showing results for 
Search instead for 
Did you mean: 

[q]Ask about writing data into primary flash memory.

byounghoon_koh
Associate II
Posted on May 15, 2003 at 13:36

[q]Ask about writing data into primary flash memory.

2 REPLIES 2
byounghoon_koh
Associate II
Posted on May 17, 2011 at 11:54

Hello Guys,

Now I'm trying to write some bytes into primary flash memory. I interpret the source code ''FlashCode1.c'' in dk3200_1_c. However, I can't understand the code exactly. In special, it is really curious that why the address argument of the function, flash_write_with_poll(volatile uchar xdata* addr, uchar dat), is uchar type. I think, it should be unsigned long because the total size of primary flash memory is 256KB.

Please let me know to write to flash memory.

Best regards,

Byounghoon

joseph2399
Associate II
Posted on May 17, 2011 at 11:54

In 8032 world, the address space is only 64KBytes, if you need to address more memory space, you have to use memroy paging.

To write to the flash memory through MCU bus, you need to issue a command sequence to unlock the flash first. Table 85 of the data sheet shows the command sequence.

In the function, flash_write_with_poll(volatile uchar xdata* addr, uchar dat), you need to send an 0xAA to the address X555h during the first cycle, where X has to be a number within the address range of the memory block that you want to write to. For example, if you mapped FS0 to 0x8000-0xBFFF, than X can be either 8,9,A or B.