Thursday, 29 October 2015

MEMS 1.6 / 1.9 Ignition timing map adaptation

As mentioned previously, the real meaning of the so-called "unknown variable" was not really clear, it has been suspected to be either ignition offset or open-loop fuel enrichment (a kind of acceleration pump).

Thanks to the data logging option, it's possible to compare the ignition timing advance vs RPM vs MAP for two separate runs, each of them performed with minimum and maximum allowable setting (116 vs 140).

Then, with a simple perl script a data matrix can be build and visualised (gnuplot):

Of course more averaging, filtering by coolant temp or IAT is clearly needed, but this is how it looks:

 (2D map variant)

(3D version)

Not having access to a dyno it's not really possible collect all possible combinations of  timing vs rpm vs map values required to plot complete ignition map, also the low rpm/load area is bit noisy due to idle speed control interventions, nevertheless it gives a good overview of timing differences.

In short, the timing adaptation variable influences the amount of advance (or retardation) in the area of MAP pressure above 60 kPa.

For example, in case of  K-Series 1.8 16v (Freelander I) it's possible to to adjust timing advance (only for loads above 60 kPa) withing the range of -4.5 to +4.5 degrees. Each increment or decrement equals to difference of 0.5 degree, however it's not possible to exceed 4.5 deg (140-116 = should be -6,+6 deg.).

Default value: 132 (timing retarded by 2 deg.)

Min value: 116 (timing advanced by +4.5 deg)
Max value: 140 (timing retarded by +4.5 deg)


Monday, 25 May 2015

MEMS 1.9 ECU basic tuning / adjustments / road dyno - updated

A new feature (tuneview tab) has been added to the MEMS_DIAG android app (full version only)

The "tuneview" tab should be self-explanatory, one selects the tunable from the drop-down list and then uses the increment or decrement button to change the value of currently selected item (of course the connection must be first established on the main connection tab). The effect should be seen in the mini "Live data" section below the inc/dec buttons.

So far it has been only attempted against a MEMS 1.9 system, but in general both 1.6 and 1.9 ECUs are very similar.

The following "tunables" are available:

a) Idle target rpm - sets the desired idle engine speed (warm engine, but should also influence cold/fast-idle). Granularity seems to be 25 rpm ( +1 raw == +25 rpm) .

b) Idle fueling trim 1 - sets the base idle fueling trim, seems to be an offset from the main idle map. One should increment or decrement so that the FuelTrim value in the "live section" equals 100 (meaning no additional feedback is needed from the lambda sensor). Sometimes might be useful to set it a little bit on the rich side (FuelTrim <100 in the live data section)

c) Idle fueling trim 2 - in case of MEMS 1.9 it's identical to "b". But perhaps with some other variants it might have a different effect.

d) Unknown (ignition advance offset ? / acceleration (pump) enrichment) ? - This is currently unknown, seems to be somehow related to ignition advance offset or a kind of acceleration enrichment, if the value is DECREASED the throttle response seems to be better. Try min/max values to see if there is any effect.

(update: 2015-06-10)

Default setting: 128
Min value: 116 (best performance)
Max value: 140 (poor performance)

It could be a kind of ignition retard offset for markets with poor fuel quality (to avoid knocking). Apparently, there have been rumors a similar option is available with rover testbook.

There is no easy way to measure the effective ignition angle (map +/- offset), but knowing the vehicle weight, gear ratios (3rd gear, IRD, main diff.), cx + frontal area, rpm_over_time, we can create a rough estimation of engine torque/power delivered to the wheels.

Here is the result, torque & power as seen the the wheels (two runs, effect of min/max settings of the "unknown tunable", drivetrain losses not included) :

It does seem to confirm the subjective feeling, but of course more tests are needed.

And as a reference, "official" torque & power graph of a 1.8 K-Series engine (as seen at the crank):

e) Idle recovery - decay rate - Seems to influence the "return-to-idle" rpm speed. Its effect is best visible during gear change, the engine will maintain the revs a bit longer before it returns to idle (or shorter, depending if increased or decreased the value)


- it's an experimental version so use it at your own risk !

- Note down (and keep in a safe place) the initial values of each tunable (visible after 1st inc/dec change/refresh). You might need them to go back to the original values in case a rollback is needed.

Saturday, 31 January 2015

USB OTG host mode API issues with some Android devices

It has been reported recently that some devices doesn't support USB API correctly, despite having Android version > 3.1 (the first release with USB OTG host mode API available to application layer).

Basically, the non-functioning devices can be divided into two groups:

a) Hardware USB host mode not implemented.

A good example is LG Swift G (or related) mobile handheld, a rumour says that +5V DC supply voltage is not available, a result of hardware cost-cutting. Obviously there's nothing that could be done to enable USB host mode on those devices

b) Hardware USB compatible with host mode, Android version >=3.1, pendrive or mouse works fine, yet no USB devices are visible form the application layer.

This mostly is true when it comes to no-name devices (tablets), it looks as if manufacturers were in a big rush to release a product and forgot to properly configure Android OS.

Some devices can be fixed, a solution is to modify/copy a file in the /system/etc/permissions.

