987.1 Can Bus Mapping

Discussions on CAN mapping for ECUs, sensors, PDMs, and more.
MikeD
Posts: 39
Joined: Sun May 29, 2016 11:55 am
Location: Austria
Contact:

Post by MikeD »

Hey Boggie1688,
why do you have TPS specified with "Length 2" within the CAN mapping when you are just talking about a single byte?

Your actual scaling of 1/255+0 probably only generates numbers from 0-255 because you specified a 2 byte message, and therefore the byte you are actually looking for gets multiplied by 255 in the background because it's handled as the high byte of a 2 byte message.

If you are just looking for a single byte (byte 5 from your notes above) then this should come up with 0-255 naturally without scaling.
I think you need to set the length to 1 and then use the scaling raw/255*100+0 as Brent mentioned already.

boggie1688
Posts: 138
Joined: Fri Apr 07, 2017 3:47 pm
Location: Oakland, CA

Post by boggie1688 »

MikeD wrote:Hey Boggie1688,
why do you have TPS specified with "Length 2" within the CAN mapping when you are just talking about a single byte?

Your actual scaling of 1/255+0 probably only generates numbers from 0-255 because you specified a 2 byte message, and therefore the byte you are actually looking for gets multiplied by 255 in the background because it's handled as the high byte of a 2 byte message.

If you are just looking for a single byte (byte 5 from your notes above) then this should come up with 0-255 naturally without scaling.
I think you need to set the length to 1 and then use the scaling raw/255*100+0 as Brent mentioned already.
....
:oops:
You sir deserve a beer.

Doubly excited to get home today.

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

Post by brentp »

Good catch Mike!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

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

Post by brentp »

I re-tested adding a CAN channel, and I was able to verify that I *did not* need to power cycle RCP after adding a CAN mapping.

First, on a 2nd RCP connected to the primary I created a script that broadcasted some values on CAN ID 1234:

Code: Select all

foo1 = 0
foo2 = 0
setTickRate(10)
function onTick()
foo1= foo1 + 1
foo2 = foo2 + 2

txCAN(0, 1234, 0, {foo1, foo2})
end
Then created a mapping on the primary unit that extracted both values from that CAN message into two different telemetry channels. I was able to add the 2nd channel (FOO2) without having to power cycle the unit.

If you're still not seeing the correct behavior then let me know and we can dig deeper.

Thanks!
Attachments
foo_can_mapping.png
foo_can_mapping.png (69.62 KiB) Viewed 31713 times

boggie1688
Posts: 138
Joined: Fri Apr 07, 2017 3:47 pm
Location: Oakland, CA

Post by boggie1688 »

Hey Fellas! :D

Good news on multiple avenues:

Brent the dashboard issue may have been related to the "?", I was using to denote my suspicions. I removed all of the "?" and used the precanned channels provided, and everything seems to be working swimmingly.

MikeD, thank you much for the 1 byte catch. Because of that, I was able to map throttle (TPS?), rpm, and engine coolant.


Observation:

I use a small 11 inch laptop last night and was having an issue scrolling across the can mapping window. After I clicked to add a map, I couldn't get to the unit conversion section. I tried swiping the touchpad to scroll side to side while mousing over the bar, but it didn't move. I was previously using my android phone, and 13 inch laptop. On the android I was able to scroll, and on the 13 inch, I think the unit conversion label was just within reach.


WIP Update:

Engine oil temp appears to be none linear. The multiplier seems to change as the decimal value goes up. Unfortunately, I was gathering data points with the car in accessory mode, and the engine cooling down. Getting each decimal value, and correlating it to a temp(C) was taking forever. I'll try again tonight, and start gathering data as the car warms up.

With most of the stuff I really wanted map done, I'll move on to mounting the RCP3 and finalizing the wiring. After that, I'll take my time mapping the rest of what is available via durametric. With the autoX season in full swing, I'm not keen on putting myself in a position where the car could miss a event. I'll probably save the oil pressure and brake pressure sender projects for later this year.

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

Post by brentp »

This is a great start and example for others to follow on how to custom-map a new system. Thank you!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

