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.

TMS570LS3137: Flashing and burning flash BANK0 BANK1 BANK7 failed

Part Number: TMS570LS3137

Hi team,

Issue: Erasing and burning flash BANK0 BANK1 BANK7 is  failed with the driver code generated by HAL code and F021 library F021_API_CortexR4_be_L2FMC_V3D16.lib. But according to routines written in official documentation, the program shows that the erase and burn-out was successful, the customer would like to know what's the reason for that? (Note : Chip OSC16M, HCLK:180M)

The code is as follows:

/* @brief Erase the block
* @param[in] oNewFlashBank:Block number
*
* return:
*/
enum e_flash_status Flash_EraseBanks(Fapi_FlashBankType oNewFlashBank)
{
int num = 0;
Fapi_StatusType oReturnCheck = Fapi_Status_Success;

num = find_sector(oNewFlashBank, 0);

oReturnCheck = Fapi_initializeFlashBanks(180); //Initialize Flash Bank for API operations
if((oReturnCheck == Fapi_Status_Success) && (FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.BUSY != Fapi_Status_FsmBusy))
{
oReturnCheck = Fapi_setActiveFlashBank(oNewFlashBank); //Set up the active Flash Bank
if( (oNewFlashBank == Fapi_FlashBank0) || (oNewFlashBank == Fapi_FlashBank1) )
oReturnCheck = Fapi_enableMainBankSectors( 0xffffffff ); //Sets the available sectors in the EEPROM memory for erase and programming
else if( oNewFlashBank == Fapi_FlashBank7 )
oReturnCheck = Fapi_enableEepromBankSectors(0xffffffff, 0xffffffff); //Sets the available sectors in the EEPROM memory for erase and programming
while(FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.BUSY == Fapi_Status_FsmBusy);
Fapi_issueAsyncCommandWithAddress(Fapi_EraseBank, gSector_List[num].low_addr); //Issue a command to the Flash state machine
/* Place specific example code here */
/* Wait for FSM to finish */
while(FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.BUSY == Fapi_Status_FsmBusy);
/* Check the FSM Status to see if there were no errors */
if (FLASH_CONTROL_REGISTER->FmStat.u32Register != 0)
{
/* Put Error handling code here */
return flash_failure;
}
}
return flash_succeed;
}

/* @brief Writes sector data
* @param[in] oNewFlashBank:Block number
* @param[in] sector:Sector number
* @param[in] offset:Sector offset address
* @param[in] buff:Data
* @param[in] len:Data length
*
* return:
*/
enum e_flash_status Flash_WriteData(Fapi_FlashBankType oNewFlashBank, uint32_t sector, uint32_t offset, uint8_t * buff, uint32_t len)
{
int num = 0;
Fapi_StatusType oReturnCheck = Fapi_Status_Success;

num = find_sector(oNewFlashBank, sector);

//If the case size is larger than the sector size
if( (offset+len) > gSector_List[num].size )
{
return flash_failure;
}

oReturnCheck = Fapi_initializeFlashBanks(180); //Initialize Flash Bank for API operations
if((oReturnCheck == Fapi_Status_Success) && (FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.BUSY != Fapi_Status_FsmBusy))
{
oReturnCheck = Fapi_setActiveFlashBank(oNewFlashBank); //Set up the active Flash Bank
if( (oNewFlashBank == Fapi_FlashBank0) || (oNewFlashBank == Fapi_FlashBank1) )
oReturnCheck = Fapi_enableMainBankSectors( 0xffffffff ); //Sets the available sectors in the EEPROM memory for erase and programming
else if( oNewFlashBank == Fapi_FlashBank7 )
oReturnCheck = Fapi_enableEepromBankSectors(0xffffffff ,0xffffffff); //Sets the available sectors in the EEPROM memory for erase and programming
while(FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.BUSY == Fapi_Status_FsmBusy);
Fapi_issueProgrammingCommand(gSector_List[num].low_addr+offset, buff, len, 0, 0, Fapi_DataOnly); //Sets data and sends program commands to a valid flash address
/* Place specific example code here */
/* Wait for FSM to finish */
while(FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.BUSY == Fapi_Status_FsmBusy);
/* Check the FSM Status to see if there were no errors */
if (FLASH_CONTROL_REGISTER->FmStat.u32Register != 0)
{
/* Put Error handling code here */
return flash_failure;
}
}
return flash_succeed;
}

