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.
In my project based on TMS320F28035 I am trying to emulate eeprom in on chip flash. I followed the application note - Application Report
EEPROM Emulation for Gen 2 C2000 Real-Time MCUs (SPRab69a1). I modified the following files to integrate with my code
DSP280x_MemCopy.c
F280xx_EEPROM.c
F280xx_EEPROM.h
F28035.cmd
I am using Sector H ( FLASHH : origin = 0x3E8000, length = 0x002000 )
While running the code the eeprom write works for 1st 3 to 6 times and then fails with status code as 30 or 31 and code also crashes and controller resets.
Attaching the files. Appreciate if you could help me in finding why it is crashing.
Regards,
Ramesh
//############################################################################ // // FILE: F280xx_EEPROM.c // // TITLE: EEPROM Read, Write, and Erase Functions // //############################################################################ // Authors: Tim Love / Pradeep Shinde // Release Date: Sep 2009 //############################################################################ #include "F280xx_EEPROM.h" // EEPROM Include File // Global Variables Uint16 Read_Buffer[64]; Uint16 Write_Buffer[64]; Uint16 Bank_Counter = 0; Uint16 Page_Counter = 0; Uint16 Bank_Status[1] = {0}; Uint16 Page_Status[1] = {0}; Uint16 *Bank_Pointer; Uint16 *Page_Pointer; Uint16 *Sector_End; union flashUnion flashreadpkt; union flashUnion flashwritepkt; FLASH_ST FlashStatus; FLASH_ST ProgStatus; // All Flash API functions need to be ran from internal RAM. Place all functions // that contain Flash API calls in ramfuncs to allow copy from Flash to RAM. #pragma CODE_SECTION(EEPROM_Erase,"ramfuncs"); #pragma CODE_SECTION(EEPROM_Write,"ramfuncs"); #pragma CODE_SECTION(EEPROM_UpdateBankStatus,"ramfuncs"); #pragma CODE_SECTION(EEPROM_UpdatePageStatus,"ramfuncs"); #pragma CODE_SECTION(EEPROM_ProgramSingleByte,"ramfuncs"); void initEEPROM(void) { EEPROM_Read(); flashreadpkt.flashpkt.PwrCycleCount++; flashwritepkt.flashpkt.HVOnTime= flashreadpkt.flashpkt.HVOnTime; flashwritepkt.flashpkt.HVCycleCount= flashreadpkt.flashpkt.HVCycleCount; flashwritepkt.flashpkt.PwrCycleCount= flashreadpkt.flashpkt.PwrCycleCount; EEPROM_Write(); } Uint32 getHvOnTime(void) { EEPROM_Read(); return flashreadpkt.flashpkt.HVOnTime; } Uint32 getPwrCycleCount(void) { EEPROM_Read(); return flashreadpkt.flashpkt.PwrCycleCount; } Uint32 getHvCycleCount(void) { EEPROM_Read(); return flashreadpkt.flashpkt.HVCycleCount; } void updateHVOnTime(Uint32 ontime) { flashwritepkt.flashpkt.HVOnTime+=ontime; } void updateHvCycleCount(Uint32 cyclecount) { flashwritepkt.flashpkt.HVCycleCount++; } void updatePwrCycleCount(Uint32 cyclecount) { flashwritepkt.flashpkt.PwrCycleCount++; } void resetEEPROM(void) { flashwritepkt.flashpkt.HVOnTime=0; flashwritepkt.flashpkt.HVCycleCount=0; flashwritepkt.flashpkt.PwrCycleCount=0; // EEPROM_Write(); } //######################### EEPROM_GET_VALID_BANK ############################ void EEPROM_GetValidBank() { //Each page holds 64 data words //Page size = Page_status word + 64W = 65W //Bank Size = Bank_status word + 8 * Page size = 1 + 8*65 = 521W Uint16 i; RESET_BANK_POINTER; // Reset Bank Pointer to enable search for current Bank RESET_PAGE_POINTER; // Reset Page Pointer to enable search for current Page // Find Current Bank // for(i=0;i<8;i++) for(i=0;i<3;i++) { Bank_Status[0] = *(Bank_Pointer); // Read contents of Bank Pointer if(Bank_Status[0] == EMPTY_BANK) // Check for Unused Bank { Bank_Counter = i; // Set Bank Counter to number of current page return; // If Bank is Unused, return as EEPROM is empty } if(Bank_Status[0] == CURRENT_BANK) // Check for In Use Bank { Bank_Counter = i; // Set Bank Counter to number of current bank Page_Pointer = Bank_Pointer + 1; // Set Page Pointer to first page in current bank break; // Break from loop as current bank has been found } if(Bank_Status[0] == USED_BANK) // Check for Used Bank Bank_Pointer += 521; // If Bank has been used, set pointer to next bank } // Find Current Page for(i=0;i<8;i++) { Page_Status[0] = *(Page_Pointer); // Read contents of Page Pointer // Check for Blank Page or Current Page if((Page_Status[0] == BLANK_PAGE) || (Page_Status[0] == CURRENT_PAGE)) { Page_Counter = i; // Set Page Counter to number of current page break; // Break from loop as current page has been found } if(Page_Status[0] == USED_PAGE) // Check for Used Page Page_Pointer += 65; // If page has been used, set pointer to next page } /* if (Bank_Counter==2 && Page_Counter==7) // Check for full EEPROM //7 { EEPROM_Erase(); // Erase flash sector being used as EEPROM RESET_BANK_POINTER; // Reset Bank Pointer as EEPROM is empty RESET_PAGE_POINTER; // Reset Pank Pointer as EEPROM is empty asm(" ESTOP0"); }*/ } //######################### EEPROM_GET_VALID_BANK ############################ //######################### EEPROM_CHK_SECTOR_END ############################ void EEPROM_ChkSectorEnd(void) { if (Bank_Counter==2 && Page_Counter==7) // Check for full EEPROM //7 { EEPROM_Erase(); // Erase flash sector being used as EEPROM RESET_BANK_POINTER; // Reset Bank Pointer as EEPROM is empty RESET_PAGE_POINTER; // Reset Pank Pointer as EEPROM is empty // asm(" ESTOP0"); } } //######################### EEPROM_CHK_SECTOR_END ############################ //############################# EEPROM_ERASE ################################# void EEPROM_Erase() { Uint16 Status; #ifdef F2809 // If F2809 is being used erase Sector H Status = Flash_Erase((SECTORH),&FlashStatus); #else // Otherwise erase Sector D for other devices Status = Flash_Erase((SECTORH),&FlashStatus); #endif if(Status != STATUS_SUCCESS) // If Erase fails halt program or handle error { asm(" ESTOP0"); } } //############################# EEPROM_ERASE ################################# //############################# EEPROM_READ ################################## void EEPROM_Read() { Uint16 i; EEPROM_GetValidBank(); // Find In Use Bank and Current Page // Transfer contents of Current Page to Read Buffer for(i=0;i<8;i++) // Read_Buffer[i] = *(++Page_Pointer); // flashreadpkt.flashbuf[i]= *(++Page_Pointer); flashreadpkt.flashbuf[i]= *(Page_Pointer+i+1); } //############################# EEPROM_READ ################################## Uint16 epromwriteStatus; //############################ EEPROM_WRITE ################################## void EEPROM_Write() { // Variables need for Flash API Functions Uint16 Status; Uint32 Length; FLASH_ST ProgStatus; EEPROM_GetValidBank(); // Find In Use Bank and Current Page EEPROM_ChkSectorEnd(); //If we reached end of sector eraze everything EEPROM_UpdatePageStatus(); // Update Page Status of previous page EEPROM_UpdateBankStatus(); // Updage Bank Status of current and previous bank // Program data located in Write_Buffer to current page Length = 64; // Set Length for programming //Status = Flash_Program(Page_Pointer+1,Write_Buffer,Length,&ProgStatus); //flashwritepkt Status = Flash_Program(Page_Pointer+1,flashwritepkt.flashbuf ,Length,&ProgStatus); epromwriteStatus=Status; // Modify Page Status from Blank Page to Current Page if flash programming was successful if (Status == STATUS_SUCCESS) { Page_Status[0] = CURRENT_PAGE; // Set Page Status to Current Page Length = 1; // Set Length for programming status Status = Flash_Program(Page_Pointer,Page_Status,Length,&ProgStatus); } } //############################ EEPROM_WRITE ################################## //###################### EEPROM_UPDATE_BANK_STATUS ########################### void EEPROM_UpdateBankStatus() { // Variables needed for Flash API Functions Uint16 Status; Uint32 Length; Length = 1; // Set Length for programming Bank_Status[0] = *(Bank_Pointer); // Read Bank Status from Bank Pointer Page_Status[0] = *(Page_Pointer); // Read Page Status from Page Pointer // Program Bank Status for Empty EEPROM if (Bank_Status[0] == EMPTY_BANK) { Bank_Status[0] = CURRENT_BANK; // Set Bank Status to In Use Bank // Program Bank Status to current bank Status = Flash_Program(Bank_Pointer,Bank_Status,Length,&ProgStatus); Page_Counter =0; Page_Pointer = Bank_Pointer + 1; // Set Page Pointer to first page of current bank } // Program Bank Status of full bank and following bank if (Bank_Status[0] == CURRENT_BANK && Page_Counter == 7) { Bank_Status[0] = USED_BANK; // Set Bank Status to Used Bank // Program Bank Status to full bank Status = Flash_Program(Bank_Pointer,Bank_Status,Length,&ProgStatus); Bank_Pointer +=521; // Increment Bank Pointer to next bank Bank_Status[0] = CURRENT_BANK; // Set Bank Status to In Use Bank // Program Bank Status to current bank Status = Flash_Program(Bank_Pointer,Bank_Status,Length,&ProgStatus); Page_Counter =0; Page_Pointer = Bank_Pointer +1; // Set Page Pointer to first page of current bank } } //###################### EEPROM_UPDATE_BANK_STATUS ########################### //###################### EEPROM_UPDATE_PAGE_STATUS ########################### void EEPROM_UpdatePageStatus() { // Variables needed for Flash API Functions Uint16 Status; Uint32 Length; Bank_Status[0] = *(Bank_Pointer); // Read Bank Status from Bank Pointer Page_Status[0] = *(Page_Pointer); // Read Page Status from Page Pointer // Check if Page Status is blank. If so return to EEPROM_WRITE. if(Page_Status[0] == BLANK_PAGE) return; // Program previous page's status to Used Page else { Page_Status[0] = USED_PAGE; // Set Page Status to Used Page Length = 1; // Set Length for programming Status = Flash_Program(Page_Pointer,Page_Status,Length,&ProgStatus); Page_Pointer +=65; // Increment Page Pointer to next page } } //###################### EEPROM_UPDATE_PAGE_STATUS ########################### //###################### EEPROM_GET_SINGLE_POINTER ########################### void EEPROM_GetSinglePointer(Uint16 First_Call) { Uint16 *End_Address; End_Address = (Uint16 *)END_OF_SECTOR; // Set End_Address for sector if(First_Call == 1) // If this is first call to function, find valid pointer { RESET_BANK_POINTER; // Reset Bank Pointer to beginning of sector while(*(Bank_Pointer) != 0xFFFF) // Test each location for data Bank_Pointer++; // Increment to next location } if(Bank_Pointer >= End_Address) // Test if sector is full { EEPROM_Erase(); // Erase flash sector being used as EEPROM RESET_BANK_POINTER; // Reset Bank Pointer as EEPROM is empty asm(" ESTOP0"); } } //###################### EEPROM_GET_SINGLE_POINTER ########################### //##################### EEPROM_PROGRAM_SINGLE_BYTE ########################### void EEPROM_ProgramSingleByte(Uint16 data) { // Variables needed for Flash API Functions Uint16 Status; Uint32 Length; Write_Buffer[0] = data; // Prepare data to be programmed Length = 1; // Set Length for programming Status = Flash_Program(Bank_Pointer++,Write_Buffer,Length,&ProgStatus); EEPROM_GetSinglePointer(0); // Test for full sector } //##################### EEPROM_PROGRAM_SINGLE_BYTE ###########################
// TI File $Revision: /main/1 $ // Checkin $Date: December 1, 2004 11:12:01 $ //########################################################################### // // FILE: DSP280x_MemCopy.c // // TITLE: Memory Copy Utility // // ASSUMPTIONS: // // // // DESCRIPTION: // // This function will copy the specified memory contents from // one location to another. // // Uint16 *SourceAddr Pointer to the first word to be moved // SourceAddr < SourceEndAddr // Uint16* SourceEndAddr Pointer to the last word to be moved // Uint16* DestAddr Pointer to the first destination word // // No checks are made for invalid memory locations or that the // end address is > then the first start address. // // //########################################################################### // $TI Release: DSP280x, DSP2801x Header Files V1.41 $ // $Release Date: August 7th, 2006 $ //########################################################################### #include "DSP2803x_Device.h" void MemCopy(Uint16 *SourceAddr, Uint16* SourceEndAddr, Uint16* DestAddr) { while(SourceAddr < SourceEndAddr) { *DestAddr++ = *SourceAddr++; } return; } //=========================================================================== // End of file. //===========================================================================
* // TI File $Revision: /main/4 $ // Checkin $Date: November 9, 2009 15:09:12 $ //########################################################################### // // FILE: F2808.cmd // // TITLE: Linker Command File For F2808 Device // //########################################################################### // $TI Release: F2803x Support Library v2.01.00.00 $ // $Release Date: Sun Sep 29 07:32:51 CDT 2019 $ // $Copyright: // Copyright (C) 2009-2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### */ /* ====================================================== // For Code Composer Studio V2.2 and later // --------------------------------------- // In addition to this memory linker command file, // add the header linker command file directly to the project. // The header linker command file is required to link the // peripheral structures to the proper locations within // the memory map. // // The header linker files are found in <base>\DSP2803x_Headers\cmd // // For BIOS applications add: DSP2803x_Headers_BIOS.cmd // For nonBIOS applications add: DSP2803x_Headers_nonBIOS.cmd ========================================================= */ /* ====================================================== // For Code Composer Studio prior to V2.2 // -------------------------------------- // 1) Use one of the following -l statements to include the // header linker command file in the project. The header linker // file is required to link the peripheral structures to the proper // locations within the memory map */ /* Uncomment this line to include file only for non-BIOS applications */ /* -l DSP2803x_Headers_nonBIOS.cmd */ /* Uncomment this line to include file only for BIOS applications */ /* -l DSP2803x_Headers_BIOS.cmd */ /* 2) In your project add the path to <base>\DSP2803x_headers\cmd to the library search path under project->build options, linker tab, library search path (-i). /*========================================================= */ /* Define the memory block start/length for the F28035 PAGE 0 will be used to organize program sections PAGE 1 will be used to organize data sections Notes: Memory blocks on F2803x are uniform (ie same physical memory) in both PAGE 0 and PAGE 1. That is the same memory region should not be defined for both PAGE 0 and PAGE 1. Doing so will result in corruption of program and/or data. L0 memory block is mirrored - that is it can be accessed in high memory or low memory. For simplicity only one instance is used in this linker file. Contiguous SARAM memory blocks or flash sectors can be be combined if required to create a larger memory block. */ MEMORY { PAGE 0: /* Program Memory */ /* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE1 for data allocation */ RAML0 : origin = 0x008000, length = 0x000800 /* on-chip RAM block L0 */ RAML1 : origin = 0x008800, length = 0x000400 /* on-chip RAM block L1 */ OTP : origin = 0x3D7800, length = 0x000400 /* on-chip OTP */ FLASHH : origin = 0x3E8000, length = 0x002000 /* on-chip FLASH */ FLASHG : origin = 0x3EA000, length = 0x002000 /* on-chip FLASH */ FLASHF : origin = 0x3EC000, length = 0x002000 /* on-chip FLASH */ FLASHE : origin = 0x3EE000, length = 0x002000 /* on-chip FLASH */ FLASHD : origin = 0x3F0000, length = 0x002000 /* on-chip FLASH */ FLASHC : origin = 0x3F2000, length = 0x002000 /* on-chip FLASH */ FLASHA : origin = 0x3F6000, length = 0x001F80 /* on-chip FLASH */ CSM_RSVD : origin = 0x3F7F80, length = 0x000076 /* Part of FLASHA. Program with all 0x0000 when CSM is in use. */ BEGIN : origin = 0x3F7FF6, length = 0x000002 /* Part of FLASHA. Used for "boot to Flash" bootloader mode. */ CSM_PWL_P0 : origin = 0x3F7FF8, length = 0x000008 /* Part of FLASHA. CSM password locations in FLASHA */ IQTABLES : origin = 0x3FE000, length = 0x000B50 /* IQ Math Tables in Boot ROM */ IQTABLES2 : origin = 0x3FEB50, length = 0x00008C /* IQ Math Tables in Boot ROM */ IQTABLES3 : origin = 0x3FEBDC, length = 0x0000AA /* IQ Math Tables in Boot ROM */ ROM : origin = 0x3FF27C, length = 0x000D44 /* Boot ROM */ RESET : origin = 0x3FFFC0, length = 0x000002 /* part of boot ROM */ VECTORS : origin = 0x3FFFC2, length = 0x00003E /* part of boot ROM */ PAGE 1 : /* Data Memory */ /* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE0 for program allocation */ /* Registers remain on PAGE1 */ BOOT_RSVD : origin = 0x000000, length = 0x000050 /* Part of M0, BOOT rom will use this for stack */ RAMM0 : origin = 0x000050, length = 0x0003B0 /* on-chip RAM block M0 */ RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */ RAML2 : origin = 0x008C00, length = 0x000400 /* on-chip RAM block L2 */ RAML3 : origin = 0x009000, length = 0x001000 /* on-chip RAM block L3 */ FLASHB : origin = 0x3F4000, length = 0x002000 /* on-chip FLASH */ } /* Allocate sections to memory blocks. Note: codestart user defined section in DSP28_CodeStartBranch.asm used to redirect code execution when booting to flash ramfuncs user defined section to store functions that will be copied from Flash into RAM */ SECTIONS { /* Allocate program areas: */ .cinit : > FLASHA PAGE = 0 .pinit : > FLASHA, PAGE = 0 /* .text : > FLASHA PAGE = 0 */ .text : >> FLASHD | FLASHC | FLASHA, PAGE = 0 codestart : > BEGIN PAGE = 0 Flash28_API: { -lFlash2803x_API_V100.lib(.econst) -lFlash2803x_API_V100.lib(.text) } LOAD = FLASHA, RUN = RAML0, LOAD_START(_Flash28_API_LoadStart), LOAD_END(_Flash28_API_LoadEnd), RUN_START(_Flash28_API_RunStart), PAGE = 0 ramfuncs : LOAD = FLASHD, RUN = RAML0, LOAD_START(_RamfuncsLoadStart), LOAD_END(_RamfuncsLoadEnd), RUN_START(_RamfuncsRunStart), PAGE = 0 csmpasswds : > CSM_PWL_P0 PAGE = 0 csm_rsvd : > CSM_RSVD PAGE = 0 /* Allocate uninitalized data sections: */ /* .stack : > RAMM1 PAGE = 1 */ /* change this to Raml3 */ .stack : > RAML3 PAGE = 1 /* .stack : >> RAMM1 | RAMM0, PAGE = 1 8/ /* .stack : > RAMM0 PAGE = 1 */ .ebss : > RAML2 PAGE = 1 .esysmem : > RAML2 PAGE = 1 /* Initalized sections go in Flash */ /* For SDFlash to program these, they must be allocated to page 0 */ .econst : > FLASHA PAGE = 0 .switch : > FLASHA PAGE = 0 /* Allocate IQ math areas: */ IQmath : > FLASHA PAGE = 0 /* Math Code */ IQmathTables : > IQTABLES, PAGE = 0, TYPE = NOLOAD /* Uncomment the section below if calling the IQNexp() or IQexp() functions from the IQMath.lib library in order to utilize the relevant IQ Math table in Boot ROM (This saves space and Boot ROM is 1 wait-state). If this section is not uncommented, IQmathTables2 will be loaded into other memory (SARAM, Flash, etc.) and will take up space, but 0 wait-state is possible. */ /* IQmathTables2 : > IQTABLES2, PAGE = 0, TYPE = NOLOAD { IQmath.lib<IQNexpTable.obj> (IQmathTablesRam) } */ /* Uncomment the section below if calling the IQNasin() or IQasin() functions from the IQMath.lib library in order to utilize the relevant IQ Math table in Boot ROM (This saves space and Boot ROM is 1 wait-state). If this section is not uncommented, IQmathTables2 will be loaded into other memory (SARAM, Flash, etc.) and will take up space, but 0 wait-state is possible. */ /* IQmathTables3 : > IQTABLES3, PAGE = 0, TYPE = NOLOAD { IQmath.lib<IQNasinTable.obj> (IQmathTablesRam) } */ /* .reset is a standard section used by the compiler. It contains the */ /* the address of the start of _c_int00 for C Code. /* /* When using the boot ROM this section and the CPU vector */ /* table is not needed. Thus the default type is set here to */ /* DSECT */ .reset : > RESET, PAGE = 0, TYPE = DSECT vectors : > VECTORS PAGE = 0, TYPE = DSECT } /* //=========================================================================== // End of file. //=========================================================================== */
Hello Ramesh,
I assume that by status codes 30 and 31 you're referring to the return status for the Flash API:
When you ran your program, did you verify that the Flash was erased? At what line in your above code are you getting the error status?
While running the code the eeprom write works for 1st 3 to 6 times and then fails with status code as 30 or 31 and code also crashes and controller resets.
Are the status code and crash/reset independent issues, or when there's an error status the code crashes and resets? How are you detecting if the device resets?
Best regards,
Omer Amir
Hi Omer Amir,
Thanks for the quick response.
"I assume that by status codes 30 and 31 you're referring to the return status for the Flash API:"
Yes. I am referring to the return status of Flash APi.
Actually I assumed all the flash memory is erased every time I do 'run' from CCS( Not sure if I am correct). I did not erase that sector explicitly.
The crash and error status coincide. Whenever flash api returns error status, the code crashes and resets. I have enabled watchdog in the code. However as per api documentation the watchdog is disabled when the api is called. After reset I can also see the WDFLAG is set in WDCR register.
Regards,
Ramesh
I browsed the flash memory at the location and all shows 0xFFFF.
During successful writes I can see the memory as below
0x003E8042
00FF 0000 0000 0000
0000 0000 0000 8A08 FFFF
0020 493E 0003 FFFF 8A0B
0034 0100 001F FFFF FFFF
FFFF FFFF FFFF FFFF FFFF
FFFF FFFF FFFF FFFF
After failures Every page is filled with following data( not only the page I am writing).
0000 0000 0000 0000
0000 0000 0000 8A08 FFFF
0020 493E 0003 FFFF 8A0B
0034 0100 001F FFFF FFFF
FFFF FFFF FFFF FFFF FFFF
FFFF FFFF FFFF FFFF
Attaching the screenshot of watch window to track Bank pointer and page pointer
Hello Ramesh,
If you step through your code, are you able to find out at what point that Flash memory is being erased/programmed? Flash erasures happen at a sector level, so it looks like the program happened not as expected after it was erased. If my understanding is incorrect, let me know.
Best regards,
Omer Amir
Hi Omer Amir,
The flash memory is erased during the downloading of code in CCS. After that it is not erased. As per the code erase will happen after 3 banks are used and we have not reached that level. The problem happens after 1st bank 3rd page or 2nd bank 2nd page. If I comment EEPROM_Write(); the code does not crash. So my assumption is some issue with EEPROM_Write();
Regards,
Ramesh
Hello Ramesh,
You mentioned in your initial post that you followed an application report and then made some modifications based on your program; did you confirm that the project worked fine when just following that document? Can you one-by-one test individual changes you made (if this applies)?
If I comment EEPROM_Write(); the code does not crash. So my assumption is some issue with EEPROM_Write();
Can you further narrow down the issue by stepping into the function and running line-by-line? Ideally we should find the instruction or set of instructions which are causing the issue, and then narrow down the issue in memory.
Best regards,
Omer Amir
Hi Omer Amir,
Sorry, I was on vacation. I solved the problem by Disabling the interrupts before calling EEPROM_Write(); function. It works fine.
Regards,
Ramesh