This is in working-draft format at the moment; more to come.

This install was in conjunction with the latest heavy rewire effort.

The stock Mazdaspeed ECU initiates fuel cut at ~11-12psi (stock is 8psi) and is generally considered to be a lousy ECU. After a lot of research in the possible options, I chose to use the MS3Pro EVO for my engine management upgrade. The MS3Pro Plug-and-Play could have certainly been an easier choice, but it would have retained the stock wiring harness, which for me would have been a waste of extra wires and limited some of the functionality which can found when making your own harness.

Sensors

It's important to remember that MegaSquirt isn't able to make use every OEM sensor. There are seven things you'll need to remove or modify.

O2 Sensors

  • The front O2 sensor needs to be replaced with a wideband O2; I went with an Innovate LC2
  • The rear O2 sensor (mounted in the catalytic converter) can be discarded

Intake Air Sensors

There are two on the MSM for ... reasons?

  • #1 is near the MAF, which will be discarded (along with all of the associated wiring)
  • #2 is near the throttle body, which will be replaced (I reused the stock wires)

GM IAT is the standard choice replacement; you'll need to rewire the pigtail.

Camshaft position sensor and crankshaft position sensor

Both must be tied back to +12VDC to pick the signal up.

NB Alternator

The NB Miata alternator's output is controlled by the stock ECU, and MegaSquirt will require a pull up resistor from +5VDC to function properly. This is different than the NA Miata, which has an alternator with an internal regulator and no ECU wiring involved.

Engine Fan

For the first ... honestly, 8 months and 3000+ miles of driving the Exocet on MegaSquirt I constantly fought with the SPAL fan's initial hit causing the engine to stall. Its an extremely high power fan and the current draw is more than an idling engine can handle.

My initial solution was to leverage the MegaSquirt engine fan control functionality which includes the ability to preemptively bump the idle before kicking on the fan. The settings include:

  • Idle-up Delay - how long to wait after raising idle before turning on fan, with a maximum value of 999ms (effectively 1 second)
  • Idle-up Duty - PWM open-loop duty cycle to increase by
  • Idle-up Target Increase - target rpm to increase by

Effectively, the engine will open the idle valve by Idle-up Duty % more than it was Idle-up Delay milliseconds before turning on the fan. After turning the fan on, idle will then attempt to return the engine RPMs to the closed loop idle target Idle-up Target Increase RPMs.

In my case, I set the delay to 1 second with a 6% idle valve bump, which caused the motor to idle up, then closed loop idle would ramp the RPMs back down to the normal idle. My issue wasn't with the alternator's ability to keep up with the fan, so I didn't need to maintain higher RPMs.

Still, the transition from idling with fan off to fan on was rough and occasionally still stalled. Frankly I was tearing my hair out.

So I started researching PWM fans so I could more gently bring the fan up to speed without tanking the engine's ability to idle. I found discussions of how to do it using OEM Ford or other fan controllers from the mid-2000s, which wasn't terrible from a wiring perspective. I then started on finding a fan which could be controller by PWM. ... Huh, my SPAL fan is a PWM fan. ... Oh, hey, looks like MegaSquirt can be the PWM controller. ... Well shit.

Generic PWM A

The limitation with this approach is that we can only build a fan duty cycle table using coolant temperature cross referenced with RPM. It would have been more effective if we could have included throttle position and vehicle speed as the fan control function does, which I had disabling the fan above 70% TPS and/or 40 MPH.

NOTE: you must disable fan control before proceeding so there isn't a conflict between fan control and generic PWM settings.

To make the best of this, I did the following:

  • Frequency: 150Hz (to match the limit of the MSD solid state relay I'm using)
  • Load Axis: coolant
  • Table or Curve: table

Table:

  • 0 to 699 rpm, 0% duty regardless of temperature
  • 700 to 1500 rpm (idle range), 50% starting at 204F ramping to 90% by 210F
  • 1501 rpm to 3000 rpm (slow cruise), 50% starting at 208F up to 90% by 210F
  • 3001 rpm and higher (cruising speed), 50% at 208F and 90% at 210F

Given that the BP4W with OEM replacement thermostat has been running about 199 degrees F at cruising speed (regardless of ambient air temperature), the fan should never kick on while driving.

SPAL fan specs

SPAL Brushless Fan Control issue
I am trying to control a SPAL brushless fan using an E67 ECU. I got the fan settings at PWM electric and frequency at 128 Hz. My problem is when I command a High duty cycle the fan goes to low speed and when I command a Low Duty cycle it goes to high speed. Now I know that those aftermarket fans mad…

For SPAL Aftermarket brushless fans: (Not SPAL OEM brushless fans)
15% Duty Cycle = minimum speed = 25% of full speed RPM.
90 - 95% duty cycle = full speed = 100% RPM.
The ramp is linear between 15% - 90% Duty Cycle.
The fan is "OFF" from 0% to 15% and 95% to 100% duty cycle. So constant 12V or constant ground on the signal wire doesn't make the fan run.
There is no duty cycle that you can send the fan to enter a diagnostic mode. Typically SPAL will select a frequency range way outside of normal operating ranges for diagnostic purposes.

Holly MSD relay specs

MSD 7564-HC High-Current Solid-State Relay 35Ax4, Red
Clean up your wiring with an MSD Solid-State High Current Relay Block. This high current module takes the place of 4 standard relays and eliminates unsightly wiring. Four independent channels can be activated using either power or ground. Each channel is capable of handling up to 35 Amps of conti…

Features:
A PWM signal can be used in the Solid-State Relay Module with a maximum frequency of 150 hertz and a duty cycle range from 50% to 90%.

References

Idle Tuning for MegaSquirt
Or any other Engine Management System How to: Tune for a smooth idle “How do I get a smooth idle like my stock ECU had?” It’s a common enough question to warrent a small article with tips for how to get the idle in tune. The first key may surprise many novice tuners: The idle…