By modifying my 24x code a bit, I think I can do a similar pattern matching setup, for both the crank and cam signals.
58 zeroes followed by a single one. Measure low and high, multiply high by 2 (or bit shift by 1 for 2x, that's faster), same < or > compare. Since the tooth decoded 0 is a different size, RPM/VE math would either skip that tooth, or do different math. I don't like that last part; missing tooth wheels suck. Might do every 3rd tooth, that interval is the same as the missing teeth gap plus 1 normal tooth. My sensor averaging and the majority of loop code relies on that even spacing.
A little more complex if statement for cam, the pattern being a continuous 0011001100110011.
if 00 or 01, cam phase A. if 11 or 10, cam phase B.
Loop code could probably decode cam outside interrupt.
I'll probably throw something out based on the 24x code at some point.
58x ECU
-
AngelMarc
- Posts: 612
- Joined: Sat Apr 08, 2023 11:23 am
- cars: A CB450 running to 8,000RPM with a P59.
58x ECU
You do not have the required permissions to view the files attached to this post.
Last edited by AngelMarc on Fri Jun 20, 2025 11:57 am, edited 4 times in total.
Don't stress specific units.
-
AngelMarc
- Posts: 612
- Joined: Sat Apr 08, 2023 11:23 am
- cars: A CB450 running to 8,000RPM with a P59.
Re: 58x ECU
Yeah, it'll effectively have 20 sensor samples per revolution. Easiest way I can think right now to deal with missing teeth.
That means cylinder pattern match will be async of sensor samples, for V6 full sequential support.
v6...... 20/3 = 6.666666666 .. 60/3 = 20
v8...... 20/4 = 5 ................. 60/4 = 15
V10..... 20/5 = 4 ................ 60/5 = 12 ..... That would be new compared to 24x ECU.
The 24x code already updates sensor data more often than pattern match; so async shouldn't be a big deal.
That means cylinder pattern match will be async of sensor samples, for V6 full sequential support.
v6...... 20/3 = 6.666666666 .. 60/3 = 20
v8...... 20/4 = 5 ................. 60/4 = 15
V10..... 20/5 = 4 ................ 60/5 = 12 ..... That would be new compared to 24x ECU.
The 24x code already updates sensor data more often than pattern match; so async shouldn't be a big deal.
Don't stress specific units.
-
MPC001
- Posts: 174
- Joined: Sat May 05, 2018 11:41 am
Re: 58x ECU
Am sure you will come up with something more efficient @AngelMarc, but this works for me for 58X/4X.
Code: Select all
void loop(){
for (x = 1; x <= 120; x++) {
if ( x <= 58 || x >= 61 && x <= 118 ) {
CRK_ON;
delayMicroseconds(frq1);
CRK_OFF;
delayMicroseconds(frq1);
}
if ( x == 59 || x == 119) {
delayMicroseconds(frq1*4);
}
if (x == 25 || x == 55 || x == 85 || x == 115) {
CAM_ON;
}
if (x == 1 || x == 50 || x == 80 || x == 90) {
CAM_OFF;
}
}
}
-
AngelMarc
- Posts: 612
- Joined: Sat Apr 08, 2023 11:23 am
- cars: A CB450 running to 8,000RPM with a P59.
Re: 58x ECU
Certainly won't use delay().
will be a "n++" though. Probably a few.
Haven't actually started yet.
will be a "n++" though. Probably a few.
Haven't actually started yet.
Don't stress specific units.
-
MPC001
- Posts: 174
- Joined: Sat May 05, 2018 11:41 am
Re: 58x ECU
AngelMarc wrote: Fri Jun 20, 2025 2:01 pm Certainly won't use delay().
will be a "n++" though. Probably a few.
Haven't actually started yet.
-
Denny
- Posts: 71
- Joined: Sun Nov 10, 2024 8:04 pm
- cars: 2007 Chevrolet Silverado 4.8
Re: 58x ECU
Hi AngelMarc. I did not realise the pi pico was programmed with the arduino ide. I have done a lot of CNC controller projects (grbl) with nano's and later esp32's.
I re-read your 24x post and realised what your actually doing. Originally because its raspberry, I though you where creating a Linux PCM.
Really cool project. I am definitely interested in building a 58x PCM.
I re-read your 24x post and realised what your actually doing. Originally because its raspberry, I though you where creating a Linux PCM.
Really cool project. I am definitely interested in building a 58x PCM.
-
AngelMarc
- Posts: 612
- Joined: Sat Apr 08, 2023 11:23 am
- cars: A CB450 running to 8,000RPM with a P59.
Re: 58x ECU
It'll be made... eventually. Need to focus on putting the 24x ECU on an engine and proving it before I spread my focus out too much.
I want it to succeed, and I'm sure that'll be the quickest way to gain traction.
I want it to succeed, and I'm sure that'll be the quickest way to gain traction.
Don't stress specific units.
-
Denny
- Posts: 71
- Joined: Sun Nov 10, 2024 8:04 pm
- cars: 2007 Chevrolet Silverado 4.8
Re: 58x ECU
I understand your point. Thank you for making your code public and sharing.
-
MPC001
- Posts: 174
- Joined: Sat May 05, 2018 11:41 am
Re: 58x ECU
If I may ask, was this trace taken from a running 58X engine or a simulator?
-
AngelMarc
- Posts: 612
- Joined: Sat Apr 08, 2023 11:23 am
- cars: A CB450 running to 8,000RPM with a P59.