MBE Canbus Setup

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
fitdes
Posts: 18
Joined: Tue Sep 01, 2015 5:03 pm

MBE Canbus Setup

Post by fitdes »

Hi all,

I've been setting up CAN logging on my RCP mk2 for my MBE 975 and I'm getting good success.

One thing I've noticed is that when I turn on the ECU without interfacing with the ECU software, CAN messages are not transmitted from the ECU. After I interface with the ECU software CAN messages are transmitted and continue to be transmitted even when I disconnect the ECU software interface until I power down the ECU.

Do I need to send a message to the ECU from RCP to initialize transmission from the ECU. I guess this is what the ECU software interface is doing.

What are your thoughts?

I will submit a script and write up on interfacing with the MBE ECU when I have completed the debugging

regards,

FitDes

CarpeForza
Posts: 5
Joined: Sat Jan 02, 2016 9:47 pm
Location: Detroit, MI

Post by CarpeForza »

Please update us on this forum. I will be going through the same setup on my MBE 992 (Radical SR3). If I figure anything out, I'll post it on here.
2004 Radical SR3

Ali
Posts: 2
Joined: Sun Mar 13, 2016 10:48 pm

Post by Ali »

Based on what Race Technology says, you need to activate the outbound information using the ECU software. https://www.race-technology.com/wiki/in ... lInterface

fitdes
Posts: 18
Joined: Tue Sep 01, 2015 5:03 pm

Post by fitdes »

The MBE interface to the ECU is Can based. It sends Can messages and the the ecu starts responding and sending out Can messages that Racecapture can then read. It continues even when the MBE interface is disconnected.

fitdes
Posts: 18
Joined: Tue Sep 01, 2015 5:03 pm

Further issues with number of channels

Post by fitdes »

Some progress being made but have run into an issue where the Canbus results flicker/jbberish when I configure MBE to output more than in CANID of data. My AIM dash noes not have this issue. Data coming off the bus looks like this.

814.0, 3.0, 129.0, 129.0, 200.0, 200.0, 10.0, 0.0, 30.0,
814.0, 2.0, 40.0, 0.0, 20.0, 255.0, 61.0, 0.0, 0.0,
814.0, 1.0, 97.0, 136.0, 2.0, 34.0, 24.0, 179.0, 81.0,

Also I did a log when I connect the ecu interface. Log below.

213782785.0, 3.0, 4.0, 0.0, 13.0, 247.0, 191.0, 255.0, 254.0,
213778705.0, 16.0, 13.0, 228.0, 0.0, 13.0, 35.0, 57.0, 55.0,
213778705.0, 33.0, 53.0, 103.0, 99.0, 57.0, 57.0, 48.0, 0.0,
814.0, 1.0, 109.0, 0.0, 0.0, 42.0, 48.0, 150.0, 84.0,
814.0, 4.0, 110.0, 78.0, 176.0, 101.0, 110.0, 5.0, 0.0,
814.0, 3.0, 129.0, 129.0, 158.0, 158.0, 18.0, 0.0, 115.0,
814.0, 2.0, 40.0, 0.0, 20.0, 255.0, 156.0, 0.0, 0.0,

Think the secret to initializing Can broadcast by the MBE ecu for both Racecapture and my AIM dash are in getting Racecapture to broadcast the messages for ID213782785
Attachments
MBECan.JPG
MBECan.JPG (50.31 KiB) Viewed 5287 times

fitdes
Posts: 18
Joined: Tue Sep 01, 2015 5:03 pm

MBE Canbus Gains and Offsets

Post by fitdes »

After a bit of searching through the Microsoft Access based database for AIM Mxl software I believe I've managed to isolate the gains and offsets required to convert the Canbus stream into something useable
Attachments
MBE Gains.JPG
MBE Gains.JPG (51.85 KiB) Viewed 5285 times

fitdes
Posts: 18
Joined: Tue Sep 01, 2015 5:03 pm

Post by fitdes »

Is the raw stream on Canbus from MBE different?

The address ID does not increment but the first bit becomes the offset.
How can I script to ensure Racecapture can read this properly

Address ID is in RED
Offset is in Blue

814.0, 3.0, 129.0, 129.0, 200.0, 200.0, 10.0, 0.0, 30.0,
814.0, 2.0, 40.0, 0.0, 20.0, 255.0, 61.0, 0.0, 0.0,
814.0, 1.0, 97.0, 136.0, 2.0, 34.0, 24.0, 179.0, 81.0,

fitdes
Posts: 18
Joined: Tue Sep 01, 2015 5:03 pm

Post by fitdes »

Had a chat with a friend in work who has said that MBE is using a multiplex. The first code after the address refers to the offset. Looks like I will have to set up an if statement to seperate the data

fitdes
Posts: 18
Joined: Tue Sep 01, 2015 5:03 pm

Mux Script

Post by fitdes »

Tried the script below to try deal with the Multiplex problem but with no luck. Any help would be gratefully accepted!

--This example configured for MBE 992CAN mapping
--how frequently we poll for CAN messages
tickRate = 30
--the CAN baud rate
CAN_baud = 500000
--CAN channel to listen on. 0=first CAN channel, 1=second
CAN_chan = 0

