Making M2 more modular

Due to some recent projects I am getting involved with I have decided to take my summer and create a new, more modular setup for the M2. This will not be started totally from scratch as Collin has made some great stuff with the M2RET, but instead of hacking apart M2RET I have decided to go a different route. I will likely reuse much of the M2RET code but the intent will be to make a modular system designed that way from the start.

I am posting this now for feedback before I start digging in. I am slated at this time to start working on this project as of May 1st as that will be after my current school semester is finished. I hope to have major completion by the time summer ends for the fall semester at the end of August.

There will be three different areas of intended “Modularity”.

The first is ODB modularity:

  • Build a system transparent to the protocol used
  • Allowing for adding any protocol even if done with external device connected to M2
  • CANBUS/SWCAN definetly to be first libraries added
  • J1850VPW will be added once the driver is ready
  • LIN library will be added
  • ALDL library MAY be added since I have PCM’s to work with (LOW priority)
  • other protocols can be added at any time

The next step is I/O modularity.

  • Support for BT, WiFi, SPI, UART Serial etc
  • Redirect 1 or possibly more I/O streams to supported devices
  • Support for a console (Mainly to help with debugging. Will also allow logging console or full stream to SDCard)
  • Support specialized external devices such as Nextion HMI’s

The last step is Interface Protocol modularity.

  • Allow for specific protocols to be used depending on project requirements.
  • Allow to clone other devices simply
  • Initial support for RET, ELM/STN is planned
  • AVT support may be added as well

The main idea behind this modular system is to allow you to customize your devices firmware dependant on your projects requirements. So if you want to only support CANBUS and don’t need SWCAN or other components you just don’t add them.

A variety of things went into the decision to go this route. The ability to add new protocols or remove ones you don’t need will help with some of my future project goals. As well as make the M2 a great choice for some of the projects out there.

My initial priority is to make a M2RET compatible configuration that also supports BT/WiFi. The rest will be built on once that is accomplished.

Some of the reasons behind this project:

  • Support for new stuff without hacking M2RET. Just “add” it and it works.
  • Easily add a second M2 as external device to double your ports
  • Allow support for external protocols not originally considered such as ALDL

Once this is up and running I also hope to add a way to plugin custom add ons easily. Basically specialized routines or PID look up tables and that sort of thing. This would allow things such as:

  • Integration with other projects such as OpenXC
  • Allow onboard PCM flashing. This would potentially allow a tuner to program your PC remotely.
  • Create a fully functional scanner only requiring an add on such as Nextion

Lots of potential so I look forward to getting this going.

My Definition of the “Major completion” goal:

  • fully M2RET compatible
  • Basic I/O functions working including redirection, Console and logging
  • Including CANBUS/SWCAN

Secondary goals:

  • Full ELM/STN support
  • Full Nonblocking J1850VPW support with 4x as well (May be developed independently and rolled in once done.)

The rest I am looking at will be considered once I have the above completed.