Re: Coding my own aftermarket 24x ECU [beta available]
Posted: Wed Jun 25, 2025 12:04 pm
looks impressive until you try to use it and get nowhere.
Electronic Fuel Injection - Developement & Tuning
https://pcmhacking.net/forums/
Apologies. My bad. Got my pots mixed up. MAP pot on ECM not Pico. Speed pot on Pico.AngelMarc wrote: ↑Wed Jun 25, 2025 9:28 amUnclear on some details.
Just to be sure we're on the same page...
The power for the Pico is 5 volt, it has a regulator to drop that to 3.3. VBUS and VSYS if I remember right, are 5 volt input. You can remove a resistor or something to separate USB power I think.
Every other pin is not 5 volt capable.
Yes! Looking for torque calculation table/s. In E38/E67 etc ...TQ calc done using co-efficient math & available as virtual torque tables in the tuning tools like the virtual VE tables, but E40 not exposed. Hopefully something simpler compared to E38 E67 floating point math.
Code: Select all
volatile int IATFuel[129] = {128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,254,256,258,260,262,264,266,268,270,272,274,276,278,280,282,284,286,288,290,292,294,296,298,300,302,304,306,308,310,312,314,316,318,320,322,324,326,328,330,332,334,336,338,340,342,344,346,348,350,352,354,356,358,360,362,364,366,368,370,372,374,376,378,380,382,384};
//Comment above and uncomment below for no temp scaling, 256 = 100% or no change
//volatile int IATFuel[129] = {256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256};
//volatile int IATSpark [129] = {128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,254,256,258,260,262,264,266,268,270,272,274,276,278,280,282,284,286,288,290,292,294,296,298,300,302,304,306,308,310,312,314,316,318,320,322,324,326,328,330,332,334,336,338,340,342,344,346,348,350,352,354,356,358,360,362,364,366,368,370,372,374,376,378,380,382,384};
//Comment above and uncomment below for no temp scaling, 256 = 100% or no change
volatile int IATSpark [129] = {256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256};
volatile unsigned long Limiter = 260 ; //Spark cut rev limiter, microseconds per 15 degrees. divide 2,500,000 by this number to get RPM. Limiter is set after rolling average and before being constrained for table access, can be set beyond table limits
volatile unsigned long EOIT [17] = {500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500};// these were test values, also in microseconds, change as needed
// 0 RPM ---------------------------------------------------------------------------9600 RPM same 600 spacing
volatile unsigned long Dstart [17] [17] = { //lower numbers = more advance, numbers are in microseconds
{5954333, 5954333, 5954333, 5954333, 5954333, 5954333, 5954333, 5954333, 5954333, 5954333, 5954333, 5954333, 5954333, 5954333, 5954333, 5954333, 5954333},//"0" RPM
{194611, 194611, 194611, 194611, 194611, 194611, 194611, 194611, 194611, 194611, 194611, 194611, 194611, 194611, 194611, 194611, 194611},// 600
{95305, 95305, 95305, 95305, 95305, 95305, 95305, 95305, 95305, 95305, 95305, 95305, 95305, 95305, 95305, 95305, 95305},// 1200
{61740, 61740, 61740, 61740, 61740, 61740, 61740, 61740, 61740, 61740, 61740, 61740, 61740, 61740, 61740, 61740, 61740},// 1800
{44958, 44958, 44958, 44958, 44958, 44958, 44958, 44958, 44958, 44958, 44958, 44958, 44958, 44958, 44958, 44958, 44958},// 2400
{35166, 35166, 35166, 35166, 35166, 35166, 35166, 35166, 35166, 35166, 35166, 35166, 35166, 35166, 35166, 35166, 35166},// 3000
{28407, 28407, 28407, 28407, 28407, 28407, 28407, 28407, 28407, 28407, 28407, 28407, 28407, 28407, 28407, 28407, 28407},// 3600
{23579, 23579, 23579, 23579, 23579, 23579, 23579, 23579, 23579, 23579, 23579, 23579, 23579, 23579, 23579, 23579, 23579},// 4200
{20131, 20131, 20131, 20131, 20131, 20131, 20131, 20131, 20131, 20131, 20131, 20131, 20131, 20131, 20131, 20131, 20131},// 4800
{17450, 17450, 17450, 17450, 17450, 17450, 17450, 17450, 17450, 17450, 17450, 17450, 17450, 17450, 17450, 17450, 17450},// 5400
{15305, 15305, 15305, 15305, 15305, 15305, 15305, 15305, 15305, 15305, 15305, 15305, 15305, 15305, 15305, 15305, 15305},// 6000
{13424, 13424, 13424, 13424, 13424, 13424, 13424, 13424, 13424, 13424, 13424, 13424, 13424, 13424, 13424, 13424, 13424},// 6600
{11972, 11972, 11972, 11972, 11972, 11972, 11972, 11972, 11972, 11972, 11972, 11972, 11972, 11972, 11972, 11972, 11972},// 7200
{10743, 10743, 10743, 10743, 10743, 10743, 10743, 10743, 10743, 10743, 10743, 10743, 10743, 10743, 10743, 10743, 10743},// 7800
{9591, 9591, 9591, 9591, 9591, 9591, 9591, 9591, 9591, 9591, 9591, 9591, 9591, 9591, 9591, 9591, 9591},// 8400
{8685, 8685, 8685, 8685, 8685, 8685, 8685, 8685, 8685, 8685, 8685, 8685, 8685, 8685, 8685, 8685, 8685},// 9000
{7892, 7892, 7892, 7892, 7892, 7892, 7892, 7892, 7892, 7892, 7892, 7892, 7892, 7892, 7892, 7892, 7892} // 9600
};//low KPA --------------------------------------------------------------------------------- high KPA
volatile unsigned long Iend [17] [17] = { //injector on time, in microseconds
{421, 421, 842, 1263, 1684, 2105, 2526, 2947, 3368, 3789, 4210, 4631, 5052, 5473, 5894, 6315, 6315},//"0" RPM
{421, 421, 842, 1263, 1684, 2105, 2526, 2947, 3368, 3789, 4210, 4631, 5052, 5473, 5894, 6315, 6315},// 600
{421, 421, 842, 1263, 1684, 2105, 2526, 2947, 3368, 3789, 4210, 4631, 5052, 5473, 5894, 6315, 6315},// 1200
{421, 421, 842, 1263, 1684, 2105, 2526, 2947, 3368, 3789, 4210, 4631, 5052, 5473, 5894, 6315, 6315},// 1800
{421, 421, 842, 1263, 1684, 2105, 2526, 2947, 3368, 3789, 4210, 4631, 5052, 5473, 5894, 6315, 6315},// 2400
{421, 421, 842, 1263, 1684, 2105, 2526, 2947, 3368, 3789, 4210, 4631, 5052, 5473, 5894, 6315, 6315},// 3000
{421, 421, 842, 1263, 1684, 2105, 2526, 2947, 3368, 3789, 4210, 4631, 5052, 5473, 5894, 6315, 6315},// 3600
{421, 421, 842, 1263, 1684, 2105, 2526, 2947, 3368, 3789, 4210, 4631, 5052, 5473, 5894, 6315, 6315},// 4200
{421, 421, 842, 1263, 1684, 2105, 2526, 2947, 3368, 3789, 4210, 4631, 5052, 5473, 5894, 6315, 6315},// 4800
{421, 421, 842, 1263, 1684, 2105, 2526, 2947, 3368, 3789, 4210, 4631, 5052, 5473, 5894, 6315, 6315},// 5400
{421, 421, 842, 1263, 1684, 2105, 2526, 2947, 3368, 3789, 4210, 4631, 5052, 5473, 5894, 6315, 6315},// 6000
{421, 421, 842, 1263, 1684, 2105, 2526, 2947, 3368, 3789, 4210, 4631, 5052, 5473, 5894, 6315, 6315},// 6600
{421, 421, 842, 1263, 1684, 2105, 2526, 2947, 3368, 3789, 4210, 4631, 5052, 5473, 5894, 6315, 6315},// 7200
{421, 421, 842, 1263, 1684, 2105, 2526, 2947, 3368, 3789, 4210, 4631, 5052, 5473, 5894, 6315, 6315},// 7800
{421, 421, 842, 1263, 1684, 2105, 2526, 2947, 3368, 3789, 4210, 4631, 5052, 5473, 5894, 6315, 6315},// 8400
{421, 421, 842, 1263, 1684, 2105, 2526, 2947, 3368, 3789, 4210, 4631, 5052, 5473, 5894, 6315, 6315},// 9000
{421, 421, 842, 1263, 1684, 2105, 2526, 2947, 3368, 3789, 4210, 4631, 5052, 5473, 5894, 6315, 6315},// 9600
};//low KPA --------------------------------------------------------------------------------- high KPA
Code: Select all
const uint8_t pattern0 = 0b01111101;//0 degrees 1,6
const uint8_t pattern1 = 0b01110011;//90 degrees 8,5
const uint8_t pattern2 = 0b11000101;//180 degrees 7,4
const uint8_t pattern3 = 0b01000001;//270 degrees 2,3