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.

F021 Flash API run well on RM48 and failed on RM46

Other Parts Discussed in Thread: RM46L852, RM48L952, HALCOGEN

Hello,

I work on a bootloader based on SPNA196 exemple.

It works fine on RM48 MCU. I want to port this program on RM46 but it doesn't work. Erase or write operations stauts is in error.

Here is the code

do {
     Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, pEraseStartAddr);
     while ( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy );
     Fapi_StatusType stat;
     do {
            stat = FAPI_GET_FSM_STATUS;
     } while (stat != Fapi_Status_Success);

     remaining -= flash_sector[j++].length;
     pEraseStartAddr = flash_sector[j].start;

} while ((remaining > 0));

The variable stat contains the value 16 that indicates an error.

To port to RM46 device I have changed:

  • the device to RM46L852 in CSS configuration
  • the macro #define RM46 to #define RM48 in flash_defines.h

pEraseStartAddr is 0x00100000 which valid for both RM46 and RM48 devices.

Is there any difference between RM48 or RM46 that I miss ?

Thanks,

Thomas

  • Thomas,


    Have you changed in the project properties the include path to pickup the correct flash_defines.h?
    I know it's a dumb question...

    Also can you tell me which version of the FLASH API you are using?

  • Jean-Marc,

    I use the v2.01.01 Flash  API version.

    I have a single flash_defines.h which is copied from SPNA196 exemple.This file defines flash structure for many MCU. A #define directive is used to select the MCU. I have replaced #define RM48 to #define RM46 to change the target.

    The flash_sector and flash_bank are well defined because otherwise it would not compile. The problem I have is at runtime.

    Thanks,

    Thomas

  • Thomas,

    As far as I know, the bootloader example that we provide has to use the Flash API 02.01.00
    I did a try with 02.01.01 and there is a runtime problem. I did not investigate, but after a quick talk with the booloader owner, it is certainly a modification in the API of some function that is causing the problem.

    For now, I will recommend using Flash API 02.01.00 when using our bootloader code.

    I will keep you posted if I found the solution.

  • Thomas,


    I tried to use the latest Flash API 02.01.01 and it is working but there is a trick.

    If you use the build in CCS project part of the bootloader download zip file, under compiler-Include Option, the Flash API include directory is pointing to:

    SafetyMCU_Bootloaderl\inc\F021_API. This is the include file part of an old release of the Flash API (v2.00.01 Build(000824))
    Under Linker-File Search Path, the Flash API library is also pickup from:

    SafetyMCU_Bootloader\lib\F021_API_CortexR4_LE.lib or
    SafetyMCU_Bootloader\lib\F021_API_CortexR4_BE.lib depending on the device you are using

    If you have installed on your pc the latest Flash_API 02.01.01, the default directory is:

    C:\ti\Hercules\F021 Flash API\02.01.01

    In my test using Flash_API 02.01.01, here are the compiler and linker properties:


    With this configuration, after a full rebuild, the bootloader is working correctly.

    Please have a try and let me know.

  • Hello,

    Thank you for your help, I have investigate more and it appears this is a frequency problem.

    On xRM46L852 MCU the flash bank initialization fails due to invalid frequency. The initialization function "Fapi_initializeFlashBanks" returns "Fapi_Error_InvalidHclkValue value" if its parameter is higher that 205.

    Here is the code:

    status = Fapi_initializeFlashBanks(Freq_In_MHz); /* used for API Rev2.01 */
    while (status != Fapi_Status_Success);

    The code stop at this line with status contains 8 (that correspond to "Fapi_Error_InvalidHclkValue value")

    If frequency is above 205 MHz the erase and program operations runs perfectly well. 

    The RM46L852 datasheet says "When in pipeline mode, the flash operates with a system clock frequency of up to 220 MHz". So we are not out of specification.

    The same code runs well on RM48L952 MCU (even if it is compiled for RM46 MCU and with #define RM46).

    I have check EWait and RWait values configured by HalCoGen they are correct:

    • Data wait sate = 3
    • Address wait state = 1

    This problem can be reproduced with the SPNA196 example by only changing the frequency.

    Thanks,

  • Hello,

    Can you confirm the actual labeling on the RM46 part that you have on your board?

    Regards,
    Sunil
  • Hi,

    The MCU is xRM46L852ZWTTYFA-26ATSGW.

    Thanks,

    Thomas

  • Hi Thomas,

    Can you please tell me the 128 bits programmed in the addresses 0xF008_0170 through 0xF008_017C? These are addresses in the TI OTP region of the main flash bank.

    Regards,
    Sunil
  • Hi Sunil,

    The value is 0x030221A122222A2A.

    Regards,
    Thomas
  • Hi Thomas,

    Thanks. Can you please read out the next 64 bits as well?

    Regards,
    Sunil
  • Hello,

    Sorry, the next 64 bits (at address 0xF0080178) are 0x0200F01902540200.

    Regards,

    Thomas

  • Hello,

    Sorry, the next 64 btits (at address 0xF0080178) are 0x0200F01902540200

    Best regards,

    Thomas
  • Thomas,

    That is an issue with programming the TI OTP. The 32-bit value at address 0x17C should read 0x0200F01C for a part that is specified for 220MHz max. The value 0x0200F019 means that the max CPU clock frequency is limited to 200MHz.

    Are you running this on a development board from TI (HDK/LaunchPad)? If not, do you have other RM46L852 parts that you can try this on?

    I will check with our test team to make sure that the TI OTP programming routine is now corrected.

    Regards,
    Sunil
  • Hi,

    I am running on a RM46 Hercules Development Kit.

    I was just testing on a Control Card (from TI) with a xRM46L852ZWTTYFA-25A6I8W. It doesn't work at 220MHz and I read 0x0200F01902540200 in OTP memory (which seems consistent).

    Thanks,

    Thomas
  • Hi Thomas,

    These parts were built in June 2012 and there has been an update to the TI OTP programming since then to differentiate the 200MHz max parts from the 220MHz max parts. For the parts that you have, you can either limit the max HCLK frequency to 200MHz, or increase the RWAIT and EWAIT settings by 1 (just for the flash programming/erasing using the API functions) and then run it up to 220MHz.

    Sorry for the trouble caused.

    Regards,
    Sunil