Current version of the OpenAuto Pro is 7.0
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to build a canbus application
#11
hey @rhys_m, have a question. Any tips on how I can probe for canbus messages on button presses if cansniffer isn't picking them up? I have a mazda, and I'm on the ms_can network. When I run cansniffer, I can certainly see information coming through, but when I do button presses, cansniffer isn't picking them up at all.

What I'm wondering is that maybe in some systems, you need to send some sort of request message before buttons are then read? I know for a fact my buttons can be mapped via canbus, because I previously had an android head unit that had a canbus "black box" that tapped into the ms_can network and could pick up all of my steering wheel controls as key presses over can, as well as reverse signal, etc.

Just wondering what I can try if cansniffer isn't getting the job done.

Thanks again!
Reply
#12
(02-27-2020, 11:19 PM)Hisma Wrote: hey @rhys_m, have a question.  Any tips on how I can probe for canbus messages on button presses if cansniffer isn't picking them up?  I have a mazda, and I'm on the ms_can network.  When I run cansniffer, I can certainly see information coming through, but when I do button presses, cansniffer isn't picking them up at all. 

What I'm wondering is that maybe in some systems, you need to send some sort of request message before buttons are then read?  I know for a fact my buttons can be mapped via canbus, because I previously had an android head unit that had a canbus "black box" that tapped into the ms_can network and could pick up all of my steering wheel controls as key presses over can, as well as reverse signal, etc. 

Just wondering what I can try if cansniffer isn't getting the job done. 

Thanks again!

Hi Hisma,

I would be very suprised if the buttons wern't on the can network (thats if you have checked the drawings, and it definately doesnt show the button as being hard wired etc)

I do have a utility that you can use for this, I use it when theres just too much traffic to see whats happening. the tool has no documentation and is just something that I hacked up together, but may be worth a go for you.

First make sure you have nodeJS installed (I use version 12)
If you dont have installed do the following


Code:
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt install -y nodejs

Clone this repo

Code:
git clone https://github.com/rhysmorgan134/can-utils


Cd in the can-utils directory, then run 

Code:
npm install

Once installed you can run the utility by running 

PHP Code:
node can.js 

What this does is it begins listening to all the messages, and all the byte, it logs them all. It gives a readout of how many new bytes its seeing that it hasnt seen before. Once this value gets low (on my jag it goes down to about 5) then press enter, then quickly press your cars button, then press control-C.

It then outputs a json file with the timestamp in the name. In this file it then shows any new bytes inbetween you pressing enter and control-C. Now there will be some other data in there, such as heartbeats, and the time being transmitted on can. But if you do it a couple of times you should see the button being present in every file.

Let me know how you get on with it, if its usefull I will put some more time into the repo and get some documentation/perhaps a GUI
Full jaguar canbus integration project
https://www.youtube.com/channel/UC69PLXX...XQXY63ff_w

project blog/tutorials/software
https://moderndaymods.com
Reply
#13
(02-28-2020, 09:28 AM)Rhys_m Wrote:
(02-27-2020, 11:19 PM)Hisma Wrote: hey @rhys_m, have a question.  Any tips on how I can probe for canbus messages on button presses if cansniffer isn't picking them up?  I have a mazda, and I'm on the ms_can network.  When I run cansniffer, I can certainly see information coming through, but when I do button presses, cansniffer isn't picking them up at all. 

What I'm wondering is that maybe in some systems, you need to send some sort of request message before buttons are then read?  I know for a fact my buttons can be mapped via canbus, because I previously had an android head unit that had a canbus "black box" that tapped into the ms_can network and could pick up all of my steering wheel controls as key presses over can, as well as reverse signal, etc. 

Just wondering what I can try if cansniffer isn't getting the job done. 

Thanks again!

Hi Hisma,

I would be very suprised if the buttons wern't on the can network (thats if you have checked the drawings, and it definately doesnt show the button as being hard wired etc)

I do have a utility that you can use for this, I use it when theres just too much traffic to see whats happening. the tool has no documentation and is just something that I hacked up together, but may be worth a go for you.

First make sure you have nodeJS installed (I use version 12)
If you dont have installed do the following


Code:
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt install -y nodejs

Clone this repo

