Implementing Specific Network Message Segment Wake-up with NXP TJA1043

Introduction:

For the scenario of controlling ECU power with the TJ1043 chip (pulling the INH pin high to wake up the ECU), combined with Vector AUTOSAR to achieve the requirement of “waking up only on network management messages”, the following is a step-by-step solution and code logic.

1. Hardware and Requirement Analysis

    • TJ1043 Features: Detects any CAN message → INH pin pulled high → ECU powered on.

    • Objective: The ECU should only be fully awakened when receiving a network management message (NM message); other messages should not trigger business logic.

    • Key Conflict: The ECU will default to running immediately after powering on, requiring a quick suspension (Pending) and filtering out non-NM messages.

2. Configuration

1. Dynamic Detection Wakeup Event

Implementing Specific Network Message Segment Wake-up with NXP TJA1043

Function Implementation

Implementing Specific Network Message Segment Wake-up with NXP TJA10432. How to Prevent Task from Running

In EcuM_GoHalt, resources are occupied, preventing other tasks from being called, so all tasks must be associated with resources.

Implementing Specific Network Message Segment Wake-up with NXP TJA1043

3. Ecu Pending State Handling

When handling the Pending state of the ECU, there are two situations: one is receiving a normal message, and the other is receiving a network management message. How to determine whether the received message is a network management message or a normal message?

Step 1: How to Ensure the ECU Works Normally After Receiving a Network Management Message

1) Enable CAN Receive Interrupt

Implementing Specific Network Message Segment Wake-up with NXP TJA1043

2) In the Interrupt Handler, Determine the Message ID to Distinguish Between Normal and Network Management Messages

Implementing Specific Network Message Segment Wake-up with NXP TJA1043

The interface function implementation is as follows:

Implementing Specific Network Message Segment Wake-up with NXP TJA1043

3) How to Handle Wakeup Source

In the function EcuM_CheckWakeup in the EcuM_Callout_Stub.c file, add the following logic to handle the wakeup event.

Implementing Specific Network Message Segment Wake-up with NXP TJA1043

4) Message Handling

      • Only NM messages can be uploaded by CanIf when the ECU is in Halt.

Implementing Specific Network Message Segment Wake-up with NXP TJA1043

      • Disable the functionality of uploading PDU other than NM messages during power-up.

        • Can reduce the load of CAN interrupts during power-up;

        • Avoid the issue where diagnostic Test commands sent during power-up cause the ECU to enter diagnostic DET.Implementing Specific Network Message Segment Wake-up with NXP TJA1043

      • After the ECU receives the network management message and can operate normally, re-enable the functionality of uploading all messages. This is reflected in PollingWakeupEvent.

Step 2: How to Handle Network State Transitions

Implementing Specific Network Message Segment Wake-up with NXP TJA1043

Implementing Specific Network Message Segment Wake-up with NXP TJA1043

Step 3: How to Handle Power Down Logic

Power Down Conditions:

Case 1: No network management message received on the bus, ECU not running. Case 2: Network management message received on the bus, ECU running normally.

Power Down Conditions:

No messages received on the bus for 200ms, so a timer must be used to complete the relevant detection.

How to Handle:

Set the received flag in the CAN interrupt, clear the relevant flag in the interrupt, and if the relevant received flag is False, proceed with the power down logic.

Case 1 Handling Logic:

Implementing Specific Network Message Segment Wake-up with NXP TJA1043

Case 2 Handling Logic:

Need to save E2PROM data before power down, and during the power down process, check the relevant restart flag. If a restart state is detected, enter the restart state.

Implementing Specific Network Message Segment Wake-up with NXP TJA1043

Implementing Specific Network Message Segment Wake-up with NXP TJA1043

Power Down Execution Order

EcmM_GoDown–>EcuM_OnGoOffOne—>EcuM_AL_SwitchOff.

In EcuM_GoDown, the ShutdownTask will be activated. The priority of ShutdownTask is higher than PreShutdown, so when it is activated, it will execute first, and then continue executing any PreShutdown tasks that have not been executed.

Implementing Specific Network Message Segment Wake-up with NXP TJA1043

Implementing Specific Network Message Segment Wake-up with NXP TJA1043

Implementing Specific Network Message Segment Wake-up with NXP TJA1043

Enable Shutdown Hook

Implementing Specific Network Message Segment Wake-up with NXP TJA1043

Implementing Specific Network Message Segment Wake-up with NXP TJA1043

Implementing Specific Network Message Segment Wake-up with NXP TJA1043In Conclusion: If you like the author’s work, please like, bookmark, and follow!Implementing Specific Network Message Segment Wake-up with NXP TJA1043. Your support is the motivation for my continued creation.

Leave a Comment