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.

problem about debug with flash ecc

Other Parts Discussed in Thread: NOWECC

Hello:

    I am trying to simulate ECC error in the flash memory of a TMS570LS20216 board. Without debug modle, it works well, it can detection and correct 1 bit flash data error. Here is my code:

 

const unsigned int Multiple_Bit_Err_Test = 0x01010101;

unsigned int Multiple_Bit_Err_Loc;

/* USER CODE END */

void main(void)
{
/* USER CODE BEGIN (3) */
	unsigned int i;

	gioSetDirection(hetPORT, 0x0000003f);
	
	esmInit();
	rtiInit();
	
	flashWREG->FEDACCTRL1 = 0x010A023A;
	rtiEnableNotification(rtiNOTIFICATION_COMPARE3);
	
	_coreEnableEventBusExport_();
	_coreEnableFlashEcc_();
	_enable_interrupts();
	
	rtiStartCounter(rtiCOUNTER_BLOCK1);
	
	while(1)
	{
		gioSetBit(hetPORT, 1, 1);
		for(i=0; i<DELAYTIME; i++)
			;
		
		Multiple_Bit_Err_Loc = Multiple_Bit_Err_Test;
		if(Multiple_Bit_Err_Loc == 0x01010101)
		{
			gioSetBit(hetPORT, 2, 1);
		}
		else
		{
			gioSetBit(hetPORT, 2, 0);
		}
		
		gioSetBit(hetPORT, 1, 0);
		for(i=0; i<DELAYTIME; i++)
			;
	}
/* USER CODE END */
}

 

But when i debuging the program, when program runs to _coreEnableFlashEcc_(); The ECC address(0x00400000) value are all 0xBAD0BAD0( before it,  it's all 0xFFFFFFFF). Then, onthe next step, the program jump to

prefetchEntry         b   prefetchEntry

and the ERROR pin active low.

It's that means that my ecc code it's not burn into the flash?

I program the file into the flash like this :

Build my code to creat a .out file and use ecc tool to generate an ecc file, then use nowFlash tool program this two files. It works well because  there is no error in it.

Then use CCS debug the program, in "Erase Options" i choose "Selected Sectors Only" and check Bank0's "Sector 0".

It's that correct?

 

Regards,

Node.

 

  • Hello Node,

    Can you pls help me understand your test a little better, by explaining how you are creating an ECC error which later on gets auto corrected in your first part of the explanation ?

  • Hi Karthik:

        Sorry for my poor english.About "how you are creating an ECC error which later on gets auto corrected in your first part of the explanation ", I do it like this:

    1)First, i use a variable description as const type  like this:

       const unsigned int Multiple_Bit_Err_Test = 0x01010101;

       then in main(), enable flash ecc, read and check the calue is correct or not(0x01010101).If is not correct, make the gio pin active(high), else, make the gio pin low.

    2)Build the program to generate  a .out file.Then use nowEcc to generate an ecc file, use nowFlash program this two .out files into flash.Because the const value is never changed, ecc checking right, read and check the const value is always correct.

    3)Change the const calue :

      const unsigned int Multiple_Bit_Err_Test = 0x01010100;

    4)Rebuild program to generate an new .out file, but use the old ecc file(generate in step 2), use nowFlash program this two .out files into flash..Because the const value changed 1 bit(0x01010101 to 0x01010100), ecc checking wrong, ERROR pin active low, but gio pin is still low, because 1 bit error is a single error, the ecc can correct it.

     

    That is all. Is that correct? Please let me know.Thank you.

     

    Regards,

    Node.

  • Hi Node,

    Don't worry about that !

    This is one way to generate a single bit error or if you know the address/data location of the variable from your map file, you can still use -s1/s2 option in nowEcc to create a single/double-bit error, as well as option -a which will append both your data and ecc to create a single .out.

    I assume your code is working okay as expected when you release the system out of reset without debugger being connected, after programming both the .out files togethor.

    But when debugger is connected you are trying to erase a flash sector and program just that sector and you see it not working. when ever a flash bank is erased ECC also gets erased, so when you program again with just the main section your ECC may be still in erased state. This is what I can infer from your later part of the description.

    Let me know if this helps.

  • Hi Karthik:

        That is what I want to know. Thank you.

     

     

    Best Regards

    Node