Link G4+

Discussions on CAN mapping for ECUs, sensors, PDMs, and more.
iecku
Posts: 5
Joined: Sun Sep 03, 2017 1:50 pm
Location: Hamburg/Germany

Link G4+

Post by iecku »

Hey

I got problems with connecting the racecapture to the link g4+. I set it up as the verified guide for the link g4 ecu. I think there are some settings missing, which you need to do on the side of the link ecu. The bus itself seems to work fine, as i am getting no errors on the used Can 1 to where the RC is connected.

Regards Heiko

https://wiki.autosportlabs.com/Link_G4
Attachments
settings link.jpg
settings link.jpg (216.09 KiB) Viewed 36891 times
Last edited by iecku on Sun Sep 03, 2017 5:08 pm, edited 1 time in total.

iecku
Posts: 5
Joined: Sun Sep 03, 2017 1:50 pm
Location: Hamburg/Germany

Post by iecku »

Can bus runtime values Link Ecu
Attachments
settings link-.jpg
settings link-.jpg (242.05 KiB) Viewed 36891 times

MikeD
Posts: 39
Joined: Sun May 29, 2016 11:55 am
Location: Austria
Contact:

Post by MikeD »

Heiko,
I think you need to define a CAN ID which matches the RaceCapture CAN script... LINK use CAN ID 1000 as their base ID very often (at least it's mentioned in their help file). From the screenshot it looks as if you have defined CAN ID 1 in your config...

The RaceCapture example script you mentioned above has CAN ID 1200 (decimal) set as the base ID. So you may either choose CAN ID 1200 in your LINK CAN configuration page or change the RaceCapture script to match the CAN ID you prefer to use with both LINK and RaceCapture.

As a side note I observed that the RaceCapture example script doesn't has MGP (boost pressure) defined but LINK is transmitting this data too as well as a few more... you may like to add these parameters within the script or even choose a custom CAN message and output whatever else data to be received by the RaceCapture device.

In case you need additional support I would probably be able to guide you through the setup using german language communication as I'm a RaceCapture dealer in the german speaking region of Europe...

Please come back with your findings!

Good luck!
Mike

iecku
Posts: 5
Joined: Sun Sep 03, 2017 1:50 pm
Location: Hamburg/Germany

Post by iecku »

Thanks a lot @MikeD! You gave me the missing input! :-)

Attached you´ll find the correct Link ecu can settings.

I also corrected the the lua scripting:

--This example configured for Link G4+ ECU

--how frequently we poll for CAN messages
tickRate = 30
--the CAN baud rate
CAN_baud = 1000000
--CAN channel to listen on. 0=first CAN channel, 1=second
CAN_chan = 0
--1 for Big Endian (MSB) mode; 0 for Little Endian mode (LSB)
be_mode = 1

--add your virtual channels here
--params: <channel name>,<sample rate>, <logging precision>, <min value>, <max value>, <units label>
rpmId = addChannel("RPM", 10, 0, 0, 10000)
mgpId = addChannel("Boost", 10, 0, -100, 200, "kPa")
tempId = addChannel("ECT", 1, 0, 0, 150, "C")
iatId = addChannel("IAT", 10, 0, -20, 90, "C")
oilTempId = addChannel("OilT", 1, 0, 0, 150, "C")
tpsId = addChannel("TPS", 10, 0, 0, 100, "%")
ignAdvId = addChannel("IgnT", 10, 0, -100, 100, "Deg")
wheelSpdId = addChannel("NDWSpd", 10, 0, 0, 300, "kph")
oilPressId = addChannel("OilP", 10, 0, 0, 600, "kPa")
fuelPressId = addChannel("FuelP", 10, 0, 0, 600, "kPa")
lambda1 = addChannel("Lambda1", 10, 1, 7.5, 17.5, "AFR")
lambda2 = addChannel("Lambda2", 10, 1, 7.5, 17.5, "AFR")
steerId = addChannel("Steering", 10, 0, -360, 360)
baroId = addChannel("Baro", 1, 0, 50, 150, "kPa")
gearId = addChannel("Gear", 5, 0, 0, 5, "")
knockId = addChannel("Knock", 10, 0, 0, 1000, "")

----------------------------------------
--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 = {
[1200] = function(data) map_chan(rpmId, data, 0, 2, 1, 0)
map_chan(mgpId, data, 2, 2, 1, -100)
map_chan(tempId, data, 4, 1, 1, -50)
map_chan(iatId, data, 5, 1, 1, -50)
map_chan(oilTempId, data, 7, 1, 1, -50) end,
[1201] = function(data) map_chan(tpsId, data, 0, 2, 0.1, 0)
map_chan(ignAdvId, data, 2, 2, 0.1, -100)
map_chan(wheelSpdId, data, 4, 1, 0.1, 0)
map_chan(oilPressId, data, 5, 1, 10, 0)
map_chan(fuelPressId, data, 6, 1, 10, 0) end,
[1202] = function(data) map_chan(lambda1, data, 0, 2, 0.0147, 0)
map_chan(lambda2, data, 2, 2, 0.0147, 0)
map_chan(steerId, data, 4, 2, 0.1, -3000)
map_chan(baroId, data, 6, 2, 0.1, 0) end,
[1203] = function(data) map_chan(gearId, data, 0, 1, 1, 0)
map_chan(knockId, data, 6, 2, 5, 0) end
}

function onTick()
processCAN(CAN_chan)
end

--===========do not edit below===========
function processCAN(chan)
repeat
local id, e, data = rxCAN(chan)
if id ~= nil then
local map = CAN_map[id]
if map ~= nil then
map(data)
end
end
until id == nil
end

