This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello everybody,
I'm resuming an old project based on TMS320F2802 to add flash programming function when I receive a SCI command from a host. To do this I use FLASH API v3.02 and CCS v9.3.0.00012. When I try to erase SECTORA (0x003F6000-> 0x3F7FFF) and write a buffer to address 0x003F6000, the buffer is written to the address 0x003F5F60. The sector is also erased from that address. Can someone help me?
Here is the code (ToggleTest return 9.9916KHz and Verify function return STATUS_SUCCESS):
#pragma CODE_SECTION(CallFlashAPI,"ramfuncs");
#pragma CODE_SECTION(Error,"ramfuncs");
#pragma CODE_SECTION(Done,"ramfuncs");
#define WORDS_IN_FLASH_BUFFER 0x100;
{//Function after SCI command
.
.
.
if (SysCtrlRegs.PLLSTS.bit.MCLKSTS != 1)
{//set PLL
if (SysCtrlRegs.PLLCR.bit.DIV != PLLCR_VALUE)
{
EALLOW;
SysCtrlRegs.PLLSTS.bit.MCLKOFF = 1;
SysCtrlRegs.PLLCR.bit.DIV = PLLCR_VALUE;
EDIS;
EALLOW;
SysCtrlRegs.WDCR= 0x0068; //WatchDog disable
EDIS;
while(SysCtrlRegs.PLLSTS.bit.PLLLOCKS != 1) { }
EALLOW;
SysCtrlRegs.PLLSTS.bit.MCLKOFF = 0;
EDIS;
}
}
else
{
ESTOP0;
}
// Copy the Flash API functions to SARAM
MemCopy(&Flash28_API_LoadStart, &Flash28_API_LoadEnd, &Flash28_API_RunStart);
// We must also copy required user interface functions to RAM
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
//Initalize Flash_CPUScaleFactor
Flash_CPUScaleFactor = SCALE_FACTOR;
//Flash callback function not used
Flash_CallbackPtr = NULL;
// Jump to SARAM and call the Flash API functions
CallFlashAPI();
}
void CallFlashAPI(void)
{
Uint16 i;
Uint16 Status;
Uint16 *Flash_ptr; // Pointer to a location in flash
Uint32 Length; // Number of 16-bit values to be programmed
Uint16 VersionHex; // Version of the API in decimal encoded hex
Uint16 SCIBuffer[WORDS_IN_FLASH_BUFFER];
//ToggleTest(11); // Toggle GPIO11
//Check the version of the API
VersionHex = Flash_APIVersionHex();
if(VersionHex != 0x0302)
{
ESTOP0;
}
DINT; //interrupt disable
Status = Flash_Erase((SECTORA),&FlashStatus);
if(Status != STATUS_SUCCESS)
{
Error(Status);
}
for(i=0; i<0x100; ++i)
{
SCIBuffer[i] = 0+i;
}
Flash_ptr = (Uint16 *)0x003F6000;
Length = 0x100;
Status = Flash_Program(Flash_ptr,SCIBuffer,Length,&FlashStatus);
if(Status != STATUS_SUCCESS)
{
Error(Status);
}
Status = Flash_Verify(Flash_ptr,SCIBuffer,Length,&FlashStatus);
if(Status != STATUS_SUCCESS)
{
Error(Status);
}
Done();
}
void Error(Uint16 Status)
{
// Error code will be in the AL register.
asm(" ESTOP0");
asm(" SB 0, UNC");
}
void Done(void)
{
asm(" ESTOP0");
asm(" SB 0, UNC");
}
Hi,
Your query has been assigned to the experts. Due to the US Holiday, please expect a reply early next week.
Thanks
Vasudha
Hi Giovanni,
If you refresh the memory browser in CCS does it appear correct? Does your application code run OK with the Flash_Verify() function being successful?
If your code executes successfully I would think everything is OK and the memory browser may just be showing something weird or need to be refreshed.
Have you evaluated the SW examples in C200w0are below?
C:\ti\c2000\C2000Ware_3_01_00_00\libraries\flash_api\f2802x\example_ccsv5
Best,
Kevin
Hi Kevin,
If I refresh the memory browser in CCS doesn’t appear correct, it appears as the above image.
At the moment I have not yet programmed my whole application code, I only tried to program some bytes after erasing one sector. I will do it shortly.
I evaluated the API example for F280x DSP, not for F2802x. I believe the correct example for my project is the first one.
Best regards.
Giovanni.
I solved using View->Memory Browser: in this way I get the correct memory map.
Thanks.
Giovanni.