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.

F05 Flash API TMS470 Problem

Other Parts Discussed in Thread: TMS470R1B1M

I am working on developing code for products which will be using the SM470R1B1M-HT and I am using the TMS-FET470A256 development kit to get started with my code. The environment I am using is the IAR Embedded Workbench for ARM 6.10 Kickstart and I have downloaded the Flash API, "Flash API Modules: Version 0.36" and included its header files into my project. In order to use the functions such as, "Flash_Compact_B" outlined in the document F05a_api  which was included in the "Flash API Modules: Version 0.36" download I inserted them into a source file in my project.

 

The problem I am having is that I can not seem to get any of the Flash API functions to work (or at least verify that they work). For instance, I am trying to use the "Flash_Compact_B" function and verify with its return value that using it was succesful. But when I try to run my program it will call the "Flash_Compact_B" function and it will start executing the code in that function. The "Flash_Compact_B" function at one point calls the "init_state_machine" function and it appears to execute at that code fine and then returns to the "Flash_Compact_B" function. A few more lines are executed and then the "Flash_Compact_B" function calls the "Flash_Track_Pulses_V" function. In the "Flash_Track_Pulses_V" function is where the program hangs. The program gets stuck in the "do-while" loop that checks the value of the variable, "state". The variable "state" being the value stored the the location cntl[WSMREG]. The problem is that cntl[WSMREG] never seems to be equal to CMPCT_PULSE_ACTIVE (or ERASE_PULSE_ACTIVE for that matter) and is so the code always forces the condition "state=0xffffffff". I have read the value of at different point throughout the codes execution and cntl[WSMREG] never seems to change. I have looked through the various header files and I can not find any indication as to what might cause the value at cntl[WSMREG] to change. So I'm stuck. Any ideas as to what my problem might be? Any help would be greatly appreciated. Below is the code which I think would be pertinent to this conversation.

In order to access the flash and use the Flash API functions I have done the following;

  // Set the bits for the address of the flash (0x00008000)

  MFBALR0 |= ( 1 << BIT15 );

  // Set memory block size to 1K

  MFBALR0 |= ( 1 << BIT4);

  // Documentation says "You must clear this bit to 0."

  MFBALR0 &= ~( 1 << BIT3);

  // Enable memory map select

  MFBALR0 |= ( 1 << BIT8) ;

 // Defining the inputs for the Flash_Compact_B function

  volatile UINT32 fregbase = 0xffe88000;
  volatile UINT32  *fcntl = &fregbase;
  unsigned int fdelay = 7;
  UINT32 fbase = 0x8000;
  UINT32 *fstart = &fbase;
  FLASH_STATUS_ST *fstat;

// Executing the Flash_Compact_B function and printing a character "Y" or "N" to determine if compaction was successful.

temp = Flash_Compact_B(fstart,
                     FLASH_CORE0,
                     FLASH_SECT0,
                     fdelay,
                     fcntl,
                     fstat
                     );

    if (temp == 1)
    {
      PrintChar('Y');
    }
    else
    {
      PrintChar(N);
    }

Thanks,

William

  • Hi William,

    This is the forum to support only TMS570 series of devices,

    Please be aware that the TMS470R1 Series (including the TMS470R1VF48 device) is not recommended for new designs.  Please see the full 'NRDN' notice here.

    Soon TI will be launching the new TMS470M series of microcontrollers.  This series will feature greater ARM CPU performance and a similar peripherial set to the TMS470R1 Series of microcontrollers.  Please come back soon for more information about the TMS470M Series of microcontrollers.  The product preview for the first two microcontrollers in the TMS470M series is available here: TMS470MF0660x - SPNS157. The TMS470M Series Technical Reference Manual is available here: TMS470M TRM.

    If you are just getting started with the TMS470R1VF48 microcontroller, I would highly recommend looking into using one of the TMS470M Series of microcontrollers instead. 

    I have forwarded your query to one of our Flash expert, I will get back to you as soon as I get some comments.

    Best Regards

    Prathap

  • William ,

    Could you try erase and see how it responds ?

    I tried the erase routine (attached for F035) and was working fine for me.

    Regards,2845.FCI_AllSecErase_NonPipe.c

    Pratip

     

  • I am using TMS470R1B1M FLASH F05 API http://www.ti.com/litv/zip/spnc031. My environment is  IAR Embedded Workbench for ARM 6.1 .

    I'm facing the same problem as Wiiliam Thomas i.e the program gets hung up during the execution of flash_track_pulses_v(do-while loop) which the Flash_compact function calls for.

    My aim is to erase a sector. Hence I wanted to compact it before calling the erase function. Any help would be greatly appreciated!

    Below is the code -

    int main()
    {

      volatile UINT32 fregbase = 0xffe88000;
      FLASH_ARRAY_ST cntl = &fregbase;                         //giving the base address of flash control registers
      UINT32 delay = 7;

      FLASH_STATUS_ST *status;
        UINT32 x;
      

      BOOL compval = Flash_Compact_B((void *)0x00010000,FLASH_CORE0,FLASH_SECT1,delay,cntl,(void *)&x) ; //gave the sector start address which is /////////////////0x00010000,core value and sector number, delay value is 7, cntl and a variable to the status
      
      BOOL temp =  Flash_Erase_Sector_B((void *)0x00010000,(64*1024)/4,FLASH_CORE0 ,FLASH_SECT1 , delay,cntl);
      
     if (temp==1)
      
     {
       return(1);
     }
     
     
      return 0;
    }
     
     
     

     

  • Surya,
     
    You should consider trying to erase with Flash470 first , to confirm if Flash and your hardware is setup fine.
    What would be your osciallotor frequency and is your PLL on ?
    Could you try the compaction or erase with a lower oscillator frequency for the sector 0 to start with.
     
    F05 is a little obsolete technology at the moment , so I don't have the hardware with me now.
    But I'm sure the APIs were stable and was performing well with the controller.
     
     
    Best Regards,
    Pratip
  • This time, I tried the Flash_Erase_Sector_B function which doesn’t call for the track_pulses function. In this case, the program looks like going into an infinite loop.

    It just doesn’t come out of the below loop(keeps feeding dog)

     

    /* feed watchdog timer until BUSY bit goes low */

        do {

         Feed_Watchdog_V();

          k=cntl[MSTAT];CLEAN(k);

        } while (k&0x100);

     

    I don’t understand why the busy bit doesn’t go low. I know it’s a read-only bit. What could possibly go wrong?

     

     Why doesn’t the API call for the MATCH KEY FUNCTION which loads the values into the FMPKEY register? I’ve read in the F05 reference guide that correct keys must be passed into the FMPKEY register(for b1m) but I did not come across this thing in the API….

     

  • Surya,

    Sorry for the delayed reply. Let me know if you are still facing this same issue or you have got any progress.

    -Pratip

     

  • It is up to the user to call the Flash_Match_Key_B() before performing any Flash operation on the device.  Without calling this function, any other flash operation would generate illegal accesses.

  • please help me out i am facing the same problem...it will be very helpful if you provide some sample code for this Flash Api for the same version...i am stuck....

    Reply expected.

    Amjad

  • Amjad,

    I need an exact description of the problem you are experiencing to see if I can help.  Also, posting your code would help.

  • I have the same problem for TMS470R1B1M FLASH

    Do any one have successful experience?

     

    Thanks

    peter