socketCAN firmware using TCP instead of serial

Has anyone forked the socketCan particle firmware to use TCP server/client instead of just serial?

I’m trying to use the can utils with my photon, but I don’t want to do it via serial port. I would prefer to do it via TCP socket. I say this because I only have a Mac and it seems the can-utils is not supported. Instead I’m doing my work on a linux server I have inside my house. I’ve got the socketCAN firmware updated to support TCP server client that I believe is working. Specifically, I have a 2nd firmware version that does not do socketCAN, but just a pure CAN implementation that is a one way device: it sends all CAN messages seen over the TCP connection to a listening client.

I believe my blocking issue is somewhere on the client side. socketCAN uses UNIX sockets, not TCP sockets. To fix this, I’m using “socat UNIX_LISTEN:/tmp/socket-can,fork TCP::” to create a local machine socket that is hooked to the TCP socket of the photon server. Running “nc -U /tmp/socket-can” shows me all the CAN traffic, so that works.

However, when I do “candump /tmp/socket-can” I get the message “SIOCGIFINDEX: No such device”. Hmm. Carloop socketCAN docs say for the serial method, one must run slcand to create the proper unix device, so I run “slcand -o -c -s 4 /tmp/socket-can can0” but I don’t think that worked because “ip addr” shows no can0 device. I’m not sure what’s wrong here.

My top level goal is to be able to run cansniffer to help me filter out a lot of noise on the CAN IHS bus so I can figure out what the unlock and lock codes are for my 2018 ram 2500. I’m also hoping the remote start/stop can be triggered over this bus with the right message.

I thought about forking the cansniffer code to add support for a TCP socket, but my C coding skills are quite old (damn you pointers) and I’m not sure I can hack it without getting lost in the code.

@hartmms,

It takes me a while to read messages since I have a new assignment at work, hopefully you are still working on this.

I know there are lots of examples of using TCP or even UDP for particle devices, see https://community.particle.io to read up on it.

On the computer side, this is not something I have ever tried. Can you run a virtual machine on your Mac so you could run the canutils on the virtual machine?

If you are looking for CANbus messages for Dodge vehicles, check out the postings here by @dubb45. He even posted a partial list for his 2015 car. The same codes seem to work for a bunch of different 2015 and 2016 Dodge products, so I would try them out on yours. His list worked for my 2015 RAM 1500. I doubt Dodge would change the codes as that would mean a lot of re-engineering.

He can also use a raspberry pi, then install canutils and on the carloop flash the socketcan sketch. Once you have that working you can then install a vnc viewer like “real vnc” and access your pi via the net. I use it like that on my bench setup with a 2016 Dodge Challenger body control module, PCM, shifter, instrument cluster all connected together. I can remotely login and develop code using a custom board I’ve developed and the Arduino IDE. Once I got what I’m looking for I then port over the code to the carloop and try it out. If you have a redbear duo you can install the Arduino IDE and also add support for the redbear duo and can flash locally, just have to add the carloop library and your good to go I’ve used it like that as well no problems. Even developed code remotly logining in using my iPad while on the road not too bad.
You can even take it a step further like I did and have the pi as a mobile car hacking station. If no known internet is available to connect the pi then broadcasts its own hotspot to connect either vnc or ssh (no internet while using the hotspot)

The ultimate goal is to have remote access to control the door locks and remote start. Sirius/UConnect is gonna charge me at least $260/year for this, but I figured paying only $3/month (for cell access on an electron) + my custom code would be better. Eventually I’d like to add a GPS so I can track where my truck is. Perhaps even some sort of location based code that detects when I’m about to pull up in my driveway and open my garage door for me (since I use home-assistant with my house).

Great idea about the raspberry pi and VNC! Not sure why I didn’t think about that. Sometimes I get stuck on a solution and try to brute force my way through without thinking of a better solution. I guess CAN over ethernet seemed more elegant to me at the time. I’m currently spending way too many hours trying to replicate the canutils “cansniffer” code with a pure Python implementation.

An even better solution would be raspberry pi + tmux + mosh. A pure text/terminal solution without all the X junk. Now I just have to find that raspberry pi 2 I have laying around somewhere.

@dubb45 do you have a full list of Dodge challenger codes you know about? I only saw one post by you where you document the steering wheel buttons and shifter data. I was curious if you found the lock/unlock codes.

I finally got my sniffer code working and I have found these out for my 2018 Ram 2500:

VIN: 3e0.
1st byte of data = index of VIN. Cycles through values of 02, 01, 00, with 00 being the start of the string of the VIN string.

clock: 38c.
bytes 4, 5 and 6 seems to be the 24 hour format of UTC hh:mm:ss, respectively.

I’m not sure, but I think 2fa is the door lock and unlock:
unlock: 2fa 00 01 00 1a 00 00 00 00 …
lock: 2fa 40 01 00 02 00 00 00 00 @…

radio volume: 30f.
1st byte is same integer as displayed on screen for volume level

radio mute: 2f3. 1st byte only.
08 = mute
00 = unmute.
also serves as bluetooth and android auto pause/play toggle.