--Map CAN channel, little endian format
function map_chan_le(cid, data, offset, len, mult, add, filter)
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

--Map CAN channel, big endian format
function map_chan_be(cid, data, offset, len, mult, add, filter)
offset = offset + 1
local value = 0
while len > 0 do
value = (value * 256) + data[offset]
offset = offset + 1
len = len - 1
end
local cv = value * mult + add
if filter ~= nil then cv = filter(cv) end
setChannel(cid, cv)
end

map_chan = (be_mode == 1) and map_chan_be or map_chan_le
initCAN(CAN_chan, CAN_baud)
setTickRate(tickRate)
Attachments
1.jpg
1.jpg (225.01 KiB) Viewed 36879 times

iecku
Posts: 5
Joined: Sun Sep 03, 2017 1:50 pm
Location: Hamburg/Germany

Post by iecku »

Also checked the scaling of the gauges!
Attachments
2.jpg
2.jpg (106.2 KiB) Viewed 36878 times

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

Post by brentp »

Thanks Mike! lecku, glad you got it figured out, this is valuable!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

KDJones2000
Posts: 11
Joined: Mon Jan 23, 2023 4:36 am

Re: Link G4+

Post by KDJones2000 »

This link has been HUGELY helpful for us setting up an E36 with the Link G4+ and a RCPro mk3.

We made a custom cable, and with the Link and Lua settings above, have been able to get them to talk to each other.

However, when looking at our dash or raw data, the CAN bus data is showing for an instant, but then is replaced by 0's. It continues to flash data/0's. Brent, can you suggest ways to get the 0's removed from the stream? Do I increase the tick rate to something higher than 30ms?

Other analog and digital inputs are working great.

We are also having major issues trying to connect the suggested Tablet (Nvidia Shield) to this unit: Bluetooth pairs, but then gives an error something like "Unable to configure communication". Wifi for some reason keeps saying "Connecting..." when connected either directly to the RCP network, or if I connect both units to a hotspot. USB cable to a computer works fine. Again, any suggestions?

We are 95% of the way there, but need some help getting to 100%.

Cheers, Keith

KDJones2000
Posts: 11
Joined: Mon Jan 23, 2023 4:36 am

Re: Link G4+

Post by KDJones2000 »

Bueller? Anyone seen Bueller?

KDJones2000
Posts: 11
Joined: Mon Jan 23, 2023 4:36 am

Re: Link G4+

Post by KDJones2000 »

Well I guess we can declare these forums officially dead...

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

Re: Link G4+

Post by brentp »

KDJones2000 wrote: Sat Feb 04, 2023 9:25 pm Well I guess we can declare these forums officially dead...
That's funny! Our forums don't have a good way of notifying on new posts, like FB and Discord have, and I don't always get to checking for posts. We could do a better job, for sure!

The answer to your question is you probably have a channel defined elsewhere in the system with the same name, and the two channels are stepping on each other.
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

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

Re: Link G4+

Post by brentp »

However, you should be using the Link direct CAN preset we have in the system, instead of the Lua script - it works much better and has faster response.
https://wiki.autosportlabs.com/CAN_Bus_Integration

Note that this post was from 2017, before we had the direct CAN integration available.
Attachments
link_ecu_preset.jpg
link_ecu_preset.jpg (52.25 KiB) Viewed 35688 times

KDJones2000
Posts: 11
Joined: Mon Jan 23, 2023 4:36 am

Re: Link G4+

Post by KDJones2000 »

Nice to see someone getting to things on the forum, even if it's a "bit" late.

I tried that initially, and got nothing going through.

The Link G4 we have is not that version - it's the one dedicated to the E36.

The offsets I believe are different, and the only way we get anything on the display is to use the Lua script above. I was reading elsewhere that you suggested to try 25Hz instead of the 10Hz. I am going to be at the car this weekend to try that.

The connectivity to BT and Wifi has me stumped however. I am going to do a factory reset and reload my set up and see if that fixes things or not.

Cheers, Keith

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

Re: Link G4+

Post by brentp »

Hi Keith,

The presets are just a convenient way to load channels into the CAN mapping feature; each individual channel is otherwise fully editable. The mapping system is documented here: https://wiki.autosportlabs.com/CAN_Bus_Integration

In addition to system presets, you can also save your own custom presets.

With their CAN protocol in one hand, and our current mapping in the other hand, you might be able to just adjust the CAN IDs, if the channels are otherwise configured the same.

Feel free to link their documentation here and we can take a look. Thanks!

KDJones2000
Posts: 11
Joined: Mon Jan 23, 2023 4:36 am

Re: Link G4+

Post by KDJones2000 »

As a "final" footnote to this issue, I finally had some quality time with the car this weekend, and we got everything working properly.

1) CAN bus mapping: We just used the LUA script as above, with the offsets listed. The flashing numbers were solved by changing the data rate in the script from 10Hz to 25Hz. The channels that we are not using were changed to 1Hz.

2) Connectivity to the Hot Spot/Podium and ability to connect the Android display to the Race Capture MK3 unit was solved through a factory reset and reloading of the configuration.

Life is good at this point, although we need to test this whole thing out on a track to see how it works. We can still see a couple tenths of lag between the car and the display, but I think that this is expected given the wireless connections through the hot spot.

Next plans are to try to find a Raspberry PI4/Display to improve the response, if they ever get back in stock...

Cheers, Keith

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

Re: Link G4+

Post by brentp »

Hi Keith, are you still using the Lua script for mapping? Does the built-in CAN mapping preset for the Link work for you? If so, I would switch to that, since it will run more efficiently than the Lua script, and then you can preserve your Lua script for other tasks.
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

Post Reply