Code:
git clone [url=https://github.com/rhysmorgan134/can-utils]https://github.com/rhysmorgan134/can-utils[/url]
[url=https://github.com/rhysmorgan134/can-utils][/url]

Cd in the can-utils directory, then run 

Code:
npm install

Once installed you can run the utility by running 

PHP Code:
node can.js 

What this does is it begins listening to all the messages, and all the byte, it logs them all. It gives a readout of how many new bytes its seeing that it hasnt seen before. Once this value gets low (on my jag it goes down to about 5) then press enter, then quickly press your cars button, then press control-C.

It then outputs a json file with the timestamp in the name. In this file it then shows any new bytes inbetween you pressing enter and control-C. Now there will be some other data in there, such as heartbeats, and the time being transmitted on can. But if you do it a couple of times you should see the button being present in every file.

Let me know how you get on with it, if its usefull I will put some more time into the repo and get some documentation/perhaps a GUI


excellent!  I will try this out this weekend.  I am certain the buttons are on the ms_can network.  I just don't understand why cansniffer can't detect them.  I'll let you know how it goes.
Reply
#14
Yeah hopefully they are. Just remember (this is shown in some of the tutorial vids) that you are most likely looking for just a single bit of a byte to change, so can be very easy to miss!

You may know already but when you do:

Cansniffer can0

There are two useful arguments you can add on the end:

-b this shows it in binary format
-c this makes the byte/bit that changes also show in a red colour
Full jaguar canbus integration project
https://www.youtube.com/channel/UC69PLXX...XQXY63ff_w

project blog/tutorials/software
https://moderndaymods.com
Reply
#15
So looks like I need to look at alternatives on bringing in button presses via canbus.  Unfortunately, I couldn't get your script to install ryhs.  When I ran the "npm install" command, the installation failed.  I spent a few minutes trying to troubleshoot, but eventually gave up as I am pretty certain the issue is not too much traffic.  I think the buttons really aren't on the canbus network, at least with the wiring set up the way it is currently.
I do know there is some way to get the buttons over canbus somehow, but I'm going to have to dig further into my wiring diagrams.  The buttons are definitely hardwired. 

[Image: NPN5N7D.png]

And I can confirm that tapping into the resistor ladder wires does work.  But the odd part is that again, I had an android head unit that managed to get the button presses over canbus somehow.  All I know is that just tapping into the ms_can network alone is not sufficient.  I can see there's this "clock spring" that ties into the instrument cluster, so my thought is maybe that clock spring has a way of converting the hardware button inputs into canbus messages.  Need to dig deeper.

I was able to successfully probe for other information using cansniffer, which is at least somewhat of a win.  For instance, it was really easy to find the reverse signal over canbus.  I already tap the reverse signal via hardwire so it's not so useful to me though.  

At this point I guess I'll go back to the drawing board.  I seem to manage to use the system just fine w/o the SWC.  It's more academic at this point.  But my motivation to put this much effort into something I don't really need (and can easily re-do using an arduino for the hardwire control), I'm probably going to shelve this.  I might re-look at canbus if OAP ever ends up adding an OBD interface, which seems to be in the works.

Thanks for the tutorials though, I know way more about canbus now than I did before!
Reply
#16
(03-05-2020, 06:12 PM)Hisma Wrote: So looks like I need to look at alternatives on bringing in button presses via canbus.  Unfortunately, I couldn't get your script to install ryhs.  When I ran the "npm install" command, the installation failed.  I spent a few minutes trying to troubleshoot, but eventually gave up as I am pretty certain the issue is not too much traffic.  I think the buttons really aren't on the canbus network, at least with the wiring set up the way it is currently.
I do know there is some way to get the buttons over canbus somehow, but I'm going to have to dig further into my wiring diagrams.  The buttons are definitely hardwired. 

[Image: NPN5N7D.png]

And I can confirm that tapping into the resistor ladder wires does work.  But the odd part is that again, I had an android head unit that managed to get the button presses over canbus somehow.  All I know is that just tapping into the ms_can network alone is not sufficient.  I can see there's this "clock spring" that ties into the instrument cluster, so my thought is maybe that clock spring has a way of converting the hardware button inputs into canbus messages.  Need to dig deeper.

I was able to successfully probe for other information using cansniffer, which is at least somewhat of a win.  For instance, it was really easy to find the reverse signal over canbus.  I already tap the reverse signal via hardwire so it's not so useful to me though.  

At this point I guess I'll go back to the drawing board.  I seem to manage to use the system just fine w/o the SWC.  It's more academic at this point.  But my motivation to put this much effort into something I don't really need (and can easily re-do using an arduino for the hardwire control), I'm probably going to shelve this.  I might re-look at canbus if OAP ever ends up adding an OBD interface, which seems to be in the works.

Thanks for the tutorials though, I know way more about canbus now than I did before!


Sorry for the late reply, started a new job so been hectic!

are the media buttons the ones you are trying to get? if so then looking at that wiring diagram, these only go into the headunit. This is the same as my jag, and would explain how the android headunit was able to pick up on these, as the connector would of plugged straight into the headunit?

For mine, I have gone the arduino route for the steering wheel controls. This works pretty well, but I added an extra trick, the old physical control panel also had the same buttons on it as the SWC, so using the canbus I relay the original messages over canbus from the SWC (obviously the car no longer has access to the SWCs, so this allows skip, vol up etc etc to still function from the steering wheel, however its now by emulating the control panels buttons)
Full jaguar canbus integration project
https://www.youtube.com/channel/UC69PLXX...XQXY63ff_w

project blog/tutorials/software
https://moderndaymods.com
Reply
#17
hi your buttons are resitor based
and this special canbox can handle this
this also the reason why you can remap allmost the buttons on an android device
it reads the the residance and map remote app from android maps the function

but there is also some solution for steering whellbuttons wich work with resistor

so arduino reads residance and send a keypress like an usb hid keyboard

i used this long time before with other systems

[video=dailymotion] https://www.youtube.com/watch?v=Caf-yBI9rHA[/video]

Rhys_m this maybe also interessted for you...cuz you drive a jag also
Reply
#18
Yeah iv got mine all set up now pretty much exactly as in his vid. Top video!
Full jaguar canbus integration project
https://www.youtube.com/channel/UC69PLXX...XQXY63ff_w

project blog/tutorials/software
https://moderndaymods.com
Reply
#19
Rhys_m yes i remember we talk about that i have swc on can and you not....i show you videos like this before...
but its a very simple and a very nice solution...

you remember i ask you how i can invert the gauges for nodeapp...i didnt figure out rigth now gggg

and also i want to show single symbols ... like dpf is regenerating....on website...
also i try 112432353 solutions for a close button to run the app in fullscreen but nothing works.....maybe i am to stupid for this hahahaha
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)