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.

Flash F021 Erase command

Other Parts Discussed in Thread: TMS570LS3137, SEGGER

Dear support,

may you advise me wgy the FSM is running wrongly?

Scenario:
TMS570LS3137
The first addresses of the 1-st (0-th ;-)) sector in the Bank 1 (code is running from Bank 0) are initialized as follows:
const unsigned int dummyFlashInit[] = { 0xA5A5A5A5U, 0xA5A5A5A5U, 0xA5A5A5A5U, 0xA5A5A5A5U };

Erase sequence:
pDest = (unsigned int) 0x180000U;
flashWREG->FMAC = (unsigned int) Fapi_FlashBank0;
flashWREG->FBPROT = 1U;
flashWREG->FBSE = 0x0001U;
flashWREG->FBPROT = 0U;
flashWREG->FSM_WR_ENA = 0x5U;
flashWREG->FSM_SECTOR = 0xFFFEU << 16U;
flashWREG->FSM_COMMAND = (unsigned int) Fapi_ClearStatus;
flashWREG->FSM_EXECUTE = Q_F021_EXEC_TRIGGER;
flashWREG->FADDR = (unsigned int) pDest;
flashWREG->FSM_COMMAND = (unsigned int) Fapi_EraseBank;
flashWREG->FSM_EXECUTE = 0x15U;
flashWREG->FSM_WR_ENA = 0x2U;

FMSTAT = 0x11 --> SLOCK bit is set although FBSE has been set correctly.
Of course, FSM_SECTOR has not changed - in a correct case I would expect the value of (0x0001U << 16U).

If the command Fapi_EraseSector is executed instead of Fapi_EraseBank, the status register FMSTAT = 0x18U.

Control register includes both following settings of read wait without any changes regarding the erase results:

flashWREG->FRDCNTL = 0x00000000U
                  //| (3U << 8U)
                    | (0xFU << 8U)
                    | (1U << 4U)
                    | 1U;

Please do you have any idea what I have missed?

Many thanks in advance,
Best regards
Jiri

  • Jiri,

    You can follow the attached example to call Flash API.

    1881.F021_Program.c

    Thanks and regards,

    Zhaohong

  • Hello Zhaohong,

    thanks for your hint!

    I have already tried the Flash API - yes, that can be used in an elegant way. But this is the point - I do not want to utilize the Flash API. My intention is to directly control the FSM. There are a few reasons behind this decision - one of them is that there occurs an error when GDB is used.

    May I ask your colleagues who created the Flash API (John Hall, right?) to advise me where is an issue?

    Many thanks for your support,

    Best regards

    Jiri

  • Jiri,

    I do not recommend you to write your own functions to erase/program the Flash. The reason is that the FSM registers is only the top level control and you will also need to set up Flash voltage registers to run the pump. The second part is complicated. If the Flash voltage registers are not programmed correctly, you are running the risk of damage the device when erasing/programming Flash. I would suggest that we work together to solve the problem you are having with TI Flash API.

    Thanks and regards,

    Zhaohong

  • Zhaohong,

    there is an issue during the debugging by GDB (in Eclipse). When the program run does enter/call code of any F021 API functions, an error occurs. An error window pops up but does not provide any further information. The debuf session gets frozen and the TMS570 target is disconnected, of course.

    The same error window does appear when objdump is processing the elf file...

    Tool / lib versions:

    F021_API_CortexR4_BE_V3D16.lib v2.00.00 Build(000809) - Beta  v2.00.00 Build(000809) - Beta

    GNU Tools for ARM Embedded Processors 4.6.2 20121016

    I have also tried another build toolchain yagarto-20121222 with the same results :-/

    I will also submit this report to the GCC Embedded forum.

    Thanks in advance,

    Best regards

    Jiri

    PS: The elf file attached - please change the extension if needed.

    5277.gcc_led_rti.123

  • Jiri,

    Do you enable Cortex R4 MPU in your application? If so, you need to include TI OTP at address 0xf0080000 as one MPU region because Flash API reads data from OTP to set up the Flash voltage registers.

    Thanks and regards,

    Zhaohong

  • Hello,

    We can't have problem with MPU, because any access to not allowed region make exception and it is logged. :-)

    Main problem is simple. When GDB (or GDB eclipse plugin) try to show disassemble of region with this library, it will crash. Quick test of this problem is use "objdump -S" on final elf file. It crash also.

    We are hope, that we found workaround = remove debug symbols from library with "strip -g" tool. But I am not sure if we can use "modified" library without problem with SW certification. This workaround is not confirmed fully yet. I can confirm it tomorrow in my office with real HW and GDB. 

    Jiri

  • Jiri,

    Did the GDB that you are using ship with Code Composer Studio or did you get GDB from another vendor like Segger?

    I believe anything GDB/GCC ish that comes with CCS today is mainly for the Cortex A series;  we can confirm this by posting to the CCS forum if needed. 

    Best Regards,

    Anthony

  • Anthony,

    I am using Eclipse CDT linked with GDB and J-Link. This GDB comes with the GNU Tools ARM Embedded 4.6 2012q4.

    Anyway I can confirm the workaround proposed by Jiri does work properly - also tested on HW.

    Small remark:

    If the API lib file was stripped by the arm-none-eabi-strip version 4.6 2012q4, then the linker fails down with an error message:

    lib/F021_API_CortexR4_BE_V3D16.lib: could not read symbols: Archive has no index; run ranlib to add one
    collect2: ld returned 1 exit status

    If the version 4.7 2013q1 is used, the ELF is linked correctly.

    Thanks a lot,

    Best regards, Jiri

  • Hello Jiri,

    I need to add a comment here.  We require the use of the Flash API for programming this device.  Not doing so will void the datasheet Flash specifications (data retention, number of write/erase cycles, etc.)

    On the issue of modifying the existing released libraries by stripping the symbols, any modification to the released libraries is not supported and is considered a violation of the F021 Flash API license agreement and would also void any Flash datasheet specifications.

  • Hello John,

    thanks for your feedback!

    I would propose to close this thread and continue in our discussion within this post called F021 API lib for TMS570 - SIL-compliant SW.

    Thanks a lot, 

    Best regards, Jiri