rusEFI
The most advanced open source ECU
|
Board-Id detector for Hellen boards.
The main idea is to measure the capacitor charge/discharge time through a series resistors using standard digital I/O pins. One pin is used to provide a Vcc(3.3) or Vdd(0) voltage to the capacitor through a resistor, and another pin is used as a digital input. Then vice versa.
The algo: 1) Completely discharge the capacitor (all pins are low) 2) Charge the capacitor until the voltage crosses the 0->1 voltage threshold (Vt) and measure the charging time #1 (Tc1). 3) Immediately discharge the capacitor to some unknown low voltage (Vl) - it should be well below the Vt threshold, using the same period of time used for charging as the discharge period (Td = Tc1). 4) Immediately charge the capacitor again and measure the time crossing the same 0->1 voltage threshold again (Tc2). 5) Repeat the procedure several times to get more precise timings. 6) Do some math and find the R and C values. 7) Board_Id = the unique combination of indices of the "measured" R1 and R2.
The math proof:
Simplify the equation: X = exp(-1/(RC)) (1 - X^Tc1) * X^Td + X^Tl - 1 = 0
X^Td - X^(Tc1+Td) + X^(Tc2-Tc1) - 1 = 0
Td, Tc1 and Tc2 are known.
Solve the power function for X and get the desired R or C.
We use Newton's method (a fast-converging numerical solver when the 1st derivative is known) with estimated initial values.
Definition in file hellen_board_id.cpp.
Functions | |
static void | hellenBoardIdInputCallback (void *arg, efitick_t nowNt) |
int | detectHellenBoardId () |
int detectHellenBoardId | ( | ) |
Definition at line 308 of file hellen_board_id.cpp.
Referenced by detectHellenBoardType().
|
static |
Definition at line 68 of file hellen_board_id.cpp.
Referenced by HellenBoardIdFinder< NumPins >::measureChargingTimes().