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.

TMS570LS1227 - F021 Flash API - Fapi_doBlankCheck()

Other Parts Discussed in Thread: TMS570LS1227

Hello,

I want to do a blank check for the page 13

Address: 0x000E0000ul,

Size:0x20000ul,

Fapi_FlashSector13, Fapi_FlashBank0.

Fapi_doBlankCheck() run in a dabort. The debugger means an DWord read from 0x140000 - after all Flash.

_Fapi_readDword(unsigned int *)() at Read.Common.c:93 0x08001E6E     

The check of the earlier pages runs correct. So I think at the moment, that the problem is not located on my side.

The Api is v2.1.1. The newer Api 2.2 is not downloadable.

Ideas?

  • Yes, it sounds like you may have a problem with how you have the MPU configured.
    What is your MPU configuration and in which CPU mode are you executing the FAPI call?
  • Hi,

    for now the MPU is deactivated. Of course, I don't know, what the debugger set for the debug session. At the moment I tested only with it. Also an application loop to read the area by myself do not show any problems. Also ECC trap and so on is not activated. Additional this area was erased by the debugger and at this moment there are no new data flashed. The Blank check must see an blank flash page.

    As I wrote I think, the Blank check function read outside of the flashpage area (read from outside the Flash).

    Do you recommend to use the Fapi function instead of an own read and compare loop for this devices?

    Additional I have to compare the ECC area, For this area I have to use the Bytewise Blank check, right?

  • Version 2.01.01 of the F021 flash API has been used for two years now, so I don't think it is a problem inherent in the blank check routine. The first two things to check are if the MPU or ECC is enabled. You mentioned that neither of those are enabled. From the addresses you gave it looks like you are executing the blank check routine from RAM. Is all of your code in RAM? Are there any interrupts enabled? Is it possible that the code in RAM got corrupted?

    The Fapi_doBlankCheck function is more than just reading a location and checking for 0xFFFFFFFF. It actually puts the flash into "Read margin 1" mode. This ensures not only is the flash erased, it is erased with some extra margin.

    Yes, you need to do the byte-wise blank check when checking that the ECC values are also blank.
  • Bob Crosby said:
    From the addresses you gave it looks like you are executing the blank check routine from RAM. Is all of your code in RAM? Are there any interrupts enabled? Is it possible that the code in RAM got corrupted?

    Only my read, write and blank check functions are located in RAM. (I didn't know, if the blankcheck function must be located in RAM for the 1227. But the code should also later updated for different devices.)

    Interrupts are disabled.

    I don't think, that the code in RAM is corrupt. But of course, I search a problem. I will check it in depth.


    Thank you for the additional informations to this function.

  • You definitely do not want to run the blank check routine from the same bank as you are checking. The read margin would be applied to the code you are executing and increase the possibility of creating an execution error.
  • Thank you for this clarification. Then it was a good idea to call it from RAM.

  • I'm confusing. I want to check, that my function is in RAM and that all required functions are, too.

    My RAM Area is from 08001510 to 08002354. My function checkErasePage() is located on 080022DC.

    The F021 API is located in RAM, too.

    The confusion at the moment is, that the debugger create an Error in this area:

    CortexR4: Trouble Reading Memory Block at 0x8002274 on Page 0 of Length 0xc8: (Error -1208 @ 0x20000600) Unable to access an ETM register. Check that the ETM is configured properly as a cs_child. (Emulation package 6.0.407.3)

    So I cannot check this RAM area for correctness.

    Now, the empty watchdog callback is located in RAM.

    Fapi_UserDefinedFunctions.obj (ramfuncs:Fapi_serviceWatchdogTimer)

    --

    In case of MPU I think it's disabled.

    MPU Region Size and Enable Register is 0.


    --

    A second question is, there are some *.tramp.* entries in Flash. But I think this are correct and I don't think, that this calls are used in the Flash API internal.

                      000038e4    0000000c     F021_API_CortexR4_BE_V3D16.lib : Async.obj (.tramp.Fapi_issueAsyncCommand.1)
                      000038f0    0000000c                                    : FlashStateMachine.InitializeFlashBanks.obj (.tramp.Fapi_initializeFlashBanks.1)

    VENEERS

    callee name               veneer name
       callee addr  veneer addr  call addr  call info
    --------------  -----------  ---------  ----------------
    Fapi_issueAsyncCommand    $Ven$AT$L$PI$$Fapi_issueAsyncCommand
       08001e81     000038e4     000024ec   cobl_flash.obj (.text:flashInit)
    Fapi_initializeFlashBanks  $Ven$AT$L$PI$$Fapi_initializeFlashBanks
       08001511     000038f0     000024d4   cobl_flash.obj (.text:flashInit)
    Fapi_serviceWatchdogTimer  $Ven$TA$L$PI$$Fapi_serviceWatchdogTimer
       0800233c     08001f4c     08001f46   F021_API_CortexR4_BE_V3D16.lib : Read.WdService.obj (.text:_Fapi_checkWdService)


    ----

    My test case:

    I initialize the RAM functions by copy the relevant section to RAM.

    fret = Fapi_initializeFlashBanks(hclk); -- works

    fret = Fapi_issueAsyncCommand(Fapi_ClearStatus); -- works

    fret = Fapi_doBlankCheck((U32 *)0x000C0000ul, 0x20000ul, &FlashStatusWord); -- works

    fret = Fapi_doBlankCheck((U32 *)0x000E0000ul, 0x20000ul, &FlashStatusWord); -- dabort

    LR == 0x08001E6E

              _Fapi_readDword():

    08001e54:   B51C                push       {r2, r3, r4, lr}
    08001e56:   4604                mov        r4, r0
    08001e58:   2000                movs       r0, #0
    08001e5a:   9000                str        r0, [sp]
    08001e5c:   4620                mov        r0, r4
    08001e5e:   F7FFFF67            bl         #0x8001d30
    08001e62:   2801                cmp        r0, #1
    08001e64:   BF1C                itt        ne
    08001e66:   6820                ldr        r0, [r4]
    08001e68:   9000                str        r0, [sp]
    08001e6a:   D107                bne        $C$L4
    08001e6c:   4669                mov        r1, sp
    08001e6e:   2004                movs       r0, #4

    CP15_DATA_FAULT_STATUS 0x00000409

    CP15_INSTRUCTION_FAULT_STATUS 0

    CP15_DATA_FAULT_ADDRESS 0x00140000

    Thats, why I mean,  Fapi_doBlankCheck()  for 0x000E0000ul check to many data and the MPU or other access security is not the problem.

    Also the first address after the flash is not an indicator for my for Stack problem. I would expect a random value in this case.

    fret = Fapi_doBlankCheck((U32 *)0x00100000ul, 0x20000ul, &FlashStatusWord); - also dabort

    I dont have more ideas.

  • Additional information - I have the TMS570LS1227 and use the v2.1.1 F021 Flash API - F021_API_CortexR4_BE_V3D16.lib .
  • I think the problem is that you are checking past the end of flash. The Fapi-doBlankCheck() routine argument for length is number of 32-bit words, not number of bytes. Starting address of 0x000E0000 + (0x20000 * 4) = 0x160000. The maximum flash address is 0x13FFFF. You got an abort when the API tried to read from address 0x140000. Change you length to 0x20000/4 or 0x8000.
  • Thank you for this hint, that Fapi_doBlankCheck() require the size in word length.

    It seems also, that Fapi_doBlankCheckByByte() require the size in Byte length, but the documentation say it different.
  • Thanks for pointing out that error in the documentation. I will submit that for correction.