Hi,
I am planning to use the 64k flash area starting from 0x10000 for logging some data from sensors.
I am running in to an issue when I try to erase segment no 64 onwards. ie offset of 64*512 = 0x8000
To erase a segment a write to the address 0x18000 is performed by the following code
#define FLASH_LOG_AREA_START (char *)0x10000
void eraseSegment (unsigned int segNo)
{
char *Flash_ptr; // Initialize Flash pointer
Flash_ptr = FLASH_LOG_AREA_START;
Flash_ptr += (segNo*FLASH_SEG_SIZE);
FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY+ERASE; // Set Bank Erase bit - Segment
*Flash_ptr = 0; // Dummy erase byte - pointer segment erase
FCTL3 = FWKEY+LOCK; // Set LOCK bit
}
The problem seems to be that Flash_ptr does not contain 0x18000 when segment number is 64, instead it has 0x8000. I have checked that segNo is passed to the function correctly. The erase to 0x8000 erase part of my program, in lower 64k.
The problem is not there when segNo is less than 64. ie I am able to erase and program 0x 17E00 corresponding to seg 63.
I have enabled large data model and large memory model. So I assume that I should be getting 20 bit addresses.
I am using sys/bios, but I suppose it is no way related to that.
Please help me in resolving this issue. I am using CCSv5
Regards,
Jino