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.

TDA4VM-Q1: SDL Ver. 1.0.0 ESM Implementation and Examples

Part Number: TDA4VM-Q1

Hi TI Experts,

I am recently developing SDL (Software Diagnostic Library) Ver. 1.0.0 on our system, during the development of ESM I have some questions shown in the below. 

1. I deployed the ESM example (MCU&Wake-up domains) provided by the SDL on MCU1_0 Autosar OS, and found that the VTM events are not triggering the ESM interrupts immediately by observing via the debugger.

 

In other words, useCaseTrigger() is executed from index i=0 to i=2 without being interrupted, after that the ESM interrupts then are triggered and the callback functions are called.(However, the global variable currTestCase is 3 now which will affect the callback function performance, then the test cases failed).

From my perspective, it is supposed to be like: useCaseTrigger(0) -> ESM interrupt and callback function -> currTestCase++ ->useCaseTrigger(1) ->  ESM interrupt and callback function -> currTestCase++ -> ....

If I run the test cases independently, they all work (currTestCase is correct). So, is it possible that the VTM trigger function vtmTriggerTh1() in useCaseTrigger() is not reporting the event immediately?  It takes time to set the new temperature threshold hence the ESM interrupt is not up at once?

2. SDL ESM API SDL_ESM_interruptHandler() is provided to handle ESM events, and it keeps reading the interrupt sources until there are no events in the ESM registers (pulse and level):

    /* Check on the highest priority event and handle it */
    do {
        (void)SDL_ESM_getGroupIntrStatus((uint32_t)esmInstBaseAddr,
                                         (uint32_t)esmIntrPriorityLvlType,
                                         &localEsmGroupIntrStatus);
        intSrc1 = localEsmGroupIntrStatus.highestPendPlsIntNum;
        SDL_ESM_processInterruptSource((uint32_t)esmInstBaseAddr, esmIntType, intSrc1);
        intSrc2 = localEsmGroupIntrStatus.highestPendLvlIntNum;
        SDL_ESM_processInterruptSource((uint32_t)esmInstBaseAddr, esmIntType, intSrc2);
    } while ((intSrc1 != (uint32_t)(NO_EVENT_VALUE)) || (intSrc2 != (uint32_t)(NO_EVENT_VALUE)));

There are a lot of errors in the ESM event lists cannot be recovered, hence in these cases we can do nothing to process the interrupt source and exit the interrupt but reset the system. Anyhow, we still want to log these error events to the Non-volatile Memory.

Does SDL provide any APIs or solutions which enable the event logging in the NvM within the ESM interrupt handler so that we can still read them back after power off reset?

