SavvyCAN Man In The Middle

I’ve put my M2 in between my gauge cluster and the car. I have CAN0 hooked up to the car and CAN1 hooked up to the gauge cluster.

I’m trying to use SavvyCAN and I need to pass all the data from CAN0 to CAN1 and vice versa.

Starting with this script:

What do I need to change to send the captured frames to the other bus?

I was able to do this with the M2 directly, but I can’t monitor the traffic in real time using an Arduino sketch. SavvyCAN gives me a lot more logging options, but the gauge cluster doesn’t work if I can’t pass frames to it.

Any help would be appreciated, thanks.

Until Collin chimes in, look at his Due_Can code and see if there is a bridge mode. You will likely have to jump into the console and turn this on and then be good to go. I have considered building something like this myself but seems like Collin already has this in the code?

Check into CANCAT software as well. I know the guys that wrote CANCAT and although I have yet to use it myself I am told they prompted Macchina to build the M2 so there may be a method to do this through their software.

1 Like

Collin helped me with Due_CAN by fixing his example code:

I want to use this for the final code and leave the M2 in the car.

Right now, I’m still having trouble finding the right frame to change and SavvyCAN is a much better analysis tool. But if I can’t bridge the two buses together, the gauge cluster doesn’t work and I don’t know what is changing.

So being able to watch traffic and bridge the two buses in SavvyCAN would be ideal right now.

Thank you for recommending CANCAT. It does have this function built in so it seems worth a try. The GUI of SavvyCAN is a lot nicer to work with though.

Yeah, I suppose you could do what you want with scripting.

function setup ()
{
    host.log("Passthrough script");
    can.setFilter(0x100, 0x700, 0);
}

function gotCANFrame (bus, id, len, data)
{
    if (bus == 0) can.sendFrame(1, id, len, data);
    if (bus == 1) can.sendFrame(0, id, len, data);
}

You can see that a filter was setup so that potentially not all traffic gets accepted by this script. You can open it up if you need. But, when it gets a frame it checks which bus the frame came in on and reverses that to send it out the other one. You can edit the bus numbers here to match your situation. The first parameter to sendFrame is the bus, second parameter the frame id, third parameter the data length, then lastly the data in an array.

1 Like