BMW Motorrad LIN BUS controlling turn signal

#1

Hi,

I’m looking for tools to tap into the LIN BUS of my 2017 BMW R1200 motorcycle.

My problem is that the original “self-cancelling” of the turn signals is VERY limited and in reality doesn’t work. This means that the turn signals stays on for too long, which of course is very dangerous.

There is a system (STS) on the market, which have solved the “cancelling-problem”, but it doesn’t work with LIN BUS.
The idea is to build an interface between the LIN BUS and the STS control module.
Basically all that needs to be done is triggering a LIN BUS “cancel turn signal”, when the STS module says so.

So what I need is:
What do I need to debug the LIN BUS?
What do I need as an interface between the LIN BUS and the “normal” 12V system?

I sincerely hope someone will read this and guide me in the right direction.

NB. As you might already know, then I’m only the messenger. I have a very clever friend, who will do the “soldering” :slight_smile:
Thanks in advance
Bent Witte Rasmussen

1 Like
#2

First of all the M2 device has 1 LIN bus on it.

Next thing is to determine if the turn signal switch is sending data to another module or if it is directly wired to the module that controls your lights. If it is directly tied to the light controller you are likely out of luck unless you can find a method that works for you.

Assuming it passes the signal via the LIN bus you could either filter the line or send additional commands over the line to override the normal signals.

Filtering the line requires 2 LIN ports and sending additional commands requires only one port but can be much more complicated than filtering the lines.

Other issues to consider would be how does it handle the difference between a lane change signal and a turning signal. If you only account for the lane change your turn signal won’t work as designed etc.

The other major issue your going to currently have is although the M2 hardware is designed to work with the LIN bus as far as I am aware there is no software yet working with it.

#3

Cool project idea! Great advice and suggestions @redheadedrod

Just a couple points of clarification: M2 has two LIN channels and there is a library that works pretty well here:

1 Like
#4

Thanks, I stand corrected.

However are there actually 2 channels? I have not been able to find much on this but wasn’t looking too far. I got some parts I needed for my lab so I certainly could test this out if I get my simulator working again. Although will this work with my developer module?

When looking there are support for 2 lines in the M2 but when researching the protocol there seemed to be different versions of LIN style protocols through the years, some requiring 1 line some requiring 2 lines. Will M2 support all of those or only certain ones? I would think in the case of the 2 line protocols it would only support one channel and in the others then support 2 channels.

#5

Thanks for your reply.

Do you have any suggestions of what I need to read the signals on the LIN bus?
There is an OBD2 plug and I expect that it should be possible to tab into that and read the signals, but I don’t know which “LIN bus reader device” to purchase, please advice.

I believe the turn signal switch is sending a command to “the control box” on the bike, for both on and off, because I know of another device (Clearwater Lights LED) which is controlled by - among others - the signals from the turn signal switch. The Clearwater module taps into the LIN bus in the circuit to the tire pressure sensors, which tells me that the signals from the turn signals are all over the LIN bus or ?

#6

So you already have been able to tap into the LIN bus and look at that?

You could look at the library that has been listed and see what that does. Chances are if you can communicate with the M2 with it that you will need to write a small program for it.

You could also test the bus with something like a standard ODBII interface but you won’t easily find one that is able to load a program on it.

Rodney

#7

The way LIN works, being a master/slave bus (unlike CAN)…Im pretty sure you’re going to need two separate LIN channels to act as a “middle-man” to accomplish what you’re wanting to do.

#8

Does the LIN library work with Lin2.0?
Using the sniffer sketch I could only ever get it to print out one frames worth of data and even that never looked correct, ie the sync byte was never 55.

I purchased a cheap usb cro and could see plenty of data on the LIN bus entering the M2, and after performing a screen cap I could see that at least for the frame I was looking at it consisted of 4 frames, can be either 2,4 or 8, so 4 + sync + ID + checksum = 7 bytes in total
Setting my data & data_size to 4, 7, 11 … etc still only ever printed out 1 frames worth of data if I was lucky

Checking lin_stack.cpp is where I get a bit confused. lin_stack::readStream seems to take the data_size that is passed to it, but, does it then call lin_stack::read which then adds the extra 3 bytes for sync, ID & checksum.
These dont seem to be operating consistently.
Shouldn’t the sketch also wait until it sees the sync byte before starting its count?

Sorry I dont yet know anything about programming Ardunio or C, can do Perl, Shell and have dabbled in python, will have to start looking at some online tutes

#9

Hi,
I would like to know how you wired your project. any photos or pointers will be appreciated.

Cheers,
Ali

#10

Hi BWR,

I was very interested to read your message. I had a 2006 R1200 and I built a turn signal cancelling module using a couple of 4000 series CMOS logic chips. It worked like this. If you were on a motorway or multi-lane road and you were changing lane, you ‘flicked’ the turn signal button - in other words, pressed it quickly. The module detected this quick press and after 4 flashes of the turn signal, my module cancelled the flashing automatically.