Thank you so much for your patience.

  • Hi,

    Could you provide more details regarding your build set up? Are you using SDL that comes as a part of the latest SDK release or is SDL being downloaded from somewhere and then integrated with some application?

    Does SDL provide any APIs or solutions which enable the event logging in the NvM within the ESM interrupt handler so that we can still read them back after power off reset?

    No, SDL does not have APIs that log ESM error events in the non-volatile memory. You could log them manually, based on the ESM callback or handler if required.

    Thanks,

    Josiitaa

  • Hi Josiitaa,

    Thanks for your reply.

    I downloaded the SDK 8.05 and located the SDL within SDK 8.05. Then I integrated the SDL into our system, which is running autosar OS on MCU1_0.

    I tried to run the ESM example provided in the SDL Ver. 1.0.0 and can understand the test cases provided. I run the VTM test cases (use case UC-1, UC-2, UC-3).

    But I observed there are some delays from useCaseTrigger() to SDL_ESM_applicationcallbackFunction() that the registered ESM Interrupts are not signaled as soon as each use case is triggered. But the ESM interrupts and callback functions can be triggered later after all the useCaseTrigger() are run eventually.

        /* Trigger each use Case */
        for (i = 0; i < USE_CASES; i++) {
            retValue = useCaseTrigger(i);
    
            if (retValue != 0) {
                UART_printf("\nERR: Use Case Trigger for use Case %d failed \n",
                            retValue);
                break;
            }
     

    Has TI actually tested the SDL ESM examples? Is it following the expected sequence?

    useCaseTrigger(0) -> ESM interrupt and callback function -> currTestCase++ ->useCaseTrigger(1) ->  ESM interrupt and callback function -> currTestCase++ -> ....

    Since the SDL ESM example should be run in non-OS (baremental) environment, I am not sure whether the OS matters.

  • Hi,

    These are the logs obtained when I run the esm_wkup_mcu_app on SDK 8.5.

     ESM Example Application
    
    VTM_ESM_init: Init WKUP ESM complete 
    
    TIMER_ESM_init: Init MCU ESM complete 
    
    ESM example init complete
      Any clear of MCU_SAFETY_ERRORn pin will first wait 10 usecs
      Minimum Time Interval is 99 usecs
    ESM timer initialization complete
    
    Starting Test Case 0 
    
      ESM Call back function called : instType 0x1, intType 0x2, grpChannel 0x0, index 0x8, intSrc 0x8 
      Take action 
      ESM instance #1, ESM interrupt type = Low Priority ESM event
    
        Got ltThr0 interrupt through ESM module
    
        System at a temperature below the threshold of lt_thr0 
        System running at a safe temperature 
    
      ESM Call back function called : instType 0x1, intType 0x2, grpChannel 0x0, index 0x9, intSrc 0x9 
      Take action 
      ESM instance #1, ESM interrupt type = Low Priority ESM event
    case 0 sucess
    
    Use Case 0 completed: Input Event Trigger = Step completed successfully, 
                           Event Handler Complete = Step completed successfully, 
                           MCU_SAFETY_ERRORn Pin Clear = Step completed successfully
    
    Starting Test Case 1 
    
      ESM Call back function called : instType 0x1, intType 0x2, grpChannel 0x0, index 0x8, intSrc 0x8 
      Take action 
      ESM instance #1, ESM interrupt type = Low Priority ESM event
    
      ESM Call back function called : instType 0x1, intType 0x1, grpChannel 0x0, index 0xa, intSrc 0xa 
      Take action 
      ESM instance #1, ESM interrupt type = High Priority ESM event
    
      ESM Call back function called : instType 0x1, intType 0x2, grpChannel 0x0, index 0x8, intSrc 0x8 
      Take action 
      ESM instance #1, ESM interrupt type = Low Priority ESM event
    
        Got ltThr0 interrupt through ESM module
    
        System at a temperature below the threshold of lt_thr0 
        System running at a safe temperature 
    
      ESM Call back function called : instType 0x1, intType 0x2, grpChannel 0x0, index 0x9, intSrc 0x9 
      Take action 
      ESM instance #1, ESM interrupt type = Low Priority ESM event
    
      timerExpPinDisable: before clear, ESM instance 1 view of MCU_SAFETY_ERRORn pin is 0
    case 1 sucess
    
    Use Case 1 completed: Input Event Trigger = Step completed successfully, 
                           Event Handler Complete = Step completed successfully, 
                           MCU_SAFETY_ERRORn Pin Clear = Step completed successfully
    
    Starting Test Case 2 
    
      ESM Call back function called : instType 0x1, intType 0x2, grpChannel 0x0, index 0x8, intSrc 0x8 
      Take action 
      ESM instance #1, ESM interrupt type = Low Priority ESM event
    
      ESM Call back function called : instType 0x1, intType 0x1, grpChannel 0x0, index 0xa, intSrc 0xa 
      Take action 
      ESM instance #1, ESM interrupt type = High Priority ESM event
    
      timerExpPinDisable: before clear, ESM instance 1 view of MCU_SAFETY_ERRORn pin is 0
    
      ESM Call back function called : instType 0x1, intType 0x2, grpChannel 0x0, index 0x8, intSrc 0x8 
      Take action 
      ESM instance #1, ESM interrupt type = Low Priority ESM event
    
        Got ltThr0 interrupt through ESM module
    
        System at a temperature below the threshold of lt_thr0 
        System running at a safe temperature 
    
      ESM Call back function called : instType 0x1, intType 0x2, grpChannel 0x0, index 0x9, intSrc 0x9 
      Take action 
      ESM instance #1, ESM interrupt type = Low Priority ESM event
    
    Use Case 2 completed: Input Event Trigger = Step completed successfully, 
                           Event Handler Complete = Step completed successfully, 
                           MCU_SAFETY_ERRORn Pin Clear = Step completed successfully
    
    Starting Test Case 3 
    
      ESM Call back function called : instType 0x2, intType 0x2, grpChannel 0x1, index 0x19, intSrc 0x39 
      Take action 
      ESM instance #2, ESM interrupt type = Low Priority ESM event
    
    Use Case 3 completed: Input Event Trigger = Step completed successfully, 
                           Event Handler Complete = Step completed successfully, 
                           MCU_SAFETY_ERRORn Pin Clear = Step completed successfully
    
    Starting Test Case 4 
    
      ESM Call back function called : instType 0x2, intType 0x1, grpChannel 0x1, index 0x18, intSrc 0x38 
      Take action 
      ESM instance #2, ESM interrupt type = High Priority ESM event
    
      timerExpPinDisable: before clear, ESM instance 2 view of MCU_SAFETY_ERRORn pin is 0
    
    Use Case 4 completed: Input Event Trigger = Step completed successfully, 
                           Event Handler Complete = Step completed successfully, 
                           MCU_SAFETY_ERRORn Pin Clear = Step completed successfully
    
    Starting Test Case 5 
    
      ESM Call back function called : instType 0x2, intType 0x3, grpChannel 0x1, index 0x0, intSrc 0x0 
      Take action 
      ESM instance #2, ESM interrupt type = Config ESM event
    
    Use Case 5 completed: Input Event Trigger = Step completed successfully, 
                           Event Handler Complete = Step completed successfully, 
                           MCU_SAFETY_ERRORn Pin Clear = Step completed successfully
    
    Starting Test Case 6 
    
      ESM Call back function called : instType 0x2, intType 0x2, grpChannel 0x1, index 0x19, intSrc 0x39 
      Take action 
      ESM instance #2, ESM interrupt type = Low Priority ESM event
    
    Use Case 6 completed: Input Event Trigger = Step completed successfully, 
                           Event Handler Complete = Step completed successfully, 
                           MCU_SAFETY_ERRORn Pin Clear = Step completed successfully
    
    
    ESM Example Application summary
    -------------------------------
    Completed 7 Test Cases
    Received 3 High Priority Interrupts
    Received 10 Low Priority Interrupts
    
    Test Case Event Log
    ------------------
    
    Test Case 0: ESM Call back function called : grpChannel 0x0, index 0x8, intSrc 0x8 
      ESM instance #1, ESM interrupt type = Low Priority ESM event
    
    Test Case 0: ESM Call back function called : grpChannel 0x0, index 0x9, intSrc 0x9 
      ESM instance #1, ESM interrupt type = Low Priority ESM event
    
    Test Case 1: ESM Call back function called : grpChannel 0x0, index 0x8, intSrc 0x8 
      ESM instance #1, ESM interrupt type = Low Priority ESM event
    
    Test Case 1: ESM Call back function called : grpChannel 0x0, index 0xa, intSrc 0xa 
      ESM instance #1, ESM interrupt type = High Priority ESM event
    
    Test Case 1: ESM Call back function called : grpChannel 0x0, index 0x8, intSrc 0x8 
      ESM instance #1, ESM interrupt type = Low Priority ESM event
    
    Test Case 1: ESM Call back function called : grpChannel 0x0, index 0x9, intSrc 0x9 
      ESM instance #1, ESM interrupt type = Low Priority ESM event
    
    Test Case 2: ESM Call back function called : grpChannel 0x0, index 0x8, intSrc 0x8 
      ESM instance #1, ESM interrupt type = Low Priority ESM event
    
    Test Case 2: ESM Call back function called : grpChannel 0x0, index 0xa, intSrc 0xa 
      ESM instance #1, ESM interrupt type = High Priority ESM event
    
    Test Case 2: ESM Call back function called : grpChannel 0x0, index 0x8, intSrc 0x8 
      ESM instance #1, ESM interrupt type = Low Priority ESM event
    
    Test Case 2: ESM Call back function called : grpChannel 0x0, index 0x9, intSrc 0x9 
      ESM instance #1, ESM interrupt type = Low Priority ESM event
    
    Test Case 3: ESM Call back function called : grpChannel 0x1, index 0x19, intSrc 0x39 
      ESM instance #2, ESM interrupt type = Low Priority ESM event
    
    Test Case 4: ESM Call back function called : grpChannel 0x1, index 0x18, intSrc 0x38 
      ESM instance #2, ESM interrupt type = High Priority ESM event
    
    Test Case 5: ESM Call back function called : grpChannel 0x1, index 0x0, intSrc 0x0 
      ESM instance #2, ESM interrupt type = Config ESM event
    
    Test Case 6: ESM Call back function called : grpChannel 0x1, index 0x19, intSrc 0x39 
      ESM instance #2, ESM interrupt type = Low Priority ESM event
    
    ESM Example Application: Complete
     All Use cases have passed. 
    esm_input_trig.c:650:esm_app:PASS
    
    -----------------------
    1 Tests 0 Failures 0 Ignored 
    OK
    
    

    The ESM callback does occur when each usecase is tested, following the expected sequence. Are these the logs that you observe as well?

    Thanks,

    Josiitaa

  • Hi Josiitaa,

    When I run each of the VTM use cases, it works just like the log you gave above, perfectly! However, it seems there it still some delay. In other words, when the use case is run, the interrupt and application callback function is not called immediately but wait for some time finish the following functions.

    When I run in form of 

    for (i = 0; i < USE_CASES; i++) {
    retValue = useCaseTrigger(i);

    The sequence from my site is like:

    useCaseTrigger(0) -> useCaseTrigger(1)-> useCaseTriggger(2) -> ESM callback functions called for case 1 -> ESM callback functions called for case 2 -> ESM callback functions called for case 3 -> ...

    If the baremental environment thery working properly, I guess it is autosar OS problem then. 

    Thanks.

  • Hi,

    When I run each of the VTM use cases, it works just like the log you gave above, perfectly!

    The baremetal example application seems to work as expected.

    If the baremental environment thery working properly, I guess it is autosar OS problem then. 

    I will not be able to confirm if the issue is due to an autosar OS problem as I have not been able to reproduce the issue.

    Thanks,

    Josiitaa

  • Hi Josiitaa,

    thanks for your for reply.

    As for the power-off logging problem, since SDL is not providing any solutions, do you have any ideas that we can log something in the memory before resetting?

    I heard from my colleague that psram is available in this situation, any documents I can refer to about its usage?

  • Hi,

    You could manually change the code within the ESM callback to log the ESM events before resetting the module. We do not have any example code or documentation available currently.

    Thanks,

    Josiitaa