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.

TMS320F28P559SG-Q1: C2000Ware_6_00_01_00 F28P55x Flash API: correct FlashTech_CPU0_BASE_ADDRESS?

Part Number: TMS320F28P559SG-Q1
Other Parts Discussed in Thread: C2000WARE

Using the Flash API lib of C2000Ware_6_00_01_00 with F28P55x we have questions regarding the register addresses that have to be passed to the Fapi functions.

Consulting Reference Guide TMS320F28P55x Flash API Version 4.00.00.00
3.1.1 Fapi_initializeAPI() Parameters:
"poFlashControlRegister [in] Pointer to the Flash Wrapper Registers' base address. Use FlashTech_CPU0_BASE_ADDRESS."

This is only #defined in "driverlib\f28p55x\examples\flash\flash_programming_f28p55x.h" as follows:
#define FLASH_WRAPPER_PROGRAM_BASE         0x51000U /*(FLASH0CMD_BASE - 0x1000UL)*/
#define FlashTech_CPU0_BASE_ADDRESS ((Fapi_FmcRegistersType *)FLASH_WRAPPER_PROGRAM_BASE)

But is this correct? The datasheet lists no peripheral at this address. Instead, it says in "Table 7-4. Peripheral Registers Memory Map":
Structure       | DriverLib Name  | Base Address
FLASH_CTRL_REGS | FLASH0CTRL_BASE | 0x0005_F800 

Also, I wouldn't expect the definition in the 'examples' folder, but either in driverlib/f28p55x/driverlib/inc/hw_memmap.h (where we find #define FLASH0CTRL_BASE    0x0005F800U  //FLASH_CTRL_REGS), or  in 'libraries\flash_api\f28p55x\include\FlashAPI' (where we find nothing).

We are porting from F2800157 with C2000Ware_MotorControl_SDK_5_00_00_00.
There, we have c2000ware\libraries\flash_api\f280015x\include\FlashAPI\hw_flash_memmap.h that has:
#define FLASH0CMD_BASE            0x00052000U
#define FLASH0CTRL_BASE           0x0005F800U
#define FLASH_WRAPPER_PROGRAM_BASE         0x51000U /*(FLASH0CMD_BASE - 0x1000UL)*/
This file is gone in 5_04_00_00 and 6_00_01_00.

"C2000Ware_6_00_01_00\driverlib\f28p55x\driverlib\inc\hw_memmap.h" contains:
#define FLASH0CTRL_BASE           0x0005F800U     //FLASH_CTRL_REGS
and "C2000Ware_6_00_01_00\libraries\flash_api\f28p55x\include\FlashAPI\Constants\F28P55x.h" contains:
#define CPU0_REGISTER_ADDRESS    0x0005F800
No #defines for 0x00051000 or 0x00052000.

Q1: What is the correct address/pointer to provide to Fapi_initializeAPI(??FlashTech_CPU0_BASE_ADDRESS??), and which header file provides it?

Q2: Same question for Fapi_setupBankSectorEnable( ??FLASH_WRAPPER_PROGRAM_BASE?? + FLASH_O_CMDWEPROTx).

  • Hello,

    This thread has been assigned to the intended expert, please expect a reply within the next day.

    Best,
    Matt

  • Hello Matt,

    is there a reply yet?

    Currently we solved it by adding the following to "c2000ware\libraries\flash_api\f28p55x\include\FlashAPI\Constants\F28P55x.h":

    //copied here from "C2000Ware_6_00_01_00\driverlib\f28p55x\examples\flash\flash_programming_f28p55x.h"
    //Flash wrapper base address
    #define FLASH_WRAPPER_PROGRAM_BASE         0x51000U /*(FLASH0CMD_BASE - 0x1000UL)*/
    #define FlashTech_CPU0_BASE_ADDRESS ((Fapi_FmcRegistersType *)FLASH_WRAPPER_PROGRAM_BASE)

    But this is not a good solution because it breaks on SDK updates.

    Regards,
    Wolfgang

  • Hi Wolfgang, 

    Yes you can look at the F28P55x programming example for the values, i will take an action to get this updated.

    Looping Alex for more details.

    Thanks

    Aswin

  • Hello Wolfgang,

    Q1: What is the correct address/pointer to provide to Fapi_initializeAPI(??FlashTech_CPU0_BASE_ADDRESS??), and which header file provides it?

    The correct value is the FlashTech_CPU0_BASE_ADDRESS macro. This is defined in the flash_programming_f28p55x.h header file, which is included as a part of all the examples under C2000Ware/driverlib/f28p55x/examples/flash. The easiest way to access it would be to import the flashapi_128bit_programming example. This header file should be included as a part of your project if you are doing any flash programming.

    Q2: Same question for Fapi_setupBankSectorEnable( ??FLASH_WRAPPER_PROGRAM_BASE?? + FLASH_O_CMDWEPROTx).

    The correct value is FLASH_WRAPPER_PROGRAM_BASE, this is equivalent to the FlashTech_CPU0_BASE_ADDRESS macro but is not typecasted to Fapi_FmcRegistersType*.

    Best,

    Alex

  • Hi Alex,

    thanks for the address confirmation.

    Are there plans to get these flash register definitions into a PROPER library header file in a C2000Ware update, analog to other peripherals?

    We'd prefer not to include or even copy EXAMPLE header files into production code to be maintained for years to come, but have something more stable and documented, and something that can switch between CPUs just by changing the device include path, as it is with other peripherals.
    It is not feasible to meticulously check and update peripheral's addresses each time we switch the target CPU.

    As I wrote above: we "wouldn't expect the definition in the 'examples' folder, but either in driverlib/f28p55x/driverlib/inc/hw_memmap.h (where we find #define FLASH0CTRL_BASE    0x0005F800U  //FLASH_CTRL_REGS), or  in 'libraries\flash_api\f28p55x\include\FlashAPI' (where we find nothing)."

    Regards,
    Wolfgang

  • Hi Wolfgang,

    Apologies for the delay in response, I'm still looking into this internally.

    Best,

    Alex

  • Any news on this?

  • Hello Wolfgang,

    I've been looking into this further and the CPU0_REGISTER_ADDRESS macro defined in Constants/F28P55x.h is incorrect and should be updated to 0x51000U. This change will be made in the next C2000Ware release. In the meantime, you can either make this change in your copy of the SDK manually or continue using the flash_programming_f28p55x.h header file.

    Best,

    Alex