Specifically it seems to be the line
ramread = tcramA1bit;
I haven't had trouble with this until I started writing my own het program, but I don't see how I could be doing something that would affect the self test
/* Force a double bit error in both the banks */
_coreDisableRamEcc_();
tcramA2bitError ^= 3U;
tcramB2bitError ^= 3U;
_coreEnableRamEcc_();
/* Read the corrupted data to generate double bit error */
ramread = tcramA2bit;
ramread = tcramB2bit;
regread = tcram1REG->RAMUERRADDR;
regread = tcram2REG->RAMUERRADDR;
