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.

TMS320F28333: F28333 and F28335 flash API libraries in the same project?

Part Number: TMS320F28333

A user wants to make a single project that will run on both F28335 and F28333.  They want the software to determine needed settings at runtime using the PARTID register.  An issue is the flash API library.  They would like to incorporate both libraries into the project and decide which to use at runtime.

I think this is possible, but need confirmation.

First thing they need to do is call the specific top-level device functions instead of the #define common name functions.  For example, call Flash28333_Erase() instead of Flash_Erase().  The top-level functions are all listed in the Flash2833x_API_Library.h file.  For example:

#if FLASH_F28333
#define Flash_Erase(a,b)          Flash28333_Erase(a,b)
#define Flash_Program(a,b,c,d)    Flash28333_Program(a,b,c,d)
#define Flash_Verify(a,b,c,d)     Flash28333_Verify(a,b,c,d)
#define Flash_ToggleTest(a,b)     Flash28333_ToggleTest(a,b)
#define Flash_DepRecover()        Flash28333_DepRecover()
#define Flash_APIVersionHex()     Flash28333_APIVersionHex()
#define Flash_APIVersion()        Flash28333_APIVersion()
#endif

Second, the top level functions however call sub-functions that have the same name in both the F28333 and F28335 library.  These show up in the .map file when you build the project.  For example:

_Fl28x_ClearLoop
_Fl28x_ClosePulse
_Fl28x_CompactPulse
_Fl28x_CompactVerify
_Fl28x_Delay
_Fl28x_DisableInt
_Fl28x_DisableNMI
_Fl28x_EnterCmdMode
_Fl28x_ErasePulse
_Fl28x_EraseVerify
_Fl28x_FlashRegSleep
_Fl28x_LeaveCmdMode
_Fl28x_MaskAll
_Fl28x_OpenPulse
_Fl28x_ProgPulse
_Fl28x_ProgVerify
_Fl28x_RestoreInt
_Fl28x_WatchDogDisable

These will get pulled in from whichever library (F28335 or F28333) is linked in first in the project.

QUESTION: Are these functions the same in both libraries?  I think so.

Lastly, CPU_RATE is #defined Flash2833x_API_Config.h.  I assume this must get passed under the hood as a parameter to one or more of the sub-functions above (e.g. _FL28x_Delay), as the API libraries are already compiled and the user doesn't ever touch CPU_RATE other than the #define.  The user will not be able to change CPU_RATE at runtime.  To get around this, they would need to have both devices running at the same speed during flash programming.  For example, assuming a 30 MHz CLKIN for F28335 and a 20 MHz CLKIN for F28333, they could operate at 60 MHz for both during flash operations.  Hence, CPU_RATE would be set for 60 MHz.

----------

Added 4/18/17 1031AM:  Correction!  It looks like CPU_RATE is used to calculate SCALE_FACTOR, and then scale factor is assigned to a variable by the user:

Flash_CPUScaleFactor = SCALE_FACTOR; // Initialize Flash API clock rate scaling

So, the user could modify so that he has SCALE_FACTOR_28335 and SCALE_FACTOR_28333 and assign the correct one at runtime.  No need to run both devices at the same speed.

-----------

Can someone confirm my thinking?

Best Regards,

David

  • David,
    we are looking into this.

    Regards,
    Cody
  • Hi Cody,

    I ran some tests and am confident what I described will work provided the low-level API functions are the same in both libraries (and I would think they are).  Specifically:

    _Fl28x_ClearLoop
    _Fl28x_ClosePulse
    _Fl28x_CompactPulse
    _Fl28x_CompactVerify
    _Fl28x_Delay
    _Fl28x_DisableInt
    _Fl28x_DisableNMI
    _Fl28x_EnterCmdMode
    _Fl28x_ErasePulse
    _Fl28x_EraseVerify
    _Fl28x_FlashRegSleep
    _Fl28x_LeaveCmdMode
    _Fl28x_MaskAll
    _Fl28x_OpenPulse
    _Fl28x_ProgPulse
    _Fl28x_ProgVerify
    _Fl28x_RestoreInt
    _Fl28x_WatchDogDisable

    I'm not certain the list above is exhaustive.  I just pulled this from the .map file of my test case.  I was able to program a F28335 using the low-level functions in the F28333 API library by including both libraries in the build and specifying a link order to force the functions to be pulled from the F28333 library.  The functions above the low-level functions have device specific names that can be called, so they get pulled from the correct library.    It worked with no issues.

    So, just need confirmation on the low-level functions being device non-specific within the F2833x family.

    Regards,

    David

  • David,

    Yes, these low level functions aren't device specific.


    Regards,

    Manoj