TMS320F28388D: Flash/EEPROM Memory Read Issues on CM Core

Part Number: TMS320F28388D

Tool/software:

Hello  and Team,

We are developing an EEPROM emulation feature on the TMS320F28388D. While the EEPROM emulation feature is working as expected on CPU1 and CPU2, we are currently trying to develop the same feature for the CM core as well.

/* Programming Commands */
#if defined(_C28X)
extern Fapi_StatusType Fapi_issueProgrammingCommand(
                                            uint32 *pu32StartAddress,
                                            uint16 *pu16DataBuffer,
                                            uint16  u16DataBufferSizeInWords,
                                            uint16 *pu16EccBuffer,
                                            uint16  u16EccBufferSizeInBytes,
                                            Fapi_FlashProgrammingCommandsType oMode
                                            );

extern Fapi_StatusType Fapi_issueProgrammingCommandForEccAddresses(
                                                           uint32 *pu32StartAddress,
                                                           uint16 *pu16EccBuffer,
                                                           uint16 u16EccBufferSizeInBytes
                                                           );
#else
extern Fapi_StatusType Fapi_issueProgrammingCommand(
                                                   uint32 *pu32StartAddress,
                                                   uint8  *pu8DataBuffer,
                                                   uint8  u8DataBufferSizeInBytes,
                                                   uint8  *pu8EccBuffer,
                                                   uint8  u8EccBufferSizeInBytes,
                                                   Fapi_FlashProgrammingCommandsType oMode
                                                   );

extern Fapi_StatusType Fapi_issueProgrammingCommandForEccAddresses(
                                                                  uint32 *pu32StartAddress,
                                                                  uint8 *pu8EccBuffer,
                                                                  uint8 u8EccBufferSizeInBytes
                                                                  );
#endif

We have identified changes in the above API, where the data type is specified as uint16 for CPU1 and CPU2, whereas it is defined as uint8 for CM core. (refer above code).

After replacing the C28x flash library with the CM flash library and modifying the data types, the functions for writing bank status, page status and page data to memory are now working correctly.

While reading the data from flash memory, it generates as NMI. 

uint8 Read_Buffer[DATA_SIZE] = {0};
EEPROM_Read(Read_Buffer);
    
void EEPROM_Read(uint8* Read_Buffer)
{
    uint16 i;
    if (Empty_EEPROM)
    {
        
    } else
    {
        EEPROM_GetValidBank(1);
        Page_Pointer += 16;             // data type is uint8  and globally declared
        for(i=0;i<DATA_SIZE;i++)
        {
            Read_Buffer[i] = *(Page_Pointer++);  // This code generates NMI
        }
    }

We have verified that during the copy operation, the page_pointer is correctly pointing to the intended memory location, which holds the page data.

Debug window message - Memory map prevented reading 0xFFFFFFF8 [code=0x20000]

The data was programmed with Fapi_AutoEccGeneration configuration option.

Flash configurations: 
Flash_initModule(FLASH0CTRL_BASE, FLASH0ECC_BASE, 4);
oReturnCheck = Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 125);
Flash_DisablePrefetch_SW_Workaround(FLASH0CTRL_BASE);
oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);
Flash_EnablePrefetch_SW_Workaround(FLASH0CTRL_BASE);

Could you please assist us in reading the EEPROM memory? Additionally, could you provide guidance on how to identify the root cause of the NMI being generated?

Thanks & regards,

Vikram Tathe

  • Vikram,

    I am currently looking into this and should have a response sometime tomorrow.

    Thanks,

    Alex

  • Hello Alex,

    Wanted to add one more observation with respect to above issue.

    We are using below APIs to test read and write operations.

    WriteDataToEEPROM();

    ReadDataFromEEPROM(); // Stuck at this operation. Generates an NMI and gets stuck in a while loop inside the NMI ISR.

    WriteDataToEEPROM();

    ReadDataFromEEPROM();

    WriteDataToEEPROM();

    ReadDataFromEEPROM();

    During a debug session, when it got stuck in a while loop inside the NMI ISR.

    I found that clicking on 'CPU reset' and then the 'restart' button to restart the debug session (without re-flashing the program) it is working as expected. Everything, including EEPROM read and write operations, worked as expected, and no NMI was generated.

    Thanks,

    Vikram

  • Hi Vikram,

    Could you try stepping though the disassembly and confirming the address is correct there?

    Thanks,

    Alex