Could you help check this case? Thanks.

Best Regards,

Cherry

  • Hello Cherry,

    The F021_API_CortexR4_be_L2FMC_V3D16.lib is for TMS570LC43x and RM57x. The F021_API_CortexR4_BE_V3D16.lib or F021_API_CortexR4_BE.lib should be used for TMS570LS3137 device.

  • Hello Wang,

    The customer has replaced F021_API_CortexR4_be.lib to erase and burn BANK1, but cannot erase and burn BANK0. Or BANK7 can not use F021_API_CortexR4_be.lib to erase and burn?

    Note: The initiator executes in BANK0, sys_link.cmd as follows:

    /*----------------------------------------------------------------------------*/
    /* sys_link.cmd */
    /* */
    /*
    * Copyright (C) 2009-2018 Texas Instruments Incorporated - www.ti.com
    *
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the
    * distribution.
    *
    * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    *
    */

    /* */
    /*----------------------------------------------------------------------------*/
    /* USER CODE BEGIN (0) */
    /* USER CODE END */


    /*----------------------------------------------------------------------------*/
    /* Linker Settings */

    --retain="*(.intvecs)"

    /* USER CODE BEGIN (1) */
    /* USER CODE END */

    /*----------------------------------------------------------------------------*/
    /* Memory Map */

    MEMORY
    {
    VECTORS (X) : origin=0x00000000 length=0x00000020
    FLASH0 (RX) : origin=0x00000020 length=0x0017FFE0
    FLASH1 (RX) : origin=0x00180000 length=0x00180000
    STACKS (RW) : origin=0x08000000 length=0x00001500
    RAM (RW) : origin=0x08001500 length=0x0003EB00

    /* USER CODE BEGIN (2) */
    /* USER CODE END */
    }

    /* USER CODE BEGIN (3) */
    /* USER CODE END */


    /*----------------------------------------------------------------------------*/
    /* Section Configuration */

    SECTIONS
    {
    .intvecs : {} > VECTORS
    .text : {} > FLASH0 | FLASH1
    .const : {} > FLASH0 | FLASH1
    .cinit : {} > FLASH0 | FLASH1
    .pinit : {} > FLASH0 | FLASH1
    .bss : {} > RAM
    .data : {} > RAM
    .sysmem : {} > RAM

    FEE_TEXT_SECTION : {} > FLASH0 | FLASH1
    FEE_CONST_SECTION : {} > FLASH0 | FLASH1
    FEE_DATA_SECTION : {} > RAM

    /* USER CODE BEGIN (4) */
    /* USER CODE END */
    }

    /* USER CODE BEGIN (5) */
    /* USER CODE END */


    /*----------------------------------------------------------------------------*/
    /* Misc */

    /* USER CODE BEGIN (6) */

    /* USER CODE END */
    /*----------------------------------------------------------------------------*/

    When erasing the last 0x2E0000 of BANK1, always shows that it is on while (FAPI_GET_FSM_STATUS ! = Fapi_Status_Success; Loop pending.

    for (i=ucStartSector; i<(ucEndSector+1); i++){
    Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, flash_sector[i].start);
    while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy );
    while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);
    }

    Thanks and Best Regards,

    Cherry

  • Hi ,

    May I know is there any updates? Thanks.

    Best Regards,

    Cherry

  • Hi Cherry,

    1. To erase sectors of bank0, the flash API related code has to be copied to SRAM and executed from SRAM

    2. If you want to use Bank 7 as FEE, please use FEE drivers to write/read data and erase the flash with the FEE driver. 

    When erasing the last 0x2E0000 of BANK1, always shows that it is on while (FAPI_GET_FSM_STATUS ! = Fapi_Status_Success; Loop pending.

    Is the last sector (sector 11) enabled for erasing? 

     Fapi_enableMainBankSectors(0xFFFF);  --> to enable sector 0 to sector 15