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.

TMS570LC4357: FSM_SECTOR1 register usage in F021

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Hi, 

In enabling the sectors of EEPROM banks, there is a configuration for FSM_SECTOR1 register where the complete register is updated:

FLASH_CONTROL_REGISTER->FsmSector1.u32Register = ~(u32SectorsEnables_31_0);

As there are 32 sectors in EEPROM, the complete register can be configured for performing erase operation.

While enabling the sectors of main banks, the FSM sector is found to be updated as below:

FLASH_CONTROL_REGISTER->FsmSector1.u32Register = (uint32_t)(~u32SectorsEnables)<<0x10U;

The complete register is updated due to the assignment which always affects the upper 16 bits of the register and the lower 16 bits are always set to 0 due to the shift operation. There are only 16 sectors available for both the main banks Bank 0 and Bank 1 which means that the lower 16 bits of FSM_SECTOR1 should get updated corresponding to the variable u32SectorsEnables.

Kindly, let me understand how this configuration of FSM_SECTOR1 register in the implementation leads to enabling the corresponding sectors of the main bank as provided in FSM_SECTOR1 register description from the manual.

Thank you,

Susvitha.

  • Hi Susvitha,

    For FEE operation, please use the FEE driver generated by HALCOGen. Also you can check the source code of FEE driver to learn how the Flash registers are used for erasing the FEE sectors or bank.

  • Hi Wang, Thank you for the quick response!

    I have seen the code generated from HALCoGen. I couldn't find that the FEE driver is using the register FSM_SECTOR1. Please let me know if I have missed anything. Otherwise, I have understood the usage of FSM_SECTOR1 register update for enabling the 32 sectors of EEPROM as implemented below:

    FLASH_CONTROL_REGISTER->FsmSector1.u32Register = ~(u32SectorsEnables_31_0);

    While my  second query is about the update of 16-31 bits of the FSM_SECTOR1 register for enabling the sectors of main banks due to the shift operation below:

    FLASH_CONTROL_REGISTER->FsmSector1.u32Register = (uint32_t)(~u32SectorsEnables)<<0x10U;

    and the 0-15 bits are set to 0 with this operation. The sector count in the main bank is 16 and hence, the 0-15 bits are expected to update as per the manual.

    So, I am unclear about the above implementation provided in the F021 library code with resepct to the FSM_SECTOR1 register.

  • FLASH_CONTROL_REGISTER->FsmSector1.u32Register = ~(u32SectorsEnables_31_0);

    FLASH_CONTROL_REGISTER->FsmSector1.u32Register = (uint32_t)(~u32SectorsEnables)<<0x10U;

    are used to enable the EEPROM sectors 63:0. The EEPROM on TMS570LC43x has only 16 sectors, and all other bits [63:16] are left for future use.

    The FEE driver uses the F021 flash API to enable the EEPROM sectors:

    Fapi_enableEepromBankSectors(u32SectorsEnables_31_00, u32SectorsEnables_63_32);

    where u32SectorsEnables_31_0 and u32SectorsEnables_63_32 are the sectors required.