If you wanted the turn signal to work like normal, for example at a junction, you held the turn signal button down for a fraction longer (> 500ms) and the module did not trigger, so you cancelled the signal using the TSC switch as normal.

I got really used to this and it was great not having to cancel the signals for changing lanes, and exiting roundabouts etc. but I now have a 2017 R1200 and of course my module does not work as it relied on individual wires for ‘turn left’, ‘turn right’ and ‘cancel signal’ So I was just doing some research myself on the LIN BUS to see if I can use a microcontroller (maybe a PIC) to do the same function as my old CMOS logic unit would do.

You are totally correct in your post and I also found out that data from the turn signal switch unit is passed onto a BUS (I guess it’s LIN but I don’t know for sure yet). I know this because Clearwater, who make LED lights, also manufacture a unit they call the CAN-OPENER which detects the turn signal cancel switch and the left and right turn signal switch from the TPM connector at the rear of the bike. They use these signals to set preferences on their LED controller - like from their instruction manual it says stuff like “hold down the TSC switch for 5 seconds, then press the left turn signal switch”. This means that the turn signal data is available outside the main control unit.

Of course their unit does not transmit any data onto the bus, it only monitors the data to control their LED lamps which are plugged into the CAN-Opener.

Rather than build an interface between the STS module and the BUS, might as well just write the code to do the self-cancelling, since you are going to have to use a microcontroller to read and filter the data packets.

Have you found out for sure yet if the turn and cancel switch signals are transmitted on the LIN BUS ?

Useful LIN information here… Looks like the slave (aka switch) only responds to a request packet if it has something to tell the controller, kind of…
Controller -> Turn switch : anything to tell me?
Turn switch -> Controller : yes - I am being pressed

#11

Hi Jon
Thanks a lot for your reply. Perhaps if you’re interested in the project, we can work together?

My point in using the STS module, is to re-use all the algorithms, rather than just time and distance.
I totallly agree with you, regarding what Clearwater does i.e. they must have cracked the messages…
I found a spreadsheet here https://github.com/4G-Gregg/BMW-GS-CAN-Sniffer/tree/master/Documentation
According to this, which covers various BMW models like my K52, the messages is CANBUS and not LIN.
Even though I’ve got something like 40 MB dumped from my bike, I have not been able to find the messages mentioned in the spreadsheet - perhaps I’m a clown. This is where the project stopped last…
I would expect an R1200 from 2017 to use the same messages as an 2017 R1200RT.

You are more then welcome to see the data from my bike, if you’d like. Just let me know, how to share.

If you figure out where to find the messages - on CAN or LIN, I’m more than interested in this.

Br Bent

#12

Hi Br Bent,
How do I send you a PM on this board ?

#13

Hi Jon
Just sent you a message from within here… Let me know the outcome :slight_smile:

#14

Guys,
I tapped into my can bus on my R1200GS 2016 using the same connector CanOpener uses. I started reading the same messages you are talking about. something has gone wrong. although I never wrote anything to canbus, looks like I’ve put my ECU in a wrong state. when I press the on button (it’s a key-less model) it no longer takes the RPM gage all the way to 10 and back to 0, instead it briefly shakes. and when I press the start button, it makes a click sound as if the starter got engages for 10 milliseconds and then it shows the key icon with a question mark next to it. also when I press the kill switch, the RPM gage goes all the way to 10K and stays there.

I detached the arduino, also detached the battery and let it be over night, but the invalid state seems to be persistent.

anyone else encountered the same problem?

#15

Hi Shafa
This reply is not very helpful, but you’ll get it anyway. It seems as if something have made the ECU very angry :slight_smile:
Do you know anyone, who has a GS-911? This could perhaps clear all the error codes, but I don’t know for sure.
Both Jon and I have connected the M2 succesfully. Can’t remember what happened initilally, but at first my setup caused a lot of errors, but I was able to clear everything with my GS-911 and since then, no errors have shown.
On the plug to the TPS module, the colorcodes are: CAN-L = white/brown, CAN-H = white/black.

Good luck.

#16

Thanks for the reply. I don’t have a GS-911, but I probably need one :slight_smile:
The bike was scheduled for a service tomorrow anyway and BMW will pick it up from my place for free. I’m more worried about this happening again. I did connect the cables correctly as I was reading can messages for a few minutes before shit hit the fan. I’m pretty sure I didn’t write anything to the bus. any theories on what can go wrong in a readonly mode?

#17

Hi…i am a new user here. As per my knowledge Filtering the line requires 2 LIN ports and sending additional commands requires only one port but can be much more complicated than filtering the lines. Also it handle the difference between a lane change signal and a turning signal. If you only account for the lane change your turn signal won’t work as designed etc.

calculate percentages