Need help pulling CAN data

Discussion on the Lua Scripting capabilities for RaceCapture/Pro. Also see the <a href="http://autosportlabs.net/RaceCapturePro_Lua_Scripting">Lua Scripting Guide</a>

Moderators: JeffC, stieg

Post Reply
air1dpt
Posts: 12
Joined: Tue Jan 26, 2016 8:51 pm
Location: KY, USA

Need help pulling CAN data

Post by air1dpt »

I have been trying to collect CAN data on my MK2 for several months trying various techniques and hoping that each firmware update will yield new results but I keep striking out. I feel that I may be missing something fundamental since this doesn't appear to be a topic that others are addressing very often. My vehicle is a 2016 VW Golf R. The MK2 is mounted under the center console on top of driveshaft/exhaust tunnel (inside vehicle). Inputs to the MK2 are OBDII connector, bluetooth module, AFR analog and boost analog.
I have been through all the troubleshooting guides and tried everything i can find in the forums. I have tried CAN channels 1 and 2, baud rates from 50k to 1000k.
OBD data collection works fine. Although I have noticed that when switching back and forth between CAN and OBD, I always loose the OBD data feed (reflashing firmware will fix that issue). I use the car as a daily driver and occasional track use. There are other parameters I know are available on CAN such as steering wheel angle, engine oil temp, brake cylinder temp, egt, etc that I want to record. The only glimmer of data that I have seen is when I run the attached script at 500k baud on channel 1. I am including a pdf since I can't imbed pictures in the post :( I have also included data from the polling log. The values in the data do not change, however, they just keep scrolling by...
I am seriously considering getting a dedicated CANbus datalogger but that would be an admission of failure on my part to get the MK2/RCP working as designed with regards to CAN messages. If anyone has any ideas to get me off the sidelines, please chime in. Thanks,
Dan
Attachments
RCP CAN troubleshooting.pdf
(129.53 KiB) Downloaded 101 times

brentp
Site Admin
Posts: 6274
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Hi,

That OBDII data mode works is a good sign. It means RaceCapture can fundamentally communicate with your ECU.

if you want to do custom mapping based on streaming CAN data (non- OBDII), then you have to disable OBDII and then map custom channels using a lua script.

We have a guide here: https://wiki.autosportlabs.com/RCP_CAN

First step perhaps would be to disable OBDII, then try the simple CAN bus logger (linked in the wiki above) to see if any data is being broadcasted. if you see a bunch of messages coming through, then the next step is to map that data to virtual channels in Lua scripting.

Let's solve this step and then go from there. Also, moving this to the Lua scripting topic.

Thanks,
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

air1dpt
Posts: 12
Joined: Tue Jan 26, 2016 8:51 pm
Location: KY, USA

Post by air1dpt »

Update **
I have plenty of OBDII data so that is good. I ran the CAN logging script and at 500K with OBDII logging OFF, I get the following data when polling enabled:
[lua] Starting Lua Task
[lua] Loading script. Length: 429
Initializing CAN0 with baud rate 500000
CAN init success!
[lua] Successfully loaded script.
401604624.0, 32.0, 16.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
401604624.0, 32.0, 16.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
401604624.0, 32.0, 16.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
...
I tried both CAN0 and CAN1 and at all available baud rates (changing in script and on CAN page)
The data stream never changes from the above. I would expect to see numbers changing as the engine is running, things being switched on/off, rpm changes, etc.

I noticed that when switching OBDII off, turning CAN on, testing for CAN data and then turning CAN back off and OBDII back on, I no longer get any OBDII PIDs. I have to completely power down the MK2 for at least 20 seconds and then OBDII comes back. Do I need to power down the MK2 for 20 seconds and then back up when turning CAN on and testing?? Thoughts?
Dan

brentp
Site Admin
Posts: 6274
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Looks like RaceCapture is outputting what it sees on the CAN bus.

If you don't have the 2nd CAN channel connected, then there is no reason to switch the script to the 2nd CAN channel, so keep on CAN channel 0.

CAN should always be enabled regardless if you are using OBDII or the lua script mapping. It's like the 'main switch' for CAN bus to work - for either OBDII or custom mapping. When OBDII is enabled, it takes over the first CAN channel, so your script won't see any data until you disable OBDII and write that setting back to RCP. Enabling / disabling OBDII should be immediate, no power cycling required.

Regarding limited data coming off the CAN bus: I'm guessing a bit, but your ECU may need to be 'activated' to start streaming additional data, possibly by sending it a special CAN command message. I've heard talk about VAG COM adapters doing this; some research in VW groups may turn up some information. If this is the case, you can use RCP to send whatever magic commands the ECU may need to activate streaming of data.

Good luck, and let us know what you find out!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

Shiftlink
Posts: 29
Joined: Tue Aug 13, 2013 1:36 am
Location: EM96xa

Post by Shiftlink »

I think it's possible that you are only looking at the diagnostic CAN-Bus if you are plugged into the OBDII port. The MK7 VW has 7 CAN-Buses. I think you may have more success if you connect to the powertrain CAN-Bus directly. You will need to find the CAN Gateway module and connect to CAN hi and CAN lo for the powertrain bus. I believe you will find the gateway module on the driver's side footwell clipped onto the side of the HVAC enclosure. That would be above the TPS(gas pedal). You are looking for a small module about 4 inches square with orange twisted pair wires connected to it. I believe that Orange/Black and Orange/Brown are hi and lo for powertrain. and I think that Black is hi, but I don't remember exactly.
Here is a file on my google drive that might help explain the architecture of VW's latest CAN networks:
https://drive.google.com/file/d/0B-ddSM ... sp=sharing

I would be very interested in what you find, I hope you keep up the search.

Post Reply