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.

CCS/HERCULES-F021FLASHAPI: Programming a Single Byte

Part Number: HERCULES-F021FLASHAPI
Other Parts Discussed in Thread: TMS570LS3137

Tool/software: Code Composer Studio

Hi,

I'm programming flash on tms570ls3137 demo board,in the Programming a Single Byte example code of  spna148.pdf,I didn't see the code to calculate ecc,what is the code for calculating ecc?

Thanks.

FLASH_CONTROL_REGISTER->Fbprot.u32Register = 1U; /* Disable Level 1 Protection */
/* Enable all sectors of current bank for erase and program. For EEPROM banks with more
than 16 sectors, this must be 0xFFFF */
FLASH_CONTROL_REGISTER->Fbse.u32Register = 0xFFFF;
FLASH_CONTROL_REGISTER->Fbprot.u32Register = 0U; /* Enable Level 1 Protection */
/*Unlock FSM registers for writing */
FLASH_CONTROL_REGISTER->FsmWrEna.u32Register = 0x5U;
/* Set command to "Clear the Status Register" */
FLASH_CONTROL_REGISTER->FsmCommand.FSM_COMMAND_BITS.FSMCMD = Fapi_ClearStatus;
/* Execute the Clear Status command */
FLASH_CONTROL_REGISTER->FsmExecute.FSM_EXECUTE_BITS.FSMEXECUTE = 0x15U;
/* Write address to FADDR register */
FLASH_CONTROL_REGISTER->Faddr.u32Register = 0x0100U;
/* Placing byte at address 0x0102 */
oFwpWriteByteAccessor[2] = 0xA5;
/* Set command to "Program" */
FLASH_CONTROL_REGISTER->FsmCommand.FSM_COMMAND_BITS.FSMCMD = Fapi_ProgramData;
/* Execute the Program command */
FLASH_CONTROL_REGISTER->FsmExecute.FSM_EXECUTE_BITS.FSMEXECUTE = 0x15U;
/* re-lock FSM registers to prevent writing */
FLASH_CONTROL_REGISTER->FsmWrEna.u32Register = 0x2U;

  • Hello,

    Please refer to the 2nd example code for ECC calculation. 

    I do not recommend you to write your own functions to erase/program the Flash. The reason is that the FSM registers is only the top level control and you will also need to set up Flash voltage registers to run the pump. The second part is complicated. If the Flash voltage registers are not programmed correctly, you are running the risk of damage the device when erasing/programming Flash.