Configuring an ECU to continue transmitting messages without requiring an ACK in a CAN network depends on the CAN controller and software stack in use.
Below are some possible approaches:
1. Using Silent Mode (Loopback Mode)
Some CAN controllers support a silent mode (also called "listen-only" or "loopback mode").
In this mode, the ECU transmits messages but ignores the absence of ACKs.
This is useful for standalone testing.
Example (for a generic CAN controller like Microchip MCP2515):
CANCTRL |= 0x08; // Set loopback mode (ignores ACKs)
For STM32 using HAL, you can configure Loopback Mode in the CAN_InitTypeDef structure.
2. Disabling Automatic Retransmission (NART Mode)
Many CAN controllers, including those in STM32 and automotive ECUs, have a No Automatic Retransmission (NART) mode.
When enabled, the ECU sends a message once and does not retry if an ACK is missing.
STM32 Example (NART Mode in CubeMX/HAL):
hcan.Init.TransmitFifoPriority = DISABLE;
hcan.Init.Mode = CAN_MODE_NORMAL;
hcan.Init.AutoRetransmission = DISABLE; // Disables retrying if no ACK
This prevents continuous retransmission but still allows single transmission.
3. Configuring Transceiver for Single-Wire Mode
Some ECUs use single-wire CAN, where ACKs are not always required.
Configuring the CAN transceiver into single-wire mode may allow messages to transmit without an ACK.
Example: NXP TJA1054 transceivers support Sleep mode, which sometimes allows unacknowledged transmission.
4. Custom Firmware with Periodic Retransmission
If the CAN controller enforces ACK requirements, you can implement a software-based workaround by periodically resending the message.
Example using a timer to resend messages every 100ms:
void CAN_Transmit_Message() {
static CAN_TxHeaderTypeDef TxHeader;
uint8_t TxData[8] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
uint32_t TxMailbox;
if (HAL_CAN_AddTxMessage(&hcan, &TxHeader, TxData, &TxMailbox) != HAL_OK) {
// Error Handling (but ignore ACK failures)
}
}
// Call this function in a timer interrupt
This ensures that even if an ACK is missing, the message continues being sent periodically.
5. Using a Software-Simulated CAN Bus
If using a PC-based CAN simulation (like Vector CANoe, PEAK PCAN, or SocketCAN in Linux), you can configure it to allow transmission without requiring a physical ACK.
Example: In SocketCAN, use ip link set can0 up type can bitrate 500000 loopback on to send messages without expecting ACKs.
Key Considerations
In a real CAN network, at least one other node must acknowledge messages, or the bus will enter error passive/bus-off states. If you are planning to use your ECU CAN Communication to work in No ACK Mode, please do a through analysis of how it can impact the overall system functions.
If using this setup in a real vehicle, ensure that ignoring ACKs does not interfere with safety-critical functions. This is highly not recommended in case of safety-critical functions.
留言