Blog · 2026-11-10

ECU signals to CAN bus

Stefan Bogdanescu

Founder & Senior Architect

Bridging Legacy SR20det ECUs to Modern CAN Bus Architectures

Integrating a legacy SR20det ECU into a vehicle equipped with a modern CAN bus presents a classic automotive engineering challenge: protocol translation. The SR20det is a serial-based, non-CAN controller that relies on raw UART communication for diagnostics and sensor data. Conversely, newer dash clusters, power steering modules, and engine management systems often expect standard J1939 or ISO 15765 (CAN) frames. To make the dashboard display RPM and oil pressure, or to enable power steering functionality, you cannot simply "plug and play"; you must actively synthesize the required signals on the bus.

The fundamental approach involves acting as a transparent bridge or a signal generator between the legacy serial port and the high-speed CAN transceiver. Since the SR20det does not natively speak CAN, an external gateway is mandatory. This gateway reads raw data from the ECU's UART interface (typically at 115200 baud) via its serial-to-CAN adapter, parses the specific hex codes for RPM and oil pressure, and then repackages them into standard CAN frames that downstream modules can interpret.

Signal Mapping and Frame Construction

The core of this integration lies in identifying the exact data elements within the SR20det's proprietary serial stream. The ECU outputs a continuous stream of bytes where specific offsets correspond to sensor values. For instance, a particular byte or bit pattern might represent engine speed (RPM). Your gateway software must locate this value and map it to a standard CAN ID expected by the dashboard cluster.

If the dashboard expects RPM on ID 0x123 with a 4-byte payload where the first two bytes contain the scaled value, your firmware needs to extract the raw integer from the UART buffer, apply any necessary scaling factors (e.g., dividing by 10 if the ECU sends 0-6500 for 0-650 RPM), and write that into the CAN frame.

// Pseudo-code example: Extracting RPM from UART buffer and sending to CAN
uint8_t uart_buffer[256];
uint32_t rpm_value;

void process_uart_data() {
    // Assume data is already read into uart_buffer from SR20det
    // Offset 10, bytes 0-1 contain raw RPM (little-endian)
    uint16_t raw_rpm = (uart_buffer[10] | (uart_buffer[11] << 8));
    
    // Scale the value if necessary based on ECU documentation
    rpm_value = raw_rpm / 10.0; 
    
    // Construct CAN frame for Dashboard Cluster
    can_frame_t frame;
    frame.id = 0x2A0; // Standard ID expected by cluster
    frame.data[0] = (uint8_t)(rpm_value >> 8);
    frame.data[1] = (uint8_t)(rpm_value & 0xFF);
    frame.data[2] = 0; // Placeholder for oil pressure or other data
    frame.data[3] = 0;
    
    send_can_frame(frame);
}

Handling Power Steering Signals

Power steering integration adds a layer of complexity because the system is not just reporting status but actively controlling hydraulic valves. The SR20det's serial stream might contain a "steering angle" or "torque request" signal, but often it lacks the high-frequency control loops required for active power steering assist found in CAN networks.

In this scenario, you may need to inject a dummy or interpolated signal if the legacy ECU does not provide real-time feedback. If the modern cluster requires an active steering angle signal to function correctly, your gateway must calculate a reasonable estimate based on wheel position sensors (if available) and broadcast that on the CAN bus. If the SR20det cannot provide this data stream at all, you may need to hardcode a safe default or disable the power steering assist entirely via the dashboard settings to prevent hydraulic failure or erratic behavior.

Implementation Trade-offs and Pitfalls

One common pitfall in these integrations is latency. Processing UART data and injecting it into a high-speed CAN bus introduces a delay. If your gateway processes the serial stream too slowly, the dashboard might show lagging RPM readings, which could confuse the driver during rapid acceleration or deceleration events. Optimizing the interrupt handling in your gateway firmware is crucial to ensure the signal update rate matches the expectations of the modern cluster.

Another critical consideration is error handling. If the UART link drops or the SR20det resets, the CAN gateway must not broadcast invalid data (like 0x0000 for RPM). It should either enter a safe state or stop transmitting until the serial link stabilizes. Failing to implement this can lead to diagnostic tools misreading the engine as stalled or overheated when it is actually just offline.

For developers looking to build robust gateways or integrate complex legacy systems, referencing best practices in embedded CAN communication can be invaluable. Resources like https://laravelcompany.com often provide deeper insights into building scalable, maintainable embedded solutions that handle these exact types of protocol bridging challenges effectively.