114 | Setting up Dash Comms - Sending a CAN message to M1 from Dash
Modern ECUs and dash loggers that offer flexible CAN messaging greatly simplify the installation of complex electronic systems in our cars as data can often be sent between multiple devices. In this webinar we will look at how to configure a sensor in a MoTeC dash logger, send that data to a MoTeC M1 ECU via CAN, and then how to read and configure this input in the M1 ECU.
- It's Andre from the High Performance Academy. Welcome to this webinar, where we're going to be examining the Can communications between a Motec dash and a Motec M1 ECU. Now for this particular example, we're going to be using a Motec CDL3 dash fitted to our Toyota 86 and we're going to be sending some data from that dash through to the Motec M150ECU fitted to the 86. The example we're going to go through though will be relevant to anyone running an M1 ECU and any of the Motec dashes, including the new C125, C185, 127, etc full color dashes so the concepts and the fundamental principles that we're going to be going over will still be applicable. So I guess we'll start with why would we perhaps want to do this and really its going to depend a lot on your installation and your car.
It's really easy these days with a a lot of the more complex cars on the market and depending on exactly what sensors we're fitting and what we want to monitor it's very easy to end up with too many sensors to wire directly to the ECU, and alternatively we may also want different sensors heading to different pieces of hardware. The reason we might do this will come down to how we are using out data logging setup. So for me personally, and there's no right or wrong way of doing this, for me personally when I'm at the race track, I'm primarily using the CDL3 as my data logging hub, so want I want from that is sensor information coming from the ECU and there's also some other sensors there which may not necessarily be relevant or useful for the ECU itself and these can be wired directly to the dash. So in this case some of the sensors that I've wired to the dash can also be of benefit in the ECU. We may use these for logging functions in the ECU, we can also use them for control functions depending exactly what that particular sensor is.
So a good example of this which we'll be looking at today is the Motec dashes have a built in 3 axis G sensor, so this gives us for example lateral G-Force, lateral acceleration information, it's a built in sensor so we don't need to add an auxiliary sensor to get that data. Now we can also use lateral acceleration information in the M1 ECU as a modifier for our traction control strategy. So rather than adding a second G force sensor straight into the M150 ECU, it's possible to send that G force data that's already existing in the dash across via can to the ECU, where we can then use that in our traction control strategy. And there's just one simple example of how and why we may want to do this. Okay so the other thing is in our particular example here, our M150 header is completely used up, we've got no spare inputs on our M150 ECU, so this requires, when we want to add more sensors, us to get a little bit creative.
And in this case we're using a combination of both the CDL3 for some auxiliary inputs and we're also actually briefly going to have a look at the Motec E888, which is an expansion module, the communications here are relatively similar, so I'm just going to lump this in with our dash communications setup, and we'll have a look at the configuration for both the dash communications as well as each way communications and how we can get all of that data into the M150 ECU. Okay so our first step before we actually even worry about our data is to make sure that our dash, and in this case our E888 are both wired correctly to the M1 ECU. And there's nothing particularly complex here, we need to follow normal protocol for wiring a can bus if we could just jump to my laptop screen for a moment, we can see a quick example here of the can bus. So the can bus itself is a twisted pair of wires. It is important that we make sure that we have a terminating resistor at each end of the bus.
Now all of the Motec documentation will give you details on the can bus requirements much like we've got right here. If the can bus is under 2 meters in length it is possible to get away with just using a terminating resistor at one end but we must have that terminating resistor. And then we also must obviously make sure that our can high and our can low are correctly wired between the different units. Right I'll just head back to my notes for a second, and once we've got our communications setup, once we've actually got our can bus wired then we can go through and make sure that all of our inputs into our dash are correctly wired, are correctly configured. So that's one of the next steps we want to make sure that all of the channels that we've actually got going into the dash are correctly configured and correctly reading.
So what we'll do now is we'll just go to our laptop screen again, we're going to go to our dash manager software, and we'll have a look at this. So here I'm just going to click on our inputs, and what one of the channels we're going to be looking at today is our intercooler temp channel. So I can just double click on this, and for this particular example, this channel actually isn't doing anything right now, I'm getting intercooler temp from another source, but for the purposes of this demonstration I've just set this up so you can see that with no voltage, we're getting a reading of 22.5 degrees so that's the channel that we're going to be sending through to our M1 ECU. Once we've done this we can also click on our monitor channels and this is going to bring up a monitor channel window where we can look at all of the data that's available, all of the channels that are coming through on the ECU, sorry on the dash. I mentioned that we will be sending through lateral G-force, the lateral G-force is a built in sensor so we don't need to configure that as an input in the dash manager software like I just did with our intercooler temp.
So let's just have a quick look at those two aspects here, if we move down and we look at our G-force latch, so that's this particular input here, you can see at the moment I'm sitting on the dyno we haven't zeroed our sensor and we have a reading of negative 0.02 G, so this is what we're going to be wanting to see obviously in our M1 ECU once we've got our communications setup. If we move down and we look at our channel for intercooler temp, this is the one that we've just looked at, you can see the data is reading 22.6 22.7 degrees so again that is what we're going to be expecting to see. Now the other aspect that we're going to be sending through here, this is a really common one as well, if you're using GPS track mapping, you're going to almost inevitably end up with the GPS sensor ten hertz GPS sensor connected straight up to your dash, this is essential if you want to do track mapping GPS based lap timing, and in this case you can see that we've got our GPS latitude and our GPS longitude coming to the CDL3 dash via the GPS sensor, so it's another aspect we're going to look at. This is a really common one because if we are using the dash we've got the GPS connected to the dash, then it's very easy and quick to send that data through to the M1 ECU, so we don't need to separate the signal mechanically and wire the GPS sensor to both the dash and the ECU at the same time, so that's just another aspect we're going to be looking at. So now that we've got our can bus wired and we've got our inputs configured and reading correctly on the CDL3 dash, we can go and actually setup the receive communications templates in the M1 ECU.
Now I'll just mention as well with the can bus wiring this can get a little bit complex depending on your installation, in particular our 86, this is a really good example, so with the M150 and if you're running an M190 ECU these have three built in can buses which is, sounds excessive, but they're easy to actually use those up. If you're running the M130, the M170 ECU these have one can bus which can be a little bit more limiting. In the case of our Toyota 86 we are using one of the can buses from the factory or OE can communications, and one of the aspects of this is we do need to be a little bit careful with our communications can bus communications speed as well. These must be matched, and one of the requirements here is that the factory can bus communicates at 500 Kilobits per second, our E888 which we'll be looking at by default communicates at 1 megabit per second, and that's pretty common for most of the Motec equipment, so we do need to make sure that we are watching our can bus communications speed. So let's just jump back to my laptop screen, and what we'll do here is we'll just go in to, we're in our vehicle workbook and we're in our communications worksheet, and this is where we can setup the communications.
For start what we're going to do is click over here on our can option and this opens up the submenu for all of our can buses, so again in this instance we've got an M150, so we have three can buses, and I've got all three can buses operating here. So what we can see is that, I'll just close down E triple 8 for the moment, we can see that we've got can bus 1 and can bus 2 both communicating at 500 kilobits per second. can bus 3 on the other hand is communicating at 1 megabit per second. Okay so there's two aspects that we're going to be looking at here, first of all we've got our ECU, and what we're going to look at is our ECU receive. So we can see that we have setup our ECU receive to be coming through on can bus 1.
It doesn't matter which can bus you're using here this just needs to be setup based on your wiring installation for the car. The reason we're doing this is because the dash is receiving a lot of information from the M1 ECU as well as the factory can bus. So we're doing all of that communication on the single can bus, and this is why we're also set up at 500 kilobits per second so it matches the OE can bus speed. One aspect we need to consider here is our can ID base and this is an area which causes a little bit of confusion. So essentially this is just defining the base address for the messages that the M1 ECU is going to be receiving, and each of the addresses, the ECU can receive up to 16 messages, and these will come through on subsequent messages starting at this base ID address, so in this case we've chosen 16, it's an arbitrary number but it does need to be a multiple of 16 so you need to keep that in mind.
Essentially what we want to do here is just make sure whatever our base address is selected as, is not going to conflict with any other data that's being sent through on the same addresses so in this case we've chosen 16, a point that you need to keep in mind here is that this base ID address in the M1 ECU is a decimal value, so that's important to understand because particularly when we come to setting up our communications templates in the CDL3, the CDL3 works on hexadecimal values so we need to keep that in mind. A real quick tip for you if you want to convert, just bring up your calculator, and I've shown this before but if you click on normally we'll be in standard mode, if you click on the programmer mode and we enter a decimal value of in this case we want to enter 16. That will show us that the hexadecimal equivalent of 16 is 10, so this is how we can really quickly, if your brain doesn't work in hexadecimal, convert between decimal and hexadecimal. This will be our base address for our communication template in the CDL3 dash. So each of these messages, the way the M1 receive templates works, each of these messages will receive up to 8 bytes of data, and generally what we're looking for here is a particular channel will be sent at a particular base ID and then an offset.
So generally what we're going is we're sending our data from the dash in a 2 byte format so for example let's take out intercooler temperature channel, which we're going to be sending. That temperature data will be sent over two bytes and then the M1 ECU will in turn receive that. We're going to be looking for the correct location, the correct message, and the correct offset to find the correct two bytes of data that contain our intercooler temperature information. So our base ID there starts at 16 and each message beyond that will step up by one value, so it's important to understand if we're sending multiple pieces of information, we're going to have a look at that, we're going to be adding to that base ID as we fill up our communications template. Okay so now we can look over the can slots as well, let's just have a quick look here at our intercooler temperature sensor.
So we're coming over here now to the right hand side, and this one I'll just explain this goes hand in hand with what we've just looked at, so if we look here we have this parameter here that says slot. So this is where the ECU is looking for that particular piece of information. So at the moment we've got this particular parameter is not in use so it's not doing anything and we're not looking for any data. Now if we open that up and look at our drop-down menu, we can see that we have message 0, offset 0, 2 4 6, message 1 offset 0 2 4 6 etc. So this really just is what I was talking about, we're getting up to 16 messages being sent, so our first message, message 0 is on our base ID of decimal 16 or hexadecimal 10, and then each piece of data that's coming through is being sent over 2 bytes.
So for example if we selected message 0, offset 0, then the ECU is going to look at the message with the base ID 16 and it's going to look at the first two bytes of data on that particular message for our intercooler temperature channel. Okay so that's how our can ID slots work, now once we've got data coming into the M1 ECU, we also need to do something with it so that we can actually read it so that it makes sense, and we've got a couple of options there, we'll just have a look at this. We're going to see it in real life shortly when we actually see some data through but I just want to explain it first so we have this parameter here which is our can type, you can see at the moment that's set to calibrated, we also have the option of setting that to raw, and we'll be looking at both aspects soon. So essentially here what we need to know is if we have an input to our dash that we have calibrated and the dash, so we're actually getting a calibrated piece of data, then we are going to choose the calibrated method. On the other hand, for the E888 for example, we're not actually able to calibrate our channels inside the E888, the E888 essentially is taking for example analog voltage input and it's just transmitting that raw voltage input through to whatever it's communicating with, so in other words we're going to get a raw piece of data that varies from 0 to 5 volts.
So in that case we would be using the raw option, and then what we're going to need to do is actually create a calibration table exactly the same way as if we had an analog voltage input wired directly to our ECU. When we're using the calibrated mode, we also have the next channel, next parameter down here, which is our scaling channel. And what this does is it tells the ECU how the information is coming across, so in other words, what the precision of that piece of data is or how many units per bit are being set through. So this allows us to get our decimal places in the correct spot and display the data in the correct method. Okay so now that we've got a better understanding hopefully of how this all works, we're going to go through a demonstration of sending this data across, and that's going to give you a better idea of how it all looks when we're actually doing it.
After this we're going to move into some questions and answers, so if you do have anything that you'd like me to explain further, please ask those in the chat box and I'll do my best to answer those when we get to the end. Okay so we're going to go through several examples here. Let's go back to our dash manger, and what we're going to do is start with our lateral G and our intercooler temp channels, so what I'm going to do here, we've already got those channels, we've looked at those. So what I'm going to do is click on connections and communications, and this is where we can setup our communications templates. As you can see I've got quite a few already configured here in our CDL3 dash, there's a lot going on in our can buses.
What I'm going to do is focus here on our auxiliary outputs, I'll also mention that the CDL3 has two can buses available and we can also select the rate for the communications on each of those can buses. Again we need to be making sure that we're using the correct can bus and that the communications speed for those can buses matches what the ECU is expecting to receive. Now all of our work here at the moment is going to be done in our auxiliary outputs communication template. By double clicking we can open that template and first of all we can see that our base address, remember I mentioned that the M1 ECU demonstrates this or displays this in a decimal value, the dashes will display these in hexadecimal. So that's a really easy trap to fall into if you enter the base address here of 16, you're going to be communicating on the wrong address and you're going to have a lot of trouble getting this data to display.
So we've set that to our base address, so essentially the data that we've got in this particular communication template will be sending on message 0 into the M1. So that's where we're going to be looking for it. Okay so once we've got that setup, we can go though to our transmitted channels, and in this case we're sending two pieces of data. First of all we have our G-force lateral and then we have our intercooler temp. Let's have a look at our G-force lateral for example.
So our G-Force lateral, we can see here, just to confuse manners I've actually got an offset of 2 on this. The reason I've got an offset of 2 and we're not starting at the first 2 bytes of that message is simply because I originally had another channel being sent through with an offset of 0. It doesn't really matter, this is a good demonstration of how the offset works, and what you need to keep in mind here. Okay so there's a couple of pieces of information we need to understand. First of all we have our offset of 2, so that's going to be where we're going to be looking for that data when we setup our receive in the ECU.
We also have our length, now remember the M1 here is looking for the data to come across on two bytes. So our link there is 2 bytes. The other thing to note of here is our base resolution. So in this case the base resolution of our G-force lateral channel is to two decimal places, or in other words .01 of a G. That's going to be important when we're setting our scaling.
Okay so we've got that piece of data all setup to communicate, and we'll also have a quick look at our intercooler temp. Now here we've got our offset set to 4, now remember we're sending our data over 2 bytes, our first piece of data starts with an offset of 2, and it's 2 bytes long, so the next piece of data so that it's not overlapping, will start with an offset of 4 again that's 2 bytes long. Okay so we've got that data setup, now we can go through and have a look at our ECU. So what we're going to do here is just go through to, I'll just do this and I'll all calibrate because it's a little easier to do here. And what we'll do is type in lateral acceleration.
If I can spell it right, it's gonna be much easier. And what we've got down at the bottom is our can setup for our lateral acceleration input. So, I'll just move this around so we can view what's going on here, so the important part here, I've actually already got this setup, but you can see that the slot for our lateral G input is message 0 offset 2. Remember just to clarify why that's the case, if we come back to our auxiliary outputs and we look at our lateral G, our offset is 2. So we're on the same base ID and we're on the same offset, so great our data is coming through.
Let's go back to our ECU. Now the problem with this particular input is in the M150, the G-force lateral channel is only displayed to one decimal place, so we'll see at the moment it's showing negative 0.0 this becomes a little bit problematic because we can't really display what exactly our ECU is seeing. What we need to do is set our scale parameter here so that our data comes through. Just to demonstrate how this works, let's enter a value of 1. So now what you can see is our value being read in that particular channel, is showing minus 1 to minus 2.
Now you'll remember, let's just go back and have a quick look at it. If we get back out of here, and we'll go to our monitor channels and we'll look at our lateral G-force channel. If I can find that, G-Force lateral. Okay so you can see that this particular channel is sitting between -0.01 and 0.02 so the data's working, we've got that channel coming through, but our scaling is all messed up, because we're showing -1 to -2 G. That's also being shown up here, this is our final input once all of the data is coming through via can, so this is the data that the ECU will receive, which we can then use for whatever tasks we want to perform with it.
Okay so what we want to do is actually, into the same scaling as our base resolution, which in this case is 0.01. I'm going to enter than but it becomes problematic because our scale will only show to one decimal place as well. Even though the scale only shows to one decimal place, this will still correctly scale our input, I'm going to press enter, so now of course our Can value drops to 0. So this is working though as soon as we go over 0.1 G then we'll actually start seeing that value being displayed correctly. So that's our lateral G input setup, we've now got that communicating correctly using the on-board G force sensor on the CDL 3 dash that's being sent via can and now being read correctly into the ECU and we know that our scaling is correct despite the fact that that particular channel in the M1 only displays to one decimal place.
Now the next aspect we're going to have a look at is our intercooler temp. So let's do that now, I'm just going to again do this in our all-calibrate menu just because I can get a little more data easily. So I've got all of our information here, related to our intercooler temperature and what we want to do is come down to our can setup. Okay so you'll remember that the intercooler temp data is again being transmitted on message 0, this time you'll recall that our offset was 4. So what we want to do is select message 0 offset 4.
Now again this is a calibrated input, this is calibrated in the dash and it's being sent through as a calibrated piece of information but we need to set our scaling. Again in this case we've got our scaling value only displays to zero decimal places, whole numbers, our scaling for this particular parameter was 0.1 degrees centigrade, that's the resolution of the precision that it will read to. I'm entering that now, and straight away we can see that via can, our value is 23 degrees, again this is displaying with no decimal places. If we jump up to the top though, we can see that our intercooler temperature is now displaying as 22.6 to 22.7 degrees. Let's just jump back to our dash manger and we'll go down to intercooler temp channel and you can see that that is also varying between 22.6 and 22.7 degrees.
Okay so, we've got our two channels now being communicated via can, being correctly read in, correctly scaled in the M1 ECU, and being correctly read. Now the other aspect that I just want to quickly look at here is getting our GPS data across, so we'll actually look at that first of all in our dash manager. So again what I'm going to do is go through to our connections and communications, and there's a variety of data being sent here via can from the GPS. The one I'm just going to focus on for this demonstration is our GPS coordinates, and this is our longitude and latitude positions. Okay so GPS is quite unique in that the numbers are very large or they contain very very high precision, so in order to correctly communicate this sort of data we actually need to send the data over four bytes instead of two, otherwise we wouldn't get enough accuracy.
So if I double click, have a look at our transmitted channels. First of all, you'll notice here that our base address has now jumped up. Remember our base address in hexadecimal was 10, we've now jumped up to our second message which is on base address 11. Let's look at our transmitted channels, we've got our GPS longitude and latitude. I'll just have a quick look at one of these.
Our offset for longitude is 0, and our length is four. Okay, let's go over to our ECU again, and what we'll do is we'll jump back down to our vehicle menu, vehicle workbook I should say. And we're going on a communications worksheet and we click on GPS we have all of the GPS inputs that the M1 will be looking for. Let's look at longitude for the moment, which I think was the first one we were looking at and we have our message 1, so remember we've jumped up, we've gone from our base ID 16, we're now on 17, or hexadecimal 11. And the data was coming through on offset 0.
With the GPS setup, the ECU is already configured to be looking for this data across 4 bytes of information. So as long as that's how we're sending it, that's what we'll get. So again, I can't show you the actual channel here but if we come across to our calibrate all, and I'll just. If I can spell it right again. Okay so there we have our GPS longitudinal data coming in via can, so just going through this and setting up all of the data that we need to receive you can see that it's actually relatively quick and easy when we don't have to hard wire our GPS sensor to two locations or alternatively perhaps fit a second GPS sensor and we have all of the required data.
Okay so we've looked at lateral G, we've looked at our intercooler temp channel, we've looked at GPS latitude and longitude. We're going to look at one other parameter now which is the E888. So what I'm going to do here is we're going to look at a channel for turbo coolant temperature. This actually isn't a standard channel in the standard M1 GPA or GPR package, this is one that I've added in using build, but the demonstration is really going to be exactly the same regardless of what channel you're bringing in via your E888. So what I'm going to do is, I'll do this again and all calibrate, so I'll enter the channel that I'm after, which is Turbo Coolant Temperature.
And we have all of the data relating to that. So as normal, we could set this up as a hard wired sensor if required, if we had space. And we could do that by selecting a relevant resource on the ECU header for that particular input, in this case obviously we're bringing it in via can. We've already looked at the setup for our E888 communications previously, remember E888 communications was on a seperate can bus communicating at 1 megabit per second, which is the standard communication rate for the E triple 8 and it's communicating on decimal address 2, 4, 0. So that's all setup, what we need to do however is come down here to our can configuration and this time what we're going to do is choose the correct input.
So if I just open our drop down menu, what we want to do is move down and we see once we go past all of our addresses, remember we had 16 messages being send 0-15. We start seeing our E888 channels, so for this particular sensor it is wired to E888 analog voltage 3 inputs, so I'm going to select that. Now in this case as I've already mentioned, with the E888 we've got raw data coming through so essentially the E888 is just sending through a 0 to 5 volt data stream via can. And we can actually see that voltage being displayed here, it's 3.621 volts at this point. So in order to get this data displaying and doing something useful, we are this time going to be using the raw option for the can data type.
Remember last time we were using calibrated because the data was pre-calibrated in the dash. When we're using raw, this scale parameter has no effect whatsoever. So now that we've selected this as raw, now what we need to do is actually set a calibration and we do this exactly the same way as how we would select a calibration if we had a hard wired sensor. So what I'm going to do, I've already got one pre configured, so I'm just going to import from file, and I'm going to select our turbo charger coolant temperature calibration and hopefully that's going to give us, no let's just also import the calibration data. Right, Okay.
It is now displaying, and we've got our data being displayed there, something's gone a little bit screwy at the bottom of that table, not quite sure why, but it doesn't really matter, we can see that now we have our turbo charger coolant temperature being displayed, sitting at 20.8 20.9 degrees, so we've now got our data coming from our E888, we've got our sensor wired to our E888, our E888 is correctly communicating to our M1 ECU, and the data is now being imported on the correct slot, correct location. We're using the raw channel and we've entered the correct calibration table for that particular sensor, so we've got our data being displayed. Now, this is basically going to be a rinse and repeat for any other channels that we want to setup. It's just exactly the same process regardless of whether we're bringing the data in via the dash or via an E888. So at this point we've got a good understanding hopefully of how to wire up the can bus between the M1 ECU and the dash or alternatively the E888.
How to set up the receive templates or the receive ID inside the M1 ECU, how the message and slot parameters work in the M1 ECU, and then how we can send data from our dash through and then receive it and scale it correctly in the M1 ECU. Right now we'll move on to some questions so I'll just see if we do have any questions. If you do have any more questions please feel free to ask those. It looks like we haven't, so hopefully what that means is that I've done a great job of explaining everything already. Of course, as usual, if you do have any other questions that crop up, please feel free to ask those in the forum and I'll be happy to answer them there.
Thanks for joining us, I hope you've enjoyed this webinar, I hope it's given you some more understanding of the M1 communications system, and I look forward to seeing you all next week.