10-02-2022, 11:29 PM | #1 |
Captain
339
Rep 655
Posts |
G8x CAN-bus Guide
this is a guide at using CAN-bus (not OBD-II) with G8x. disappointed BMW turned the M Laptimer into trash, i started looking at AIM SOLO2 DL for better track telemetry after using RaceChrono/TrackAddict/Harry's Laptimer with ODB-II dongles (OBDLink MX+, CX+, Kiwi3). honestly, the SOLO2 seems great. it's kinda expensive, but you really get a lot from it, both hardware and software wise. AIM's really only downside is there camera offerings are complete garbage.
if i had a dedicated track car with a roll cage, i probably would have just setup the AIM SOLO2 in a permanent way and moved on with my life. while trying to find a SOLO2 DL in stock with CAN-bus wiring harness, i decided to go over to the RaceChrono forums and see what is going on there. turns out, RaceChrono supports DIY devices over Bluetooth LE. this is my adventure with CAN-bus and G8x platform using RaceChrono Pro iOS app, ESP32 adruino CAN-bus device, and hacking the CAN-bus data for the G8x platform. this is a work in progress, but i feel like i am at the point things are better than they ever were and its highly usable on the track. spreadsheet of the CAN-bus data i have decoded so far: https://docs.google.com/spreadsheets...it?usp=sharing materials/items used:
step 1: tapping into the PT-CAN bus (PT stands for powertrain??) one such connection is in the passenger side footwell. CAN-bus wires are always twisted pairs, making them easy to identify. i used posi-taps to tap into the existing wires without messing with the complex factory wiring harness. i used JST connector so i could easily connect/disconnect devices. CAN-bus cabling color code: CAN High -> Yellow/White CAN Low -> Yellow/Black with this basic connection i was able to see ~1750 can frames per second. basically every message broadcasted by PT-CAN.. so really barely 20 kbps of messages on a 500 kbps CAN-bus. adding the wire + jst connector, making sure to twist the wires before covering them up for neat install step 2: figuring CAN-bus data car makers do not share this data usually, so i setup a Raspberry Pi 3/4 + PiCan2 hat so that i can use tools like candump and cansniff to log and analyze the CAN-bus data afterward. this is a boring, time consuming step that i can go into more details if people wanted, but i assume no one cares really. gist of what i have is (note i wasn't looking for all these, some just came out of looking for other data):
very close to having:
missing:
i have gear from 2 different pids, one of 50 hz, the other is 1 hz, but will send out updates instantly whenever the gear changes, so that is preferred, since it reduces the CAN-bus + bluetooth LE traffic without sacrificing any telemetry accuracy. step 3: assembly ESP32 arduino device I went with an Adafruit S3 feather ESP32 board, mainly because it had BLE 5.0, battery connector, USB-C for charging / serial port: https://www.adafruit.com/product/5477. I originally tried a Adafruit Huzzah32 ESP32 board, but the USB micro-B was annoying since GoPro and Racebox Mini are all USB-C. Also the Huzzah32 was an older ESP32 with Bluetooth 4.0, but even if i sent the entire CAN-bus of 25 kbps, i would still have plenty of bluetooth LE bandwidth in either 4.0 or 5.0. ESP32 chip contains a CAN-bus chip, but you still need a transceiver, so went with the feather wing CAN-bus transceiver, so it all fit in a nice little package. i still have to 3d print a case for all this... https://copperhilltech.com/can-bus-f...ing-for-esp32/ this did require some basic soldering. but because i got a feather ESP32 and feather wing can-bus transceiver, i just had to solder all PINs, even though the transceiver only uses 2. made for a solid build without a lot of guess work or arduino knowledge. step 4: racechrono RaceChrono is awesome. far and above TrackAddict and Harry's Laptimer IMHO and for the DIY crowd, the only track software that support this kind of thing. in racechrono, once your ESP32 is up and running, you can go to settings and other devices and add a bluetooth LE, can-bus device. then you can add channels and provide formulas converting any raw CAN-bus data into human readable values. i have included a column in that spreadsheet of the racechrono formulas i use. step 5: source code for ESP32 device i wrote my own customer CAN-bus driver stack to greatly optimize the read-only track telemetry case. looking to do the same for the Bluetooth LE driver as i think the arduino BLE drivers are what's bottlenecking this entire situation. source code is on my github: https://github.com/joeroback/racechrono-canbus full album: View post on imgur.com Last edited by dirtyfreebooter; 10-22-2022 at 11:30 AM.. Reason: added github link |
Appreciate
18
D_SheerDrivingPleasure1088.00 DRLane3987.00 forcefed2547.50 pinky_chi172.00 beachBmmr1447.00 Nugget649.50 Ximian1914.50 moonluv8102492.50 BMWRacer5232519.00 playswcars3626.00 stormlv932.00 DM5PAV375.00 mikewho_G82172.50 ngl118.00 3some!15.00 BackOnBlack703.50 Ojala6.00 M4Tejas770.00 |
10-02-2022, 11:30 PM | #2 |
Captain
339
Rep 655
Posts |
Video of RaceChrono:
note that because of some bluetooth le performance issues, i have temporarily throttled some can frames:
just to tone down the amount of messages. honestly, i dont think i need RPM at 100 hz anyways. you'll also notice in the video, i can still use my OBDLink MX+ with this setup, which allows me to get intake temperature and fuel level, 2 data values i am still searching for. Last edited by dirtyfreebooter; 10-02-2022 at 11:35 PM.. |
Appreciate
5
|
10-03-2022, 09:59 AM | #3 |
First Lieutenant
397
Rep 382
Posts |
This is gold! Thanks!
|
Appreciate
1
dirtyfreebooter339.00 |
10-03-2022, 12:56 PM | #4 |
Brigadier General
3987
Rep 3,408
Posts |
Joe, you're badass! Decoding the CAN signals is incredible. I wish I has your technical knowledge and skills.
Hope the G8X community appreciates.
__________________
Not a Doctor, those are just my initials.
|
Appreciate
1
dirtyfreebooter339.00 |
10-04-2022, 03:36 PM | #5 |
Private
172
Rep 99
Posts |
Wow this is awesome. Thanks for sharing!
|
Appreciate
1
dirtyfreebooter339.00 |
10-15-2022, 03:50 PM | #6 |
Captain
339
Rep 655
Posts |
updated post with link to github repo with ESP32 Arduino source code.
https://github.com/joeroback/racechrono-canbus documentation is still a work in progress and i am waiting on a new feather wing board so that i can make an youtube video of assembling the hardware and doing the basic soldering. i'll post another update here once i have more videos available over the next few months. |
Appreciate
1
pinky_chi172.00 |
10-22-2022, 12:08 PM | #8 |
Captain
2493
Rep 616
Posts |
Much respect for the dedication and attention to details!
|
Appreciate
1
dirtyfreebooter339.00 |
11-11-2022, 09:02 PM | #9 |
Lieutenant Colonel
2519
Rep 1,773
Posts |
You went deep! Appreciate the effort.
|
Appreciate
1
dirtyfreebooter339.00 |
01-18-2023, 01:41 AM | #10 |
First Lieutenant
234
Rep 319
Posts |
Great work. I am thinking about a little project to interrupt the throttle control so it goes idle only unless authorised as an antitheft mechanism. Complexity will probably be in authentication from phone to allow full power.
|
Appreciate
0
|
05-27-2023, 08:02 AM | #11 |
Second Lieutenant
118
Rep 208
Posts |
Amazing work.
There is another very useful piece of information in the PT-CAN that is yet to be discovered, the Oil Pressure. Being able to monitor it can help prevent an engine failure.
__________________
Quaife LSD | BC Racing Coilovers | H&R ARB | F8x LCA+TS | Wiechers Strutbar | Mishimoto CAI | Mishimoto Oil Cooler | Mishimoto Oil Catch Can | Mishimoto FMIC | VRSF DP | Masata TIC | Masata CP | DV+ | Custom Kline Exhaust | GTS Style Roll Cage | Sparco Evo QRT | Brey-Krause seat mounts | Schroth Profi 2 ASM 6p | 10" Android HU| xHP Stage3 | BM3 | RaceCapture Data Logger
|
Appreciate
0
|
07-14-2023, 04:27 AM | #12 |
Private
63
Rep 72
Posts |
Late to the party, but that's awesome work!
I am looking at creating my own decoder and documenting all codes on the BMW CAN bus (at least for my G87), happened on this thread. Quick question for the OP: have you checked to see if CAN H and CAN L are broken out on the OBD II port? According to the spec, they should be available on pins 6 and 14, respectively. Also, besides engine / performance data, have you also seen messages for the rest of the onboard systems (infotainment, door lock, lights, etc)? I would imagine you have chosen to ignore those for your project. In my E46 days, I'd tapped into the CD changer twisted pair for all "ibus" messages and used steering wheel buttons to operate Paul Stroffegen's MP3 player (https://www.pjrc.com/mp3/index.html). Here, I'm interested in unlocking some hidden options that are in BMW's firmware. OP, if you're still working at the list of codes, I'd be happy to contribute. |
Appreciate
0
|
07-21-2023, 02:07 PM | #13 |
Ballin' out of control.
519
Rep 1,289
Posts |
Cool project. SocketCAN rocks!
Fuel level might be 0x373 (Tank capacity/range).
__________________
Alpina B3 Flash/BMS OCC/ER CP/ETS 5/HKS BOV/M3 Control Arms
|
Appreciate
0
|
07-31-2023, 05:17 PM | #14 | |
Captain
339
Rep 655
Posts |
Quote:
OBD-II would be nice given the CAN + power is easily available, but the interface is just too slow for 10hz+ on multiple channels IMHO. I have not looked for anything other than performance related messages, so i cannot say, but given this is specifically the PT-CAN, you might have to tap into a different CAN-bus network to see things like steering wheel buttons. But again, I have never attempted to look for those, so maybe. I have that spreadsheet of codes, if you have codes decoded, i would love to hear about them, i could update the spreadsheet or add you as a editor, so you can add them yourself. |
|
Appreciate
0
|
07-31-2023, 05:18 PM | #15 |
Captain
339
Rep 655
Posts |
|
Appreciate
0
|
08-01-2023, 04:03 PM | #16 |
Ballin' out of control.
519
Rep 1,289
Posts |
You're welcome! I hope it works. A lot of F/G CAN arbitration IDs are the same.
__________________
Alpina B3 Flash/BMS OCC/ER CP/ETS 5/HKS BOV/M3 Control Arms
|
Appreciate
0
|
08-07-2023, 02:52 PM | #17 |
New Member
14
Rep 11
Posts |
dirtyfreebooter
I've been doing the same with my 2020 Supra. It looks like the G series M3/M4 share the same ID's! I see you have some I don't, and I have some that you don't. Check out my spreadsheet here: https://docs.google.com/spreadsheets...f=true&sd=true Have you found anything new since posting this? |
Appreciate
1
Nugget649.50 |
10-02-2023, 12:49 AM | #18 | |
Captain
339
Rep 655
Posts |
Quote:
https://github.com/joeroback/racechrono-canbus/issues/1 updated spreadsheet: https://docs.google.com/spreadsheets...it?usp=sharing some of the new pids
one PID i still haven't found is gearbox temperature. i will admit tho, i did get rid of my g80 and replaced with 992 GT3, so BMW stuff may not get updated unless requested on github, since i dont have a BMW to test with, tho i am planning on loading this onto a friend's m235iR in a few weeks for a track day. i think all of this should work fine on all F/G series and any toyotas sharing the same engines and ECUs |
|
Appreciate
1
Ojala6.00 |
03-08-2024, 03:59 PM | #20 |
Captain
339
Rep 655
Posts |
|
Appreciate
0
|
Post Reply |
Bookmarks |
|
|