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-EP: 你好,我想询问一些关于tms570ls3137芯片的flash ecc校验的问题? 很紧急 感谢

Part Number: TMS570LS3137-EP
Other Parts Discussed in Thread: UNIFLASH, TMS570LS3137

首先,我利用uniflash来烧写.out文件到芯片的flash中,uniflash有自带的auto ecc generation 功能,能自动烧写ecc区域。

然后,我在我的工程的启动代码中加入了

/* Enable CPU Event Export */
/* This allows the CPU to signal any single-bit or double-bit errors
detected
* by its ECC logic for accesses to program flash or data RAM.
*/
_coreEnableEventBusExport_();
/* USER CODE BEGIN (9) */
/* USER CODE END */

/* Enable response to ECC errors indicated by CPU for accesses to flash */
flashWREG->FEDACCTRL1 = 0x000A060AU;

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

/* Enable CPU ECC checking for ATCM (flash accesses) */
_coreEnableFlashEcc_();

这样应该能启动芯片的flash ecc校验。

我想验证芯片的flash ecc校验,我发现芯片的flash自带7个诊断模式,我在sys_selftest.c文件中发现了void checkFlashECC(void)函数。这个函数利用诊断模式7来自动修改cpu读取到的ecc值来设置单比特和双比特错误来检验flash ecc的正确性。 

但我发现在这个函数中,他在开启诊断模式7后,访问的地址不是flash,而是选择了flash的mirrored image ,

#define flashBadECC1 (*(volatile uint32 *)(0x20000000U))
#define flashBadECC2 (*(volatile uint32 *)(0x20000000U))

volatile uint32 flashread = 0U;
/* USER CODE BEGIN (40) */
/* USER CODE END */

/* Flash Module ECC Response enabled */
flashWREG->FEDACCTRL1 = 0x010A060AU;

/* Enable diagnostic mode and select diag mode 7 */
flashWREG->FDIAGCTRL = 0x00050007U;

/* Select ECC diagnostic mode, single-bit to be corrupted */
flashWREG->FPAROVR = 0x00005A01U;

/* Set the trigger for the diagnostic mode */
flashWREG->FDIAGCTRL |= 0x01000000U;

/* read a flash location from the mirrored memory map */
flashread = flashBadECC1;

/* disable diagnostic mode */
flashWREG->FDIAGCTRL = 0x000A0007U;

这样在这个函数中增添一些调试代码,能够发现单比特错误和双比特错误能够改变寄存器flashWREG->FEDACSTATUS的值,即cpu检测到了错误。

但是,当我把上述的flashBadECC1 flashBadECC2  改变为flash区域后,发现寄存器flashWREG->FEDACSTATUS的值还是0,即cpu检测不到错误。

这是怎么回事呢?    或者有没有其他的方法能检验flash ecc的功能。