Coding my own open source 24x ECU [beta available]

Disassembly, Reassembly, Tools and devleopment. Going deep with Hardware and Software.
User avatar
AngelMarc
Posts: 612
Joined: Sat Apr 08, 2023 11:23 am
cars: A CB450 running to 8,000RPM with a P59.

Re: Coding my own aftermarket ECU [beta available]

Post by AngelMarc »

Missed a ";" in an "if" that Pico apparently didn't care about.

Code: Select all

   currentOffDelay4 = Scaled3;//On time after off time
    if (RPMTimeavg > 125000){
      Scaled3 = 0; //Fuel off if RPM below minimum = 20RPM
    }
Then a replace all. A space on the end of each of those by the way.
Yes, those visible typos were fixed after copying back to IDE.
Capture.PNG

Then added the "UL" markers on this constraint.

Code: Select all

RPMTimeavg = constrain(RPMTimeavg, 261UL, 125000UL);

Haven't tested yet, but it compiled.
Capture1.PNG

Don't know if it has a 64 bit timer for micros(), so it may be a bad idea without extra work.
You do not have the required permissions to view the files attached to this post.
Last edited by AngelMarc on Tue Jun 24, 2025 11:19 pm, edited 1 time in total.
Don't stress specific units.
User avatar
AngelMarc
Posts: 612
Joined: Sat Apr 08, 2023 11:23 am
cars: A CB450 running to 8,000RPM with a P59.

Re: Coding my own aftermarket ECU [beta available]

Post by AngelMarc »

ohhhh fuck...
Shouldn't have updated original post without testing on Pico.
Luckily I saved a copy. That was before the rev limiter addition.
It'll be a minute.
Last edited by AngelMarc on Mon Jun 16, 2025 12:09 pm, edited 1 time in total.
Don't stress specific units.
User avatar
AngelMarc
Posts: 612
Joined: Sat Apr 08, 2023 11:23 am
cars: A CB450 running to 8,000RPM with a P59.

Re: Coding my own aftermarket ECU [beta available]

Post by AngelMarc »

Fixed. Compiles for Teensy without braking Pico.
Haven't tested teensy and don't plan to any time soon.
the ";".
"UL" in the RPM averaging, rev limiter, and constraint line.
Backup had the rev limiter but not the 20RPM minimum.
Added that to backup.
Double checking those features now.
Don't stress specific units.
User avatar
AngelMarc
Posts: 612
Joined: Sat Apr 08, 2023 11:23 am
cars: A CB450 running to 8,000RPM with a P59.

Re: Coding my own aftermarket ECU [beta available]

Post by AngelMarc »

Rev limiter is broken.
Don't stress specific units.
User avatar
AngelMarc
Posts: 612
Joined: Sat Apr 08, 2023 11:23 am
cars: A CB450 running to 8,000RPM with a P59.

Re: Coding my own aftermarket ECU [beta available]

Post by AngelMarc »

Silver lining, my dumb ass broke it with the low RPM cut earlier.
error.PNG
AI fixed it...
fix.PNG
Didn't add the high RPM fuel cut.
Retested and measured high cut.
highcut.PNG
Low works too. Had to manually count time per division at such low speed.
lowcut.PNG
You do not have the required permissions to view the files attached to this post.
Don't stress specific units.
User avatar
AngelMarc
Posts: 612
Joined: Sat Apr 08, 2023 11:23 am
cars: A CB450 running to 8,000RPM with a P59.

Re: Coding my own aftermarket ECU [beta available]

Post by AngelMarc »

Clearly I need to go back to putting updates in most recent comment and leave the original post alone.
After that test, I updated original post and verified it at least compiles for Teensy.
Don't stress specific units.
User avatar
AngelMarc
Posts: 612
Joined: Sat Apr 08, 2023 11:23 am
cars: A CB450 running to 8,000RPM with a P59.

Re: Coding my own aftermarket ECU [beta available]

Post by AngelMarc »

God damn it. had to fix low RPM fuel cut too.
Don't stress specific units.
User avatar
AngelMarc
Posts: 612
Joined: Sat Apr 08, 2023 11:23 am
cars: A CB450 running to 8,000RPM with a P59.

Re: Coding my own aftermarket ECU [beta available]

Post by AngelMarc »

What a way to start my morning.
But it's fixed, updated original post.
Compiles for Teensy 4.
Capture.PNG
And the constraint for indexing the array was set above zero, to same value I wanted to cut fuel; so it was never "less than".
You do not have the required permissions to view the files attached to this post.
Last edited by AngelMarc on Mon Jun 16, 2025 9:44 am, edited 1 time in total.
Don't stress specific units.
User avatar
AngelMarc
Posts: 612
Joined: Sat Apr 08, 2023 11:23 am
cars: A CB450 running to 8,000RPM with a P59.

Re: Coding my own aftermarket ECU [beta available]

Post by AngelMarc »

Without updating original post, I'm going to look into adding -
"keyed" on off, because just cutting power to fuel or spark causes unpredictable spark timing or lean condition. You'll want to be able to stop without blowing the engine if your throttle sticks open or something, or a nitrous leak, or whatever.
a fuel relay trigger, prime and if engine stops it shuts off, leaky injectors happen. Nobody likes hydrolock.
an alternator trigger, because duh.
and the external correction input for fuel and spark, people like they're widebands. The datalogger I eventually make should be able to calculate a desired difference. And transmission torque reduction, and whatever add-on people might make for some, idk, drag racing timed spark retard/2 step, without needing to make an entire ECU for it.
Last edited by AngelMarc on Tue Jun 17, 2025 10:22 am, edited 1 time in total.
Don't stress specific units.
MPC001
Posts: 174
Joined: Sat May 05, 2018 11:41 am

Re: Coding my own aftermarket ECU [beta available]

Post by MPC001 »

Kudos :thumbup: