TMS570LS0914: F021 API on TMS570LS0914PGE

Part Number: TMS570LS0914

Tool/software:

Hi all, 

I am trying to use the F021 api on a TMS570LS0914PGE, but I am having trouble with it. After the system has been intialized, I call:


Fapi_StatusType status = Fapi_initializeFlashBanks(HCLK_FREQ);
status = Fapi_setActiveFlashBank((Fapi_FlashBankType)Fapi_FlashBank0);


Fapi_setActiveFlashBank() causes a undefined instruction exception. 

In CCS 12 I included these F021 files:
- F021_API_CortexR4_BE_V3D16.lib // Flash Module Controller, Big Endian, FPU
- CGT.CCS.h
- Registers_FMC_BE.h

Following note from the F021 guide (chapter 3.3.4) confuses me a little:

NOTE: The F021 Flash API library cannot be executed from the same bank as the active bank selected for the API commands to operate on.
On single bank devices, the F021 Flash API must be executed from RAM.

Is that the problem? I would't know what to do about it.

Regards,
Juergen

  • Hi Juergen,

    Yes, this is a problem.

    Please refer below thread, here i explained in detailed about this problem:

    (+) TMS570LS3137: TMS570LS3137: Writing Flash During Runtime - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums

    --

    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    thanks for your response, I think I still need a little guidance to get this to work.

    I  modified my linker script according to the link you suggested and added 
    extern unsigned int api_load;
    extern unsigned int api_size;
    extern unsigned int api_run;
    memcpy(&api_run, &api_load, (uint32)&api_size);
    to my main file.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    --retain="*(.intvecs)"
    MEMORY
    {
    VECTORS (X) : origin=0x00000000 length=0x00000020
    FLASH_API (RX) : origin=0x00000020 length=0x000014E0
    FLASH0 (RX) : origin=0x00001500 length=0x0000EB00
    STACKS (RW) : origin=0x08000000 length=0x00001500
    RAM (RW) : origin=0x08001500 length=0x0001EB00
    }
    SECTIONS
    {
    .intvecs : {} > VECTORS
    flashAPI :
    {
    ../../../IDE/CSS/Debug/port/TMS570LS0914PGE/F021_API/source/Fapi_UserDefinedFunctions.obj (.text)
    --library= F021_API_CortexR4_BE_V3D16.lib (.text)
    } load = FLASH_API, run = RAM, LOAD_START(api_load), RUN_START(api_run), SIZE(api_size)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Starting with line "   .ref    api_load" I get errors like: #10008-D cannot find file ".ref" ....

    For the line ../../../IDE/CSS/Debug/port/TMS570LS0914PGE/F021_API/source/Fapi_UserDefinedFunctions.obj (.text) I get the error:
    #10068-D no matching section.
    The path is relative to the location of the linker script?
    Ist there a macro whtich replaces "Debug" fills in Debug or Release depending on which one of the two I build?

    Best Regards,
    Juergen

  • A little update . I removed the assembler code from the linker script. memcpy in the main file does the job and copies the Flash Api into RAM. I can step over Fapi_setActiveFlashBank() now.

    I am still wondering if there is a way of replacing Debug in this line with a macro which depends on the type of build (Debug or Release)
    ../../../IDE/CSS/Debug/port/TMS570LS0914PGE/F021_API/source/Fapi_UserDefinedFunctions.obj (.text)

    Best Regards,
    Juergen

  • I am still having trouble with the flash api. As long as I single step through the code, Fapi_issueProgrammingCommand() works five out of ten times. It never works when I don't single step through the code, it ends up in the  undefined instruction exceptio handler.The global interrupt flag in the cpsr register is 1, interrupts shouldn't occur. Fapi_issueAsyncCommandWithAddress() never works, not even in single step. The test setup writes four bytes into the beginning of sectors 4,5,6. It's followed by a blank check which will always correctly reports that the sectors are not blank. This is followed by a  Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, addr) for each sector but always ends up in the undefined instruction exception handler.

    .

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #define NUMBEROFSECTORS 14
    const SECTORS flash_sector[NUMBEROFSECTORS] = {
    /*start len bank sector */
    (void *)0x00000000, 0x04000, 0, 0,
    (void *)0x00004000, 0x04000, 0, 1,
    (void *)0x00008000, 0x04000, 0, 2,
    (void *)0x0000C000, 0x04000, 0, 3,
    (void *)0x00010000, 0x04000, 0, 4,
    (void *)0x00014000, 0x04000, 0, 5,
    (void *)0x00018000, 0x08000, 0, 6,
    (void *)0x00020000, 0x20000, 0, 7,
    (void *)0x00040000, 0x20000, 0, 8,
    (void *)0x00060000, 0x20000, 0, 9,
    (void *)0x00080000, 0x20000, 0, 10,
    (void *)0x000A0000, 0x20000, 0, 11,
    (void *)0x000C0000, 0x20000, 0, 12,
    (void *)0x000E0000, 0x20000, 0, 13
    };
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX