2003-05-15 04:36 AM
[q]Ask about writing data into primary flash memory.
2011-05-17 02:54 AM
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, Byounghoon2011-05-17 02:54 AM
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.