SpinDrive | A Propeller Chip™ Based Engine Control System
SourceForge Page | Introduction | Architecture | Connections | Specification [ 1. Hardware | 2. Firmware - Coordinator | 3. Firmware - Supervisor | 4. Software ]

2) Firmware


2.1) Firmware > Supervisor

The Supervisor firmware shall poll the analog inputs and perform the mathematical and logical algorithms needed to model and operate the engine. It shall directly control outputs to maintain idle speed and engine temperature, as well as perform non-standard functions defined at compile time. Characteristics of the injector and ignition outputs shall be communicated to the Coordinator for signal generation.


2.2) Firmware > Coordinator

The Coordinator firmware shall monitor the state of the two engine position inputs and generate signals on 24 output pins to control the operation of a 12 (maximum) fuel injectors and 12 (maximum) ignition coils. It shall receive and follow instructions via data bus from the Supervisor to change the characteristics of the control signals in real time. Upon lack of instruction from the Supervisor, the Coordinator firmware shall modulate the outputs in a "limp-home" mode using defaults programmed at tuning-time.


2.2.1) Firmware > Coordinator > Controller Object


2.2.2) Firmware > Coordinator > Decoder Object

The firmware shall include a Decoder Object that handles decoding of speed and position information from input signals.

2.2.2.1) Number of Inputs

Depending on the engine configuration, the Decoder Object shall monitor one or both inputs TRIG_0 and TRIG_1.

2.2.2.2) Number of Cogs

Depending on the engine configuration, the Decoder Object shall start a maximum of 2 Cogs to decode the pattern.

2.2.2.3) Modular

The firmware shall be designed to facilitate selection and inclusion of the correct Decoder Object at compile-time. Only one Decoder Object shall be present in the firmware image.

2.2.2.4) Versions

Multiple Decoder Objects shall be authored to support the following common setups:

2.2.2.5) Filtering

The Decoder Object shall implement logic to ignore false triggers caused by interference noise.

2.2.2.6) Synchronization

The Decoder Object shall implement logic to determine when:

2.2.2.7) Variables

The Decoder Object shall update a Hub variable called LAST_KNOWN_POSITION. This variable shall be in the form of a 16-bit unsigned integer. Each increment shall represent 1/65536th of two revolutions of the crank shaft (720 deg). The object shall update this variable whenever a valid tooth is decoded successfully, and shall indicate the presence of a new value by setting a 1-bit flag called NEW_KNOWN_POSITION in Hub RAM.

LAST_KNOWN_POSITION has an angular resolution of approximately 0.011 deg.

LAST_KNOWN_POSITIONEngine Position
00.00 deg
911.00 deg
46784513.98 deg
65535719.99

The Decoder Object shall update a Hub variable called LAST_TOOTH_ERROR. This variable shall be in the form of a 8-bit unsigned integer. Each discrete value shall represent 1 of 256 predefined tooth error types. The object shall update this variable whenever a tooth is invalid, and shall indicate the presence of a new value by setting a 1-bit flag called NEW_TOOTH_ERROR in Hub RAM.

The Decoder Object shall update a Hub variable called LAST_KNOWN_SPEED. This variable shall be in the form of a 8-bit unsigned integer. Each value shall represent the number of increments of 1/32768th of an engine revolution per 25us. No status flag is required for this variable.

LAST_KNOWN_SPEED has a resolution of approximately 73.24 rpm.

LAST_KNOWN_SPEEDEngine Speed
00.0000 rpm
463369.1 rpm
916665.0 rpm
25518676 rpm

The Decoder Object shall set a 1-bit flag called WHEEL_DATA_PRESENT in Port B when it senses a tooth. The object shall clear the WHEEL_DATA_PRESENT flag when no teeth have been sensed for a defined period of time.

The Decoder Object shall set a 1-bit flag called WHEEL_DATA_GOOD in Port B when it successfully decodes a tooth. The object shall clear the WHEEL_DATA_GOOD flag when a tooth is invalid.


2.2.3) Firmware > Coordinator > Simulator Object

The firmware shall include a Simulator Object that handles simulation of the engine position.

2.2.3.1) Number of Inputs

The Simulator Object shall not monitor any input pins.

2.2.3.2) Number of Cogs

The Simulator Object shall start one Cog to update and increment the engine position.

2.2.3.3) Universal

The Simulator Object shall be universally used in all configurations of the firmware.

2.2.3.4) Filtering

The Simulator Object may implement logic to prevent negative or substantial instantaneous position changes of the simulated engine position. Mathematical filtering may also be performed to better match the accelerations of the engine within one revolution.

2.2.3.5) Flags

The Simulator Object shall read and write the following flags in Hub RAM:

2.2.3.6) Values

The Simulator Object shall read the following values from Hub RAM:

The Simulator Object shall read the following values from Port B:

The Simulator Object shall write the following value to Port B:


2.2.4) Firmware > Coordinator > Injection Object


2.2.5) Firmware > Coordinator > Ignition Object


3) Software


Register Bit Variable/Flag
Port B 31(reserved)
30(reserved)
29ENGINE_PHASE_B
28ENGINE_PHASE_A
27CURRENT_POSITION
26
25
24
23
22
21
20
19
18
17
16
15CURRENT_SPEED
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0

LAST_KNOWN_POSITION (1/4096th crank rotation)

Description: Crankshaft position at last successful tooth decode.

Allocated by: Coordinator firmware

Location: Hub

Size: 12 bits

Type: Unsigned Integer

Range: 0 to 4095

Represents: 0 to 359.91 deg crank rotation after top dead center cylinder #1

Resolution: 0.09 deg

Written by: Decoder Object

Read by: Simulator Object when NEW_KNOWN_POSITION flag SET

Pattern: positive or negative change at every successful tooth decode

Nature: usually positive jump at every write, unpredictable upon resync


CURRENT_SPEED (clocks/increment)

Description: Crankshaft speed at last successful tooth decode.

Allocated by: Coordinator firmware

Location: Port B

Size: 16 bits

Type: Unsigned Integer

Range: 1 to 65535

Represents: 1 to 65535 clock cycles delay between +1 increments of CURRENT_POSITION

Resolution: 17.9 rpm

Written by: Decoder Object

Read by: Main Object, Simulator Object

Pattern: positive or negative change at every successful tooth decode

Nature: see above


CURRENT_POSITION (1/4096th crank rotation)

Description: An accurate prediction of crankshaft position.

Allocated by: Coordinator firmware

Location: Port B

Size: 12 bits

Type: Unsigned Integer

Range: 0 to 4095

Represents: 0 to 359.91 deg crank rotation after top dead center cylinder #1

Resolution: 0.09 deg

Written by: Simulator Object every x clock cycles

Read by: All

Pattern: increment by 1 every x clock cycles; increment by x once

Nature: increments regularly, occasional positive jumps due to error correction


VARIABLE_NAME

Description:

Allocated by:

Location:

Size: x bits

Type:

Range:

Represents:

Resolution:

Written by:

Read by:

Pattern:

Nature: