Hi all!
I have a question about flash, i have made a set of functions to read and write to flash on the MPS430F5436A. I had to switch to the large data model so that i can reach the registers above 0x10000, this works fine, i can read and write to those registers with no problem (using unsigned long pointers).
I all so made some functions to write to the lowere memory addresses (like the info and bsl memory banks). These functions worked fine before i switched to the large data model (by setting the large data model option on in Code Composer).
Does anybody have a idea? All sugestions are welcome!
The value that i read back is 0xFF which means that noting is written?
But now they don't work for the lower addresses, below a simpel one byte write and read functions:
char ReadOneByte(char * StartAddress){
TempByte = 0;
*ReadMemoryPointerInfoOrBSL = 0;
ReadMemoryPointerInfoOrBSL = StartAddress;
TempByte = *ReadMemoryPointerInfoOrBSL;
return TempByte;
}
void WriteOneByte(char * StartAddress, char value){
FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY + ERASE; // Set Erase bit
*ReadMemoryPointerInfoOrBSL = 0;
*WriteMemoryPointer2 = 0;
WriteMemoryPointer2 = StartAddress;
FCTL1 = FWKEY + BLKWRT; // Set WRT bit for write operation
*WriteMemoryPointer2 = value; // Write value to flash
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCK; // Set LOCK bit
}
*Update
When i use long as data type i then i can read an write to to lower registers, so when i use long pointers and variables then i can write and read data. But i don't think this is the solution because i write byte for byte, when i increment the pointer is see that it skips 4 bytes, but this way i lose space?
Anybody have a suggestion?