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.

F035API Problem

Other Parts Discussed in Thread: TMS470MF06607

Hi,everybody.

I am working on bootloader development for hardware having TMS470MF06607. There are some question about FLASH Copmact,erase and program.

The configuration of project as:

1. Build properties - Application binary interface (-abi) is eabi .

2. Flsh lib select  -pf035a_abi_eabi.lib

3. PLL Config -clk =80MHZ;  Pipeline mode enable;  Flash Data wait state =2;

4. Disable all the interrupts and exceptions during Flash operation

The problem is that :The Function Flash_Compact_B Flash_Erase_B Flash_Prog_B  return false 

  • What are the values of the parameters are you passing to the functions?
  • typedef struct Sectors
    { void * start;
      unsigned int length;  // number of 32-bit words
      FLASH_CORE bank;
      unsigned int sectorNumber;
      unsigned int FlashBaseAddress;
    } SECTORS;
    typedef struct Banks
    { void * start;
      unsigned int length;  // number of 32-bit words
      unsigned int bankNumber;
      unsigned int FlashBaseAddress;
      unsigned int psa;
    } BANKS;

    #define NUMBEROFSECTORS 15
    const SECTORS sector[NUMBEROFSECTORS]=
    {
      (void *)0x00000000, 0x04000>>2, FLASH_CORE0, 0, 0xfff87000,
      (void *)0x00004000, 0x04000>>2, FLASH_CORE0, 1, 0xfff87000,
      (void *)0x00008000, 0x08000>>2, FLASH_CORE0, 2, 0xfff87000,
      (void *)0x00010000, 0x10000>>2, FLASH_CORE0, 3, 0xfff87000,
      (void *)0x00020000, 0x10000>>2, FLASH_CORE0, 4, 0xfff87000,
      (void *)0x00030000, 0x10000>>2, FLASH_CORE0, 5, 0xfff87000,
      (void *)0x00040000, 0x10000>>2, FLASH_CORE0, 6, 0xfff87000,
      (void *)0x00050000, 0x10000>>2, FLASH_CORE0, 7, 0xfff87000,
      (void *)0x00060000, 0x10000>>2, FLASH_CORE0, 8, 0xfff87000,
      (void *)0x00070000, 0x10000>>2, FLASH_CORE0, 9, 0xfff87000,
      (void *)0x00080000, 0x08000>>2, FLASH_CORE1, 0, 0xfff87000,
      (void *)0x00084000, 0x08000>>2, FLASH_CORE1, 1, 0xfff87000,
      (void *)0x00088000, 0x08000>>2, FLASH_CORE1, 2, 0xfff87000,
      (void *)0x0008C000, 0x08000>>2, FLASH_CORE1, 3, 0xfff87000,
      (void *)0x00090000, 0x10000>>2, FLASH_CORE1, 4, 0xfff87000

    };
    #define NUMBEROFBANKS 2
    const BANKS bank[NUMBEROFBANKS]=
    {
      (void *) 0x00000000, 0x80000>>2, 0, 0xfff87000, 0x00000000,
      (void *) 0x00080000, 0x20000>>2, 1, 0xfff87000, 0x00000000,
    };

    #define NUMBEROFECC_PARITYBANKS 4
    const BANKS ecc_parity[NUMBEROFECC_PARITYBANKS]=
    {
      (void *) 0x00400000, 0x40000>>2, 0, 0xfff87000, 0x00000000,
      (void *) 0x00440000, 0x40000>>2, 1, 0xfff87000, 0x00000000,
      (void *) 0x00480000, 0x40000>>2, 2, 0xfff87000, 0x00000000,
      (void *) 0x004C0000, 0x40000>>2, 3, 0xfff87000, 0x00000000
    };

    i=9;

    Flash_Compact_B(sector[i].start, sector[i].bank, (FLASH_SECT)sector[i].sectorNumber,
      delay, (FLASH_ARRAY_ST)sector[i].FlashBaseAddress,&status);

    Flash_Erase_B(sector[i].start,sector[i].length,sector[i].bank, (FLASH_SECT)sector[i].sectorNumber,
        delay, (FLASH_ARRAY_ST)sector[i].FlashBaseAddress,&status);

    Flash_Prog_B(sector[i].start,Flash_Data_start,256,sector[i].bank,delay,
     (FLASH_ARRAY_ST)sector[i].FlashBaseAddress,&status);

     

  • What is the value of delay?
  • Hi John,

    Ms Song is one of our key customers. Attached is a file that she sent us earlier, pls see if it will help you.

     

    6712.flash-operation-demo.rar

     

    Regards,

    Paul Ng

  • Song,

    Please change i (sector number) from 9 to 10. After that, you code will work.

    Reason:

    You can not erase/program the flash bank you are reading on. Sector 9 is in bank0. Your code is in Sector 0, which is also in bank0. That never works. This is one reason that you should copy your code to RAM if you want to erase/program sector 9. However, sector 10 is in bank1, so it works.

    Regards,

    Haixiao

  • SongWeiwei

    Here, I modified your code, copy the code from Flash to RAM, now you can erase the sector 9 without any problem.

    4846.flash-operation-demo.zip

    This also answer the question how to copy code from Flash RAM in your email.

    Note: in the code, I use

    (&_Prog_run_addr) & ~(0x1). This might not be necessary in M3 because M3 is thumb code only. You can change it to (&_Prog_run_addr). 

    ALL CONTENT AND MATERIALS OF THIS POST ARE PROVIDED "AS IS". TI AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY TI.

    Regards,

    Haixiao