One must have root access to able to remount and modify those files.

See the thread:

Quotation from the above link:

"To enable USB host API support you should add a file named
and containing the following lines:

<permissions> <feature name=""/> </permissions>

into folder


in that folder find file named

handheld_core_hardware.xml or tablet_core_hardware.xml

and add

<feature name="" />

into <permissions> section.

Reboot your device. Usb host api should work."

Some tablets have root by default, it's only necessary to switch into superuser, this can be done with Total Commander

Or by using "adb" command-line utility:

adb shell 
 mount -o rw,remount -t ext4 /system

Be careful with system files/directories it's very easy to brick your device. First make sure you are able to restore the original OS rom image (in case of...) before trying the above hack.

Saturday, 3 January 2015

Rover MEMS 1.6 1.9 ECU Diagnostics tool


What is MEMS_Diag

MEMS_Diag is an android application designed to communicate with pre-OBD Rover engine management systems (ECU). Modular Engine Management System (MEMS 1.6 / 1.9) was used on many cars in the 1990s built by the Rover group (models equipped with different variants of K16 petrol engine)

Which MEMS versions are supported 

Currently only MEMS 1.6 and 1.9 are supported, later versions are OBD2 compliant so they're not in the scope of this project

Implemented features

- MEMS 1.6/1.9
- RealTime engine parameters (rpm, map, ignition advance, coolant temp, inlet temp, oxygen sensor, fuel trim/correction and more...)
- Retrieve and erase error codes
- Scrollable view (numerical/table display)
- Graph view (selectable parameters, multiple series)
- Data logging, csv format (full version only)

What is required

In order to use this application, the following componets are required:

- Android-enabled device (smartphone), minimum version 3.1+ (USB host access)
- USB port
- the so-called "USB OTG" cable

in addition to the above, depending on the MEMS version, you also need:

for MEMS 1.9:

- FTDI-based (FT232) 12V K-Line cable, commonly known as VAG-cable/VAG-KKL. These cables are widely available on ebay etc. Make sure it's build using the FTDI USB chip, perhaps PL2303 should also work but I haven't been able to test it. Avoid products based on CH340 chipset (reason being, there's one missing but crucial function not yet implemented in the driver)

For MEMS 1.6:

- Any USB-to-TTL converter, again, the most popular are FTDI and PL2303. Remember that MEMS 1.6 uses 5V logic (depending on the quality of the converter circuit a 3.3 V may also work)

ECU data link socket(s)

MEMS 1.9 uses a standard OBD2 16-pin connection (despite having nothing in common with OBD2 communication protocol). Usually it's located somewhere in the passenger compartment.

IMPORTANT UPDATE - Missing J1962 pin "5" (MEMS 1.9):

If the tool is unable to establish connection the the ECU, or it works intermittently, the connection is dropped as soon as the engine is started...then most likely explanation is the (in)famous missing pin issue.
Apparently, with some rover vehicles (400 1.6Si for example) there is a pin missing from the OBD SAE J1962 socket. The missing pin is No. 5 - "signal ground" and the only available "ground" signal is pin 4, see the picture below:

  (counting from right to left, 5th pin is missing)

Now, it depends on your FTDI USB cable, some of them have both pins 4&5 internally connected anyway - these are fine (usually the newer ones), while other designs require ground signal to be present on pin 5 - in this case it might be necessary to modify the cable connector by soldering both 4&5 pins together.

MEMS 1.6 on the other hand, uses a custom 3-pin connector located in the engine bay, just next to the ECU.

Pins/Signals (as seen at the MEMS side):

Pink/Black - GND (connect to USB/TTL GND)
White/Yellow - TXD (connect to USB/TTL RXD)
Black/Green - RXD (connect to USB/TTL TXD)

The diagnostic socket attached to your car ecu (engine bay) looks like the one below (male terminals):

If you don't want to connect pins directly (tricky but possible) a corresponding diagnostic plug is needed (female terminals). They are still sometimes available on ebay:
(ebay link)

(PL2303 USB/TTL + 3 pin socket TE Connectivity / AMP 172201-1)



ECU models/part numbers

So far the following ECU/Cars have been verified to work correctly:

MKC 103610 (MEMS 1.6)
MKC 101610 (MEMS 1.6)
MKC 104393 (MEMS 1.9, LandRover Freelander 1.8 Petrol 99')
MKC 104031 (MEMS 1.9, Rover 400 1.6Si - "missing pin 5")
MKC 101600 (MEMS 1.6, Rover 620Ti)
MKC 104072 (MEMS 1.9, Rover 620Ti - facelift)

Rover 800 coupe 2.0 turbo, MEMS 1.6
Lotus Elise '98, MEMS 1.9

"Lite" or Paid version ?


A lot of time has been invested to analyse and implement MEMS communication protocol, so it would be nice of you if you decide to download the paid version.

However, due to the fact there are many components (Android, USB, cabling etc) that could create some issues, preventing the application from working correctly, a free "lite" version is also available. Before going for the paid version please try the "MEMSDiag_lite" and see if it works for you.

Free/Trial version: 

Full version: 

(last edited: 2015-02-11, memsdiag (at)