Announcements

Equip yourself to optimize AURIX™ MCUs for Evs at the EV Webinar. Click here to register.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

AURIX™ Forum Discussions

Sccccc
Level 1
Level 1
First reply posted First like given First question asked

Hi there,

I have a Kit_A2G_TC387_5V_TFT board, the TLF35584 's INT pin connected to the ESR1 pin on the TC387. What I wanne to know is which ESR1 pin has been used to this INT pin? It will be helpfull if any example code is provided for this scenario.

Thank you!

Best wishes!

0 Likes
2 Replies
cwunder
Employee
Employee
25 likes received 25 solutions authored 100 sign-ins

There are difference philosophies to servicing the NMI. For the TLF35584 I just set a flag in the NMI and then have it serviced outside at a high priority. If you are using iLLD's you can uncomment the define for the trap hooks in the file Ifx_Cfg.h

 

#define IFX_CFG_EXTEND_TRAP_HOOKS  /* Decomment this line if the project needs to extend trap hook functions */

 

 Then in the file IfxCpu_Trap.c 

 

#ifndef IFX_CFG_CPU_TRAP_NMI_HOOK
#   define IFX_CFG_CPU_TRAP_NMI_HOOK(trapWatch)   myTrapExtensionHook(trapWatch) /**< By default NMI macro is empty*/
#endif

 

Then create a header file that has the function for your traps

 

IFX_INLINE void myTrapExtensionHook(IfxCpu_Trap trapInfo)
 {
   switch (trapInfo.tClass)
   {
     case IfxCpu_Trap_Class_memoryManagement:
     {
       //user code: Function calls allowed.
       break;
     }
     case IfxCpu_Trap_Class_internalProtection:
     {
       //user code: Function calls allowed.
       break;
     }
     case IfxCpu_Trap_Class_instructionErrors:
     {
       //user code: Function calls allowed.
       break;
     }
     case IfxCpu_Trap_Class_contextManagement:
     {
       //user code: Function calls NOT allowed.
       break;
     }
     case IfxCpu_Trap_Class_bus:
     {
       //user code: Function calls allowed.
       break;
     }
     case IfxCpu_Trap_Class_assertion:
     {
       //user code: Function calls allowed.
       break;
     }
     case IfxCpu_Trap_Class_nonMaskableInterrupt:
     {
       //user code: Function calls allowed.
       TLF35584_IntHandler();
       break;
     }

     default:
         break;
   }
 }

 

Then in your code for the TLF35584 enable the ESR1 for the core you want.

 

void TLF35584_IntInit(void)
{
  uint16 cpuWdtPassword = IfxScuWdt_getCpuWatchdogPassword();
  /* TLF35584 INT connected /ESR1 to generates CPUx trap */
  IfxScuWdt_clearCpuEndinit(cpuWdtPassword);
  SCU_ESRCFG1.B.EDCON = 2;      /* trigger is generated on a falling edge */
  SCU_TRAPDIS0.B.CPU0ESR1T = 0; /* trap request can be generated for source /ESR1 */
  IfxScuWdt_setCpuEndinit(cpuWdtPassword);
}
void TLF35584_IntHandler (void)
{
  /* clear trap request for source /ESR1 */
  SCU_TRAPCLR.B.ESR1T = 1;
  /*Only used for debugging as a global counter of total NMI events */
  nmiEventCnt++;
  /* Indicate that an NMI event occurred, handling is done outside of the trap */
  nmiEvent++;
}

 

Then I have a task that checks the TLF35584

 

    /* check if any NMI (INT) events have occurred */
    TLF35584_CheckFlags();

 

 

Sccccc
Level 1
Level 1
First reply posted First like given First question asked

Hi Cwunder,

Thank you for your reply! It's very helpful!!!

New question is why I just send "setStateTransitionTLF35584(&g_tlfDevice, DeviceStateTransition_sleep);" to make TLF35584 goto sleep mode, it will turn to wake mode(get an interupt from ESR1) without press the wake button on board? 

 

Best wishes!

0 Likes