--add your virtual channels here
--format addChannel(<name>, <sample rate>, <precision>, <min>, <max>, [units])
muxId = addChannel("Mux", 10, 0, -30, 130, "C")
coolantId = addChannel("tCoolant", 10, 0, -30, 130, "C")
rpmId = addChannel("RPM", 10, 0, 0, 20000)
rpm2Id = addChannel("RPM2", 10, 0, 0, 20000)
tpsvId = addChannel("vTPS", 10, 2, 0, 5)
tpsId = addChannel("rTPS", 10, 2, 0, 16, "#")
batId = addChannel("vBatt", 10, 1, 0, 20, "#")
airtId = addChannel("tAir", 10, 0, -30, 130,"C")
gearId = addChannel("Gear", 10, 0, 0, 6,"#")
oilpId = addChannel("pOil", 10, 1, -30, 130,"C")
oiltId = addChannel("tOil", 10, 0, 0, 8,"bar")
ignId = addChannel("iOut", 10, 1, -20, 60,"deg")
injId = addChannel("zInjection", 10, 0, 0, 720,"deg")
lamId = addChannel("lMeasured", 10, 3, 0, 2,"#")
manId = addChannel("pManifold", 10, 1, 0, 300,"kPaA")
lamsId = addChannel("lSetpoint", 10, 3, 0, 2,"#")
lauId = addChannel("Launch", 10, 3, 0, 2,"#")

----------------------------------------
--customize here for CAN channel mapping
--format is:
--[CAN Id] = function(data) map_chan(<chan_id>, <data>, <CAN offset>, <CAN length>, <multiplier>, <adder>, [filter])
----------------------------------------
CAN_map = {
[814] = function(data)

if map_chan(muxId, data, 0, 1, 1, 0) == 1 then

map_chan(coolantId, data, 1, 1, 0.62745, -30)
map_chan(rpmId, data, 2, 2, 1, 0)
map_chan(tpsvId, data, 4, 1, 0.019608, 0)
map_chan(tpsId, data, 5, 1 , 1, 1)
map_chan(batId, data, 6, 1, 0.078, 0)
map_chan(airtId, data, 7, 1, 0.62745, -30)
elseif map_chan(muxId, data, 0, 1, 1, 0) == 2 then
map_chan(oilpId, data, 2, 1, 1, 0)
map_chan(oiltId, data, 3, 1, 0.62745, -30)
map_chan(mapsId, data, 4, 1, 1, 0)
end
end
}

function onTick()
processCAN(CAN_chan)
end
--===========do not edit below===========
function processCAN(chan)
local msg = 0
repeat
local id, e, data = rxCAN(chan, 0)
if id ~= nil then
local map = CAN_map[id]
if map ~= nil then
map(data)
end
end
msg = msg + 1
until id == nil or msg > 100
end


--Map CAN channel, little endian format
function map_chan(cid, data, offset, len, mult, add, filter)
if offset + len > #data then return end
offset = offset + 1
local value = 0
local shift = 1
while len > 0 do
value = value + (data[offset] * shift)
shift = shift * 256
offset = offset + 1
len = len - 1
end
local cv = value * mult + add
if filter ~= nil then cv = filter(cv) end
setChannel(cid, cv)
end
initCAN(CAN_chan, CAN_baud)
setTickRate(tickRate)

fitdes
Posts: 18
Joined: Tue Sep 01, 2015 5:03 pm

Post by fitdes »

Thought this might work. Still no luck. No idea now

processCAN(chan)
local msg = 0
repeat
local id, e, data = rxCAN(chan, 0)
if data[0] == 1 then
if id ~= nil then
local map = CAN_map1[id]
if map ~= nil then
map(data)
end
end
end
if data[0] == 2 then
if id ~= nil then
local map = CAN_map2[id]
if map ~= nil then
map(data)
end
end
end

msg = msg + 1
until id == nil or msg > 100
end

CarpeForza
Posts: 5
Joined: Sat Jan 02, 2016 9:47 pm
Location: Detroit, MI

Latest update on my MBE 992

Post by CarpeForza »

I have been going through this for the last week and I think I'm getting close. I'm not sure if my car setup makes any difference, but the 992 ECU has a 998 ECU piggybacked for gearchange and wheelspeed, and I also have the 995 mini-dash that works off the CAN BUS.
The steps are similar to yours above:
1) Setup the MBE 992 Output for data collections with Easimap 6, using the documentation from AIM sports
2) Use the RCP Mk2 as a CAN Sniffer to see any CAN messages
3) With my setup, the 995 mini-dash uses the CAN BUS to cycle through 7 different screens: Gear, Oil Temp, Oil Press, Fuel Press, RPM, Water Temp, and Battery Voltage. When I run the CAN sniffer, I happen to also get 7 different CAN ID's. The values run from 0 to 66,600. At this point, I can't figure out which is which.
4) Tonight, I'll run my engine a while and go through a cycle while logging the data. Hopefully the data will make sense on which CAN ID equals which parameter I see on the dash. Then it's a matter of using the gain and offset to get something that makes sense.
2004 Radical SR3

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

Post by brentp »

So, is the multiplex ID a form of a "sub ID" that is paired up with the main CAN ID?
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

fitdes
Posts: 18
Joined: Tue Sep 01, 2015 5:03 pm

Post by fitdes »

Yes, effectively the ID is generated by the first address "814.0" and the offset being the second entry "1". The ecu output will then cycle through up to 8 different rows of information on the 1 CAN address with a total of up to 56 channels of data.

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

Post by brentp »

Understood. In that case you would need to customize the script to switch the mapping between sub IDs for a given CAN ID - so altering the logic in our existing script template. It is definitely possible with the right amount of work!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

Post Reply