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.

Fapi_calculateEcc prereqs

Other Parts Discussed in Thread: RM57L843

Anyone know what preamble/prerequisites are needed to get a value from Fapi_calculateEcc?

I am trying it on an RM57L843.

I tried diff addrs(remapped or not makes no diff) + 64bit vals. All return the same ecc from 0xfff87060. 

I tried Fapi_initializeFlashBanks as a preamble with the HCLK as param. That did not help.

I tried the diagnostic reg programming it to 0x50007. Also the unlock code of 0xaa55.

Nothing seems to unstick FEMUECC from not returning a stale value.

Don't suppose someone has a canned seq that works?

tnx

Hedley

        @ This code is DL'd to sram. Before arriving here, full TI Safety check was run from Flash.
@ one slight mod to the TI Safety code is to allow code exec from RAM or... this test dies on
@ prefetch abort (as expected). start: ldr sp,=0x08080000 mov r0,#150 bl Fapi_initializeFlashBanks mov r0,#0x10 bl Fapi_remapMainAddress ldr r2,=0xeafffffe ldr r3,=0xea0022a9 bl Fapi_calculateEcc spin: b spin


  • Hi Hedley,
    I want to make sure you have the correct F021 library linked. What is the library you use? Please make sure the library such as F021_API_CortexR4_LE_L2FMC_v3D16.lib is used in your build. The flash controller in RM57Lx is different from RM48/RM46.
  • Hi Charles,

    There are 3 candidate libs from my F021 2.00.01 release dir:

    #LIBS = F021_API_CortexR4_LE.lib
    #LIBS = F021_API_CortexR4_LE_L2FMC.lib
    #LIBS = F021_API_CortexR4_LE_V3D16.lib

    the first and last have identical results, the middle one, the L2FMC, uses a base address for the flash that seem wrong for this part (0xfff87120). This then produces an ECC of 0xFF.

    also, the L2FMC's Fapi_calculateEcc function is quite a bit larger.

    For the 2 smaller Fapi_calculateEcc's the code is like this:

    080002d0 <Fapi_calculateEcc>:
    80002d0: 4903 ldr r1, [pc, #12] ; (80002e0 <Fapi_calculateEcc+0x10>)
    80002d2: 6688 str r0, [r1, #104] ; 0x68
    80002d4: 65ca str r2, [r1, #92] ; 0x5c
    80002d6: 1c18 adds r0, r3, #0
    80002d8: 6588 str r0, [r1, #88] ; 0x58
    80002da: 6e08 ldr r0, [r1, #96] ; 0x60
    80002dc: b2c0 uxtb r0, r0
    80002de: 4770 bx lr
    80002e0: fff87000 .word 0xfff87000

    tnx

    Hedley
  • Hi Hedley,
    The middle one F021_API_CortexR4_LE_L2FMC.lib is right one to use. The other two are for RM48/RM46. As I said, the L2FMC flash controller is different than the FMC controller used in RM48. I think you are familiar with RM48/RM46 since you correctly identify the register at 0xfff87060. the ECC register at 0xfff87120 is the correct register to read in RM57. The TRM is not very clear on this and I think I will file a document correction on this as these registers are supposed to be deprecated.

    In RM57 there are some undocumented registers at offset 0x120, 0x124 and 0x140. The registers at 0x120/0x124 are equivalent to the registers in function to the registers at 0x58/0x5C while the register at 0x140 is equivalent in function to the register at 0x60. When you write data to 0x120/0x124 you should see the ECC calculated in 0x140. Make sure you set autoCalc_EN bit (bit 24 at 0x11C).

    Note that the undocumented registers are intentional to be undocumented as the API function creates the abstraction for your convenience. We have no plan to document them. The important thing is if you are getting the ECC value back when you call Fapi_calculateEcc(). If you simply just want to verify the returned value from the API against the actual register which stores the ECC value then you should read from 0x140 instead.

  • Hi Charles.

    I got the gist of your email. Basically, v2.01.01 has fixed the issue.

    Clearly I was missing a critical lib due to an older F021.

    tnx!

    Hedley
  • One more comment is that you don't have the latest library. You should install the newest F021 library. The latest version is 02.01.01.
  • Hi Hedley,

      Glad that it is clear to you now.