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.

Why Flash_Compact_B cause TMS470MF06607 reset?

Other Parts Discussed in Thread: TMS470MF06607, HALCOGEN

My code is:

     BOOL mt0=Flash_Compact_B(0x00000000,0,i,50,(FLASH_ARRAY_ST)0xFFE87000,&status);

The PIN95(VCCP) of the TMS470mf06607 connect 3.3V,But run at Flash_Compact_B,System reset!

I want to save my data to flash and after read data from flash in my program and system is not able to  reset.

Who can tell me the because?Thank you!

  • Hello:

    I have forwarded your issue to our Flash API expert. He should get back with you soon.

  • Hello dong lu,

    Request you to provide the following details so that I can undestand the scenario better:

    1. What is the version of the Flash API ?

    2. What are the steps performed before calling the Flash_Compact_B() function?

    3. Is the code executed from RAM or Flash?

     

    Best Regards,

    Siddharth

     

     

  • Hi, .Tank your help!

    1,I Use Flash the f035 .In  my program ,I use 

          #include "f035.h"

          #include "flash470.h"

    2.  I call  the Flash_Compact_B() in main

       void main(void)
        {
         int i=0,j=0;
         FLASH_STATUS_ST status;
        sciInit();
        sciEnableNotification(sciREG1,SCI_TX_INT);
        NVIC_enable();

        //rti

        rtiInit();
         rtiEnableNotification(rtiNOTIFICATION_COMPARE0);
        rtiStartCounter(rtiCOUNTER_BLOCK0);
        NVIC_enable();

        / /0ut clock
        _set_ecp_clk();
        for(i=0;i<10;i++)
       {
         BOOL mt0=Flash_Compact_B(0x00000000,0,i,50,(FLASH_ARRAY_ST)0xFFE87000,&status);
      }
        //BOOL mt1=Flash_Erase_Bank_B(0x00000000,0x80000,0,50,(FLASH_ARRAY_ST)0xfff87000,&status);

      while(1)
      {

       }

    3 I use the halcogen create the program .I'm newer and donnot know executed framram or flash,The linkcmd is:

      

    MEMORY
    {
    VECTORS (X) : origin=0x00000000 length=0x00000100
    STACKS (RW) : origin=0x08000000 length=0x00000800
    FLASH0 (RX) : origin=0x00000100 length=0x0007FEFF+1
    FLASH1 (RX) : origin=0x00080000 length=0x0001FFFF+1
    RAM (RW) : origin=0x08000800 length=0x0000F800

    /* USER CODE BEGIN (2) */
    /* USER CODE END */
    }

    SECTIONS
    {
    .intvecs : {} > VECTORS
    .text : {} > FLASH0 | FLASH1
    .const : {} > FLASH0 | FLASH1
    .cinit : {} > FLASH0 | FLASH1
    .pinit : {} > FLASH0 | FLASH1
    .bss : {} > RAM
    .data : {} > RAM
    .sysmem : {} > RAM

    .stack : /* SOFTWARE SYSTEM STACK */
    { /* initial stack pointer values */
    . += 0x00000400; _Stack_Table_Pointer = .;
    . += 0x00000400; _Stack_Handler_Pointer = .;
    } > STACKS

    /* USER CODE BEGIN (4) */
    /* USER CODE END */
    }

    You look this,tell me where my error is?,Thank you

  • Hi dong lu,

    I observe from the linker command file that the code is executed from Flash Bank 0 and also you are trying to erase Bank0 itself. This is not possible since  Flash memory is inaccessible for reads during erase operation which includes code execution until the operation has completed. You should modify the linker command file to execute the code from RAM. Please try executing the code from RAM and let me know your observations.

    Thanks,

    Siddharth

  • HI,Siddharth Deshpande,I do like you say,but The program run at the Flash_Compact_B() and stop. My program is:

    MEMORY
    {
    /*
    FLASH (RX) : origin=0x00000000 length=0x00007FFF
    VECTORS (RWX) : origin=0x08000000 length=0x00000100
    RAM (RWX) : origin=0x08000100 length=0x0000B700
    STACKS (RW) : origin=0x0800B800 length=0x00000800
    */

    VECTORS (X) : origin=0x00000000 length=0x00000100
    STACKS (RW) : origin=0x08000000 length=0x00000800
    FLASH0 (RX) : origin=0x00000100 length=0x0007FEFF+1
    FLASH1 (RX) : origin=0x00080000 length=0x0001FFFF+1
    RAM (RW) : origin=0x08000800 length=0x0000F800

    /* USER CODE BEGIN (2) */
    /* USER CODE END */
    }

     

    SECTIONS
    {

    .intvecs : {} > VECTORS
    .text : {} > FLASH0 | FLASH1
    .const : {} > FLASH0 | FLASH1
    .cinit : {} > FLASH0 | FLASH1
    .pinit : {} > FLASH0 | FLASH1
    .bss : {} > RAM
    .data : {} > RAM
    .sysmem : {} > RAM

    .stack :
    {
    . += 0x00000400; _Stack_Table_Pointer = .;
    . += 0x00000400; _Stack_Handler_Pointer = .;
    } > STACKS
    /* USER CODE BEGIN (4) */
    ramfuncs : LOAD = FLASH0,
    RUN = RAM,
    LOAD_START(__RamfuncsLoadStart),
    LOAD_END(__RamfuncsLoadEnd),
    RUN_START(__RamfuncsRunStart)
    /* USER CODE END */
    }

    main.c:

    void main(void)
    {
    // Must be done before any call to a function in RAM
    CopyRamFuncs();
    flashtest();
    while(1)
    {

    }

    }

    void flashtest(void)
    {
    int i=0,j=0;
    FLASH_STATUS_ST status;
    for(i=0;i<10;i++)
    {
      BOOL mt0=Flash_Compact_B(0x00000000,0,i,50,(FLASH_ARRAY_ST)0xFFE87000,&status);
    }
    //BOOL mt1=Flash_Erase_Bank_B(0x00000000,0x80000,0,50,(FLASH_ARRAY_ST)0xfff87000,&status);
    i=i+1;
    }

    void CopyRamFuncs( void )
    {
    char *src;
    char *end;
    char *dest;

    src = (char *)&__RamfuncsLoadStart;
    end = (char *)&__RamfuncsLoadEnd;
    dest = (char *)&__RamfuncsRunStart;
    while ( src < end )
    {
    *dest++ = *src++;
    }
    }

    I don not know  why.Can you give me an example or demo .(In your web ,have the "6712.flash-operation-demo.rar",But I can not download the file.My email is 13308019871@189.cn.Tank you very much!

  • Hi dong lu,

    Can you share your HalCoGen project and source code?  I will have a look at it and see if something is missing.

    Also, let me know what is the system frequency?

    Best Regards,

    Siddharth

     

     

     

  • hi, Deshpande。This is myproject.3480.mydingxiang(TI).rar.

    Thank you Help me to find the questions!

  • Hi dong lu,

    As mentioned earlier,  Flash operations cannot be carried out on the same bank which contains the executable code. Also I observed that the parameter passed to Flash_Compact_B function was incorrect :  FLASH_ARRAY_ST)0xFFE87000 should have been FLASH_ARRAY_ST)0xFFF87000.

    Have modified the linker command file to execute from RAM. Please refer the attached code and see if it solves your issue.

    Thanks,

    Siddharth

    mydingxiang(TI).zip
  • Hi,Siddharth.I do like you say,load my program to tms470mf06607 add the below code in sys.cmd.but it do not to work.

    MEMORY
    {


    VECTORS (X) : origin=0x00000000 length=0x00000100
    STACKS (RW) : origin=0x08000000 length=0x00000800
    FLASH0 (RX) : origin=0x00000100 length=0x0007FEFF+1
    FLASH1 (RX) : origin=0x00080000 length=0x00020000
    RAM (RW) : origin=0x08000800 length=0x00007000
    CODERAM (RW) : origin=0x08007800 length=0x00007800

    /* USER CODE BEGIN (2) */
    /* USER CODE END */
    }

    .

    SECTIONS
    {

    .intvecs : {} > VECTORS
    /* .flashapi : load = FLASH0, run = RAM, LOAD_START(FlashApi_LoadStart), LOAD_END(FlashApi_LoadEnd), LOAD_SIZE(FlashApi_LoadSize), RUN_START(FlashApi_RunStart), RUN_END(FlashApi_RunEnd), RUN_SIZE(FlashApi_RunSize),
    {
    pf035a_api_eabi.lib (.text)
    }*/
    .text : {} > CODERAM
    .const : {} > CODERAM
    .cinit : {} > CODERAM
    .pinit : {} > CODERAM
    .bss : {} > RAM
    .data : {} > RAM
    .sysmem : {} > RAM

    .stack :
    {
    . += 0x00000400; _Stack_Table_Pointer = .;
    . += 0x00000400; _Stack_Handler_Pointer = .;
    } > STACKS
    /* USER CODE BEGIN (4) */

    /* USER CODE END */
    }

    ...

    BOOL mt0=Flash_Compact_B(0x00000000,0,i,50,(FLASH_ARRAY_ST)0xFFF87000,&status);

    //////////////////////////////////////////////////////////////////////////

    but I change the below code ,it work

    .text : {} > FLASH0 | FLASH1
    .const : {} > FLASH0 | FLASH1
    .cinit : {} > FLASH0 | FLASH1
    .pinit : {} > FLASH0 | FLASH1
    .bss : {} > RAM
    .data : {} > RAM
    .sysmem : {} > RAM

    I do not understand  the"

     .flashapi : load = FLASH0, run = RAM, LOAD_START(FlashApi_LoadStart), LOAD_END(FlashApi_LoadEnd), LOAD_SIZE(FlashApi_LoadSize), RUN_START(FlashApi_RunStart), RUN_END(FlashApi_RunEnd), RUN_SIZE(FlashApi_RunSize),

    load((char *)FlashApi_LoadStart, (char *)FlashApi_RunStart,(unsigned int)FlashApi_LoadSize);

     "".if is it necessary?,I want the whole example to operate the flash for tms470mf06607,I hope you can help me.Tankk you!

  • Hi,Siddharth,I  had solved the question for Flash_Compact_B. Thank you very much to your help!