boggie1688
Posts: 138
Joined: Fri Apr 07, 2017 3:47 pm
Location: Oakland, CA

Post by boggie1688 »

A little more playing around tonight, is it wrong that this is a bit addicting? :D

Steering 70~90 Degrees
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Steering ~900 Degrees
https://docs.google.com/spreadsheets/d/ ... sp=sharing

I think Offset 0-3 have something to do with steering angle. The interesting part is that offset 1 seems to be the slowest changing and not offset 0. If I focus strictly on offset 1, it doesn't fully hit 255 or 0 at the 900 or 0 degree angle. The delta from 450 to 900, is ~42-43 and the delta from 450 to 0 is ~41. (I think I should have turn the wheel a little slower to get more resolution)

Is it wrong to assume that Offset 1 = hundreds place, Offset 2 = tens place, and Offset 3 = ones place?

It would be nice if 450 - 900 produced a delta of 45 and 0 - 450 produced a delta of 45. It seems entirely possible. I assumed the wheel had 900 degrees of rotation, and I have a suspicion is it slightly less. I need to do more research on the actual steering ratio of the car, assuming the wheel is completely centered.

I guess the test would be to create a mapping for just Offset 1 Length 1, scale it and see it it roughly makes sense from a hundreds of a degree rotation perspective?

What do you guys think?

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

Post by brentp »

You have the right idea, but you're dealing with base 16 data, not base 10.

The E46 uses a sign - magnitude approach where the angle is the absolute value, and the highest bit indicates the sign - meaning, left or right off center. Your Porsche might be similar.

Try centering the wheel and moving it 5-10 degrees off center to see if the data looks similar if it's 10 degrees to the left, or 10 degrees to the right.
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

boggie1688
Posts: 138
Joined: Fri Apr 07, 2017 3:47 pm
Location: Oakland, CA

Post by boggie1688 »

Quick reply, thanks.

I've been using the E46 script as a rough guide. I assume you are referring to this function:
function processSteering(data)
local steer = 0
if data[2] > 127 then
steer = -1*(((data[2]-128)*256)+data[1])
else
steer = (data[2]*256)+data[1]
end
setChannel(steerId, (steer*0.045))
end

I assume data[2] is left or right, and data[1] is the decimal angle. True angle is data[1]*.045. What is the 256?

I'll log as you suggest tomorrow.

Thanks Brent.

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

Post by brentp »

The * 256 shifts that byte 16 bits to the left, so it can create a 16 bit message.

E46 uses sign-magnitude. if the Porsche does the same, the scheme would be like this:
https://chortle.ccsu.edu/AssemblyTutori ... 08_12.html
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

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

Post by brentp »

Hi boggie1688,

Do you know what range of years and model Porsche supported this CAN bus data? In particular, would the 2002 Porsche 986 S support this as well?
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

boggie1688
Posts: 138
Joined: Fri Apr 07, 2017 3:47 pm
Location: Oakland, CA

Post by boggie1688 »

Hey Brent,

I don't think the 986 cars support CAN.

http://www.aim-sportline.com/eng/downlo ... tm#porsche

It looks like CAN didn't appear in the Porsches until the 996.2. I know the 997 and 987 all share the same ECU, and engine swaps can be done with relative ease. The engine is just rotate 180degrees.

In any case this doc outlines finding the CAN wires in a 996.2. Should be easy enough to check on a 986 if someone was serious about getting a hard Yes or No.

http://www.aim-sportline.com/download/e ... 02_eng.pdf



I'll try to get some time to play with the steering wheel today. I got side track mounting the RCP3, then peeking around looking for good ways to add a brake pressure and oil pressure sender. :D

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

Post by brentp »

Thanks for the help, that's great information. Other customers are interested as well!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

boggie1688
Posts: 138
Joined: Fri Apr 07, 2017 3:47 pm
Location: Oakland, CA

Post by boggie1688 »

Is there anywhere to put this info in the wiki?

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

Post by brentp »

We can, but we have one better: In an upcoming app version we'll be able to add it to a list of preset CAN configurations, very similar to this video previewing the CAN mapping capabilities.

https://www.youtube.com/watch?v=zc1Bi__ ... u.be&t=105
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

Post Reply