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.

get an error when updating eprom

Other Parts Discussed in Thread: HALCOGEN

I get this error when writing to the eeprom

flashErrorReal
        b        flashErrorReal        ; branch here forever as continuing operation is not recommended

the reads work fine but doing a write to it causes the error listed above -trying to write to block 1

I have number of EEPS set to 1

number of FEE blocks as 2

block size 64 byte for each

number of virtual sectors 2

virtual sectors for EEP = 0

total number of flash sectors = 4 and the max number is 4

any ideas what the issue is?  the TI FEE guide does not mention it at all

  • Hi Steven,
    Looks like you are getting an abort. Can you please find out what led to the abort exception by reading out the DFSR (Data Fault Status Register) and the DFAR (Data Fault Address Register). These are status registers inside the CPU that will help identify the cause of the abort.
  • the data is: CP15_DATA FAULT STATUS shows 0x0000080D

    The CP15_DATA FAULT ADDRESS is : 0xFFF87040
  • Hi Steven,
    You have a permission fault. And the fault address is a register in the flash controller. Do you have the MPU configured such that only privileged mode write access to the flash controller is allowed? It looks like the CPU is operating in user mode while trying to access a region that is privileged mode protected.
  • I dont have it in user mode on purpose - it must be something that CCS is setting on its own?
    can you tell me how to force the CPU to be in privileged mode always?
    is there an example in C of how to set privileged mode always?
  • Let's make sure you are in user mode and hence what happened. Can you read out the CPSR (Current Program Status Register) register? Read this register just before you start the FEE. The lower 5 bits are the M bits which indicates what mode the CPU is in. If the CPU is in user mode then the M bits will be b10000. If the CPU is in system mode then the M bits will be b11111. Please refer to the CortexR4 TRM for details.

    Normally HalCoGen will put the device in system mode after startup which should allow you to write to the flash wrapper. So I will be surprised that you are not in system mode. Perhaps you are indeed in system mode. If that is the case then we need to investigate further.

    You can go to HalCoGen->Help->Help Topics->Examples and you will find example_TI_Fee_Write_Read.c. Did you use this example to create your FEE project? If not, please take a look at the example to see if you can get it working.
  • I did use the example as the basis for my code

    below it is listed . Im always using BlockNumber of 1

    looks like the BlockNumber=1 was written once successfully, but when i try to change the values, I get the error mentioned previously - could it be that I dont understand how to properly use your eeprom instead of a privilege thing?

    .....my code (based on the example)

    static uint8_t EEtestIdle(void)
    {
      uint16_t dummycnt=0x0000FFU;
      uint16_t timeout = 0;
      uint16_t Status;
      uint8_t flag = 1;

      do
          {
            TI_Fee_MainFunction();
            do
            {
              dummycnt--;
            }
            while(dummycnt>0);
            Status=TI_Fee_GetStatus(0 );
            timeout++;
            if (timeout == 100)
            {
                flag = Status;
                break;
            }
          }
          while(Status!= IDLE);
            return flag;

    }

    /*! eeprom_Initialize
     Initialize the TMS570 eeprom. This will create Virtual sectors,
     initialize global variables etc
    */
    void eeprom_Initialize(void)
    {
      uint16_t loop;
      /* Initialize RAM array.*/
        for(loop=0; loop < EE_BLK_SIZE; loop++)
        {
          eepromRamBlock[loop] = loop;
        }
        // Initialize FEE.
        TI_Fee_Init();
        EEtestIdle();
    }

    /*! eepromWrite
    eeprom write of a block (64 bytes currently)

    Input:
      \par BlockNumber - the block number to write (up to 64 bytes)
      can be block 1 or 2
    */
    void eepromWrite (uint16_t BlockNumber)
    {
      TI_Fee_WriteAsync(BlockNumber, &eepromRamBlock[0]);
      EEtestIdle();
    }

    /*! eeprom_read
    eeprom read of parameters - invoked at bootup by cfg load

    Input:
      \par BlockNumber - the block number to read (up to 64 bytes) 1 or 2
      \par BlockOffset - where in the block to start reading
      \par Length - the number of bytes to read

      \ret return pass (0) or fail (-1) status
    */
    int8_t eeprom_read(uint16_t BlockNumber, uint16_t BlockOffset, uint16_t Length)
    {
      Std_ReturnType oResult;
      uint8_t *Read_Ptr = eepromRamBlock;

      oResult=TI_Fee_Read(BlockNumber,BlockOffset,Read_Ptr,Length);
      if (oResult != E_OK)
      {
        return -1;
      }
      else
      {
        return 0;
      }

    }

  • ....looks like the M register is 10000 ...so it is in user mode - for the life of me I cant find in the documentation how to set this thing for system mode ? - ho do you do it?
  • You did not mention which device you are working with, but as Charles mentioned HALCoGen leaves the device in system mode. That is done in the function _coreInitRegisters_ in the file sys_core.asm (or HL_sys_core.asm depending on which device). Could you have code, maybe written by someone else, that changes it to user mode? You have to do an SVC interrupt to change to a privileged mode from user mode. It will be simpler if you can find where the code is changing from system mode to user mode and disable that change.
  • the device is TMS3137 - using FreeRTOS, which apparently places the device in USER mode. I got it to execute the EE flash write by using a privileged task call (now it I can only get the write to actually work!)
  • Should we close this thread and continue the FEE debug in:
    e2e.ti.com/.../534542