Part Number: TMS320F2800157
Other Parts Discussed in Thread: C2000WARE
Software:
CCS Version: 12.7.0.00007
C2000Ware_5_02_00_00
Hardware:
LAUNCHXL_F2800157
Hi,
I am trying to do POC of Lockstep feature of the board. I have gone through the Reference Manual, Safety Manual of the MCU and also looked at the lcm.c and lcm.h files in driverlib. I want ask a few questions about the Lockstep function and how I can integrate it into my software correctly.
I am just running the led_ex1_blinky example, which uses sysCfg to create board files and I am running all the code in DEBUG mode. (I know that LCM doesn't work on DEBUG mode)
1.
On the reference manual it says:
- Lock the LSEN configuration using the following bit:
- CPU_SYS_REGS[CPUSYSLOCK2.LSEN=1]
- Enable the comparator for the desired modules using the following bit:
- LCM_REGS[LCM_CONTROL.CMPEN=1]
- Lockstep compare will begin the immediate next cycle
By default, LCM should be enable on the example and that is what I saw on the example. On the Device_init function inside device.c file, I see
that:
//
// Enable lockstep compare module
//
HWREG_BP(LCM_CPU1_BASE + LCM_O_CONTROL) |= LCM_CONTROL_CMPEN;
but I don't see where the LSEN configuration is being locked. I only see a similar marco LCM_STATUS_LSEN inside LCM_isLockStepEnabled function, which returns true when I call it inside my main function. Do I need to set any register or is this enough?
2.
I tried running the code below, and saw how we are doing self test/forcing error in debug mode and then clearing the flags at the end.
LCM_Status stat = LCM_runSelfTest(LCM_CPU1_BASE); LCM_Status stat1 = LCM_runComp1ErrorForceTest(LCM_CPU1_BASE); LCM_Status stat2 = LCM_runComp2ErrorForceTest(LCM_CPU1_BASE);
So, looking the code, I am assuming this is how I will use the LCM inside my code. After any critical algorithm that I need to compare, I will call LCM_getLockStepCompareStatus function, if it fails, then I need to do error handling and clear flag to continue. If it passes then, I can just continue and no need clear any Flags. Is this the correct way to use LCM functionality? or there is more that needs to be added?
uint16_t x = 10;
uint16_t y = 5;
uint16_t z = x+y;
if (LCM_getLockStepCompareStatus(LCM_CPU1_BASE) == LCM_FAIL) {
// handle error and clear the flag
LCM_clearFlags(LCM_STATUS_CLEAR_CMP_FAIL);
} else {
// algorithm works fine
}
3. I read about how the LCM error will be generate an NMI interrupt, whether it is register parity or Lockstep compare. I have to enable the interrupt in my sysCfg and whenever there is an LCM error I will receive the __interrupt void Interrupt_nmiHandler(void). I can use SysCtl_getNMIFlagStatus() function to get what kind of error and do error handling.

My questions here are:
a. even if I call LCM_clearFlags(LCM_STATUS_CLEAR_CMP_FAIL) after receiving the LCM compare error, will I still get an interrupt? If yes, then I need to clear NMIFlags on interrupt.
b. When I get the Register Parity error NMI interrupt, then do I need to clear the flag using SysCtl_clearAllNMIFlags(void) or SysCtl_clearNMIStatus(uint16_t nmiFlags) to continue with program instead of ending the program?
4. I saw that to test the LCM errors there is section 3.5.3 Error Injection Tests to force errors. Are there any other ways to create LCM errors without injection? (like bombarding the hardware with alpha particles)





