I intend to expand the input/output capabilities of my MS2Extra using the GPIO. At the beginning, I will use just the inputs for the four EGT, one VR input for vehicle speed (mine is hall, I believe that the VR circuit can be used as-is) and several ADCs for reading some resistor type sensors on the engine.
Can I use directly the template for this purpose, without any modification? I am an electronics engineer, but with very little (almost 0) experience programming microcontrollers. What puzzles me is that I downloaded the template project for GPIO and there are lots of comments regarding MSShift, which I am not interested at all... I am trying to understand the code, but it will take me a long time to be able to modify anything.
The outputs are not a point of interest at this time, but for sure in the future I will use them. That will be for future discussions, when I might undestand how to deal with them. The examples in code are very clear, I just have to read some more.
The template code was created from the MShift code (especially the latest version with the CANbus pass-through), and we haven't rewritten all the comments. You can ignore the references to MShift wherever they don't make sense.
I don't know anything about MS2extra, so I couldn't say what will work with that or not, but the 1.101 template code does work with B&G MS2 of course (I have tested it many times). I expect that the extra code has the same or compatible CANbus structures as B&G code, but you would have to check with the extra developers to be sure.
ADC (for your resistor sensors) is straightforward and the code should work with few modifications (port assignments, allowing enough time for proper sampling, etc.).
Vehicle speed is a little trickier, for two reasons:
- you have to allow for a range of input frequencies from zero to quite high (several thousand Hz), and the timer doesn't have this wide a static range (a tach signal from 600 to 6000 rpm is *much* easier to handle than VSS), so you need to think through all the possibilities, and
- the signal path is quite long and this can induce noise into the signal that must be filtered out. A Hall sensor is likely the easiest way to start, so you are in good shape there. Also, if you are designing this for just one target vehicle, that makes it easier too.
Depending on what variables you to hope to pass to and from the MS2extra controller, you will likely want to change the outmsg structure(s). Again, I don't know what functions the extra code might have to grab and use data from the GPIO, but the CANbus pass-through ought to work fine (many people are doing this with the extra and the MShift code which has the same CANbus structure as the template code).