cancel
Showing results for 
Search instead for 
Did you mean: 

I want to test Error Correction code (ECC) for the flash memory for the NUCLEO-H743ZI2 (STM32H743 micro) and want a way to generate a FLASH ECC error. Application note AN5342 discusses ECC, but not how to simulate a FLASH ECC error.

SLand
Associate II

Are there any writeups or other instructions on how to do this?

Thanks,

2 REPLIES 2
SLand
Associate II

Thank you for your prompt reply.

I reviewed the two links. 

The first link discussed ideas for simulating a FLASH ECC error, but the ideas seemed more like speculation rather than concrete examples of how to simulate ECC FLASH errors. Does anyone have any experience getting an ECC error according to the suggestions in the link?

The second link refers to a different style of micro altogether. This code discusses erasing a sector, then writing eight FLASH locations with slightly different values. The STM2H743 writes to 32 bytes of data at a time, so there’s no way of directly relating this code to the 743. I’ll include part of that code at the end.

I did find another link that looks promising, but have not been able to get it to work for the STM32H743:

https://community.st.com/s/question/0D53W00000artCvSAI/hi-i-am-using-stm32h747-controller-i-want-to-test-the-ecc-functionality-for-rom-of-the-same-how-can-i-inject-an-error-to-check-if-it-really-raises-the-flag-or-not

So.....still trying to figure this out......

(Code generated from the SPC5Studio)

void flash_generate_error(void) {

 uint32_t returnCode;

 uint32_t lowEnabledBlocks;

 uint32_t midEnabledBlocks;

 uint32_t highEnabledBlocks;

 uint32_t size;

 uint32_t source;

 uint32_t data;

 /* erase first block of dataflash*/

 lowEnabledBlocks = 0x0000000F;

 midEnabledBlocks = 0x00000000;

 highEnabledBlocks = 0x00000000;

 returnCode = pFlashErase(&ssdDataConfig, FALSE, lowEnabledBlocks, midEnabledBlocks, highEnabledBlocks, (tpfNullCallback)NULL_CALLBACK);

 if ( C90FL_OK != returnCode) {

 for(;;){}

 }

 /* write 0xFFFF_FFFF_FFFF_FFFA to first location */

 buffer[0] = 0xFFFFFFFFUL;

 buffer[1] = 0xFFFFFFFAUL;

 source = (uint32_t)buffer;

 size = 8U;

 returnCode = pFlashProgram(&ssdDataConfig, ssdDataConfig.mainArrayBase, size, source, (tpfNullCallback)NULL_CALLBACK);

 if ( C90FL_OK != returnCode) {

       for(;;){}

 }

 /* write 0xAAAA_AAAA _AAAA_AAAA in the same location. This will generate ECC non correctable error */

 buffer[0] = 0xAAAAAAAAUL;

 buffer[1] = 0xAAAAAAAAUL;

 source = (uint32_t)buffer;

 size = 8U;

 returnCode = pFlashProgram(&ssdDataConfig, ssdDataConfig.mainArrayBase, size, source, (tpfNullCallback)NULL_CALLBACK);

 (void)returnCode;

 data = *((vuint32_t*)(ssdDataConfig.mainArrayBase));

 (void)data;

 /*

  if ( C90FL_OK != returnCode) {

  while(1);

  }*/

}