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.

TMS570LC4357: about example_SafetyLib.c of HALCoGen

Guru 10235 points
Other Parts Discussed in Thread: HALCOGEN

Hello, TI Experts,

 

Our customer is designing a prototype product based-on TMS570LC4357-EVM(TMDX570LC43HDK).

They sent us a question about HALCoGen example code  for TMDX570LC43HDK.

   HALCoGen: 04.05.02

   SafeTI Diagnostic LibraryVersion: 2.2.0

   CCS:Version 6.1.3.00033

   sample_code:\Hercules\HALCoGen\v04.05.02\examples\TMS570LC43x\example_SafetyLib.c

 

They created the CCS project based on the guide written in example_SafetyLib.c of HALCoGen.

This CCS project succeeded (reach to main();)

 

After that, they modified the file "HL_esm.c" as follows to enable " ESM Error of Group1 Channel 52(CPU Interconnect Subsystem - Global error)"

  - set bit20 of IESR4  : rewrite 0U -> 1U as below;

     esmREG->IESR4 = .. | (uint32)((uint32)1U << 20U) | ..

  - set bit20 of ILSR4  : rewrite 0U -> 1U as below;

     esmREG->ILSR4 = .. | (uint32)((uint32)1U << 20U) | ..

 

After rebuild & load program & execute, This program went into while(1)-loop

after the line of "SL_SelfTest_STC(STC1_RUN, TRUE, &stcSelfTestConfig);  "

(line 825 of the file "example_SafetyLib.c")

 

Is this proper way to enable ESM error by modifying the file "HL_esm.c"?

 

I would appreciate if you tell us the recommended way to enable ESM Error in example_SafetyLib.c.

 

Best regards,

  • Hello Matusan,

    Can you check the ESM registers to see if any error flags are set when you are in the while(1) loop? What has likely occurred is the error path proof tests associated with the startup up have resulted in intentional ESM error flags being set (part of proving the error paths are working) and because of this, the SW enters into the while loop where a handler could be placed. The other possible scenario is a true error has occurred during start up causing the while loop to be entered. Let me know about the which ESM flags are set and we can diagnose the root cause from there.
  • Hello Chuck,

    Thank you for your prompt reply.
    I really appreciate your help.

    Our customer sent us the check result of ESM error flags as below when they are in the while(1) loop.
    ESMSR1 0x00000000
    ESMSR2 0x00000000
    ESMSR3 0x00000000
    ESMSR4 0x00100000 (Gr1-52 is set)

    Do you have same experience?
    I would appreciate if you diagnose the root cause and tell us the recommended way to enable ESM Error in example_SafetyLib.c.

    Best regards,
  • Hello Matusan,

    Looking into this issue a bit further, the reason the code goes to the while look is that the CPU self-test does not kickoff as it should. Basically, the function call SL_SelfTest_STC should never return as the CPU is reset at the end of the STC self-test. When the CPU is reset, it causes re-entry through reset and skips the STC SelfTest on the second time given the status of reset condition. (this is the if statement prior to the SL_SelfTest_STC call you mentioned).

    With that said, there should be no reason for the STC to not be kicked off. However, this could be because you are calling the esmInit too early. It should not be called from within the startup.c file. esmInit should be called after you have ran through all of the initial startup diagnostics and initialized your interrupt vector table, etc. This could be in the startup file before calling main or could be first thing in main.

    In reference to the "proper" way to modify the HL_esm.c file to enable the interrupts for the ESM Group1 Channel 52, you could, indeed, modify the code directly as you have mentioned. However, the sections would then be out of sync with your Halcogen project. I would recommend that you modify the configuration within Halcogen then re-generate the code. Any code that is within the User code sections will remain unchanged and the code associated with the halcogen configurations will be updated. (As always, keep backups so you don't loose work when modifying with Halcogen or another tool as it is easy to overwrite something. A suggestion is to keep your Halcogen generated code in a separate location and copy the files into the project directory when the configuration updates are satisfactorily made.)
  • Hello Chuck,

    Thank you for your detailed explanation.
    I really appreciate your help.
    I will send the answer to the customer.

    Best regards