SavvyCAN sending requests

Hi everybody,

I’am new to macchina M2 and currently trying to get some value from ECU (Subaru Impreza 2015).
I receive messages with various IDs but when I send request, nothing back.

I am working with Scripting Interface:

function setup ()
{
    host.setTickInterval(1000);
    can.setFilter(0x700, 0x700, 0); //Allow responses from ID 7XX
    // ECU requests: 0x7DF or 0x7E0
    // ECU response: 0x7E8
}

function gotCANFrame (bus, id, len, data)
{
    host.log("Bus: " + bus + "  id: " + id.toString(16));
}

function gotISOTPMessage(bus, id, len, data)
{
    host.log("ISOTP bus " + bus + "  ID: " + id.toString(16));
}

function gotUDSMessage(bus, id, service, subFunc, len, data)
{
    host.log("UDS Bus: " + bus + "  ID: " + id.toString(16) + "    Sv: " + service.toString(16));
}

function tick()
{
    can.sendFrame(0, 0x7E0, 8, [0x01, 0x05, 0, 0, 0, 0, 0, 0]); // 0x01 = Service Mode, 0x05 = Engine coolant temperature
    host.log("Sent!");
}

Is something wrong ? I tried 0x7DF and 0x7E0 for requests without success (no response at all, even from 0x7E8).
Maybe Subaru ECU is not at 0x7DF or 0x7E0. Any idea ?

Thanks !

You might try 0x3E which is TESTER_PRESENT to see if that wakes it up. The 3E would belong as the second data byte. Oh… you didn’t add the length byte first in your messages. That might help too. The first byte should be the message length (I know… you told it to send 8 data bytes you’d think that would mean 8 data bytes but the UDS/OBDII standards require another byte that specifies the actual length). So, you should have [2, 1, 5, 0, 0, 0, 0, 0] as your data bytes. That means that the command takes two bytes. The first one is the mode byte. 1 is read current. Then the second byte 5 is the PID and that means engine coolant temperature.

But, you could also try [1, 3E, 0, 0, 0, 0, 0, 0] periodically to keep the ECU listening.

:star_struck: Hooray! Another Subaru owner!!! I’m working on writing an iOS app to log data and receive push notifications when problems arise. I’m using the WiFi+BLE interface sold by Macchina. Would either of you be interested in contributing to the m2-ECU communication, as I write the m2-iOS portion?

Hi !

Thanks for your answer Collin.
I tried with can.sendFrame(0, 0x7DF, 8, [2, 1, 5, 0, 0, 0, 0, 0]) between two can.sendFrame(0, 0x7DF, 8, [1, 0x3E, 0, 0, 0, 0, 0, 0]) but no response.
I added uds.setFilter(0x700, 0x700, 0); and now I can see frames I send with function gotUDSMessage but nothing from 0x7E8.

@ MadArkitekt: maybe, but first I need to be able to communicate with my ECU (I don’t have any iOS device).

Hi!

Got some interesting news:
After trying and reading working code (https://github.com/togglebit/ArduinoDUE_OBD_FreeRunningCAN/blob/master/OBD2.cpp#L107), I found that using 0x55 after PID makes ECU (0x7DF) to respond with 0x7E8 and 0x7a5 (2 responses, maybe 2 ECUs?):

can.sendFrame(0, 0x7DF, 8, [2, 1, 0x05, 0x55, 0x55, 0x55, 0x55, 0x55]);

Sending requests to 0x7E0 was unsuccessful until the key was plugged and rotated (no ignition) then I got only one response from 0x7E8 as expected.

Then I tried the following request:

can.sendFrame(0, 0x7E0, 8, [2, 1, 0x05, 0, 0, 0, 0, 0]);

I got a response from 0x7E8.
I think 0x55 is a kind of broadcast that makes ECU to wake up and respond like 0x3E suggested by Collin.
My experimentation protocol isn’t clean so these are asumptions but it’s working. I need to dig more.

@MadArkitekt is your project open source ?