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.

Programming using Flash APIs

Other Parts Discussed in Thread: TMS570LS20216

Hi,

I am working on boot loader development for Hardware having TM570LS20216. I have observed that time taken to erase the Flash contents is fine but the time taken fro Programming is too large. I am trying to write 2-9 sectors of Bank0 (0 and 1 sectors are allocated for my boot loader). upon debugging observed that control is remains for much time in Feed_Watchdog_V function.

Request to update me on:

1.Why Feed_Watchdog_V function is required

2.Probable reasons of Why Programming may take long time.

3. Will there be any improvement if HCLK is increased.

 

Please suggest as the time it is consuming to program is not acceptable for our use.

 

Thanks in avdvance,

Hemchand

 

  • Hello Hemchand,

    Without knowing which API functions and sequence you are using to program the Flash, I could only speculate on why you are observing long programming times.  Due to the looping nature of some of the functions in the API and depending on the time those functions take, Feed_Watchdog_V() is called to service either the internal or an external watchdog timer.  If you do not need the watchdog to be feed, you can override the API function to be a null function.

    FClk which is the Flash Clock speed is based off of HClk.  Maximum FClk for the TMS570LS20216 device is 20MHz, so optimal HClk settings for flash performance can be calculated.  The formula is FCLK = HCLK / (RWAIT + 1).  Note: Pipeline mode does not support zero waitstates.  If RWAIT is 0, 1 waitstate is automatically added.

  • John,

    I am using pf035a_api.lib and function Flash_Prog_B to Program. Logic written reads every record from input .s37 file and programs the contents into Flash area by calling Flash_Prog_B. Request you to please share how can I override Feed_Watchdof_V(). Will be source code of pf035a_api.lib will be available for editing and compiling, so the I can override the contents to NULL.

  • The way to override Feed_Watchdog_V() is to compile your own version and override the library version at link time.  TI will only guarantee Flash programming when the TI supplied object library is used.

     

    The more tunable way to program is to use the Flash_Start_Prog_B().

     

    Psuedo Code

     

    setup_state_machine(<beginning address of bank to be programmed>,

                                                    <Flash Bank to be programmed>,

                                                    <Delay parameter from API document>,

                                                    <Base address of Flash Register>);

     

    for(x=0; x < [number of 32bit words to program]; x++)

    {

                    Flash_Start_Prog_B(<Address of data to be programmed>,

                                                                    <32 bit word to be programmed>,

                                                                    <Flash Bank of address to be programmed>,

                                                                    <Delay parameter from API document>,

                                                                    <Base address of Flash Register>);

                    while((result = Flash_Status_U16(<Base address of Flash Register>)) & 0x100) /* check for Ready/Busy status */

                    {

                    }

    }

  • Hello Hemchand:

    Could you confirm if the provided answer solved your questions?

    Regards

    Enrique.

  • Hi John,

    I'm using a system with a 100ms watchdog, and since Feed_Watchdog_V claims to be run every 200ms, this won't work for me.  I assume I can use the above code snippet with Flash_Start_{Prog, Erase, Compact}_B and put my watchdog code inside the while loop to be run periodically.  Is this the recommended course of action in my case?

    Is there any performance penalty to using this code instead of Flash_Prog_B?

    Thanks!

    Tom

  • Tom,

    Yes, this would be my recommended course of action.  I would not expect a performance penalty and it gives you the capability to do other things like downloading the next set of data, service the watchdog on your own schedule, etc.