[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 258: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 320: mysqli_free_result(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4433: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3315)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4433: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3315)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4433: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3315)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4433: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3315)
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 258: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 320: mysqli_free_result(): Couldn't fetch mysqli_result
rusefi.com • Question- Ignition timing logic
Page 1 of 1

Question- Ignition timing logic

Posted: Wed Oct 01, 2025 4:44 pm
by Mykk
I have a Mega100 STM32F4 on a Speeduino UA4C running a supercharged BMW V8 in paired cylinder injection and COP waste spark.


Image



I like to keep current on the latest firmware releases so this is on "rusEFI main.2025.09.29.mega100.3980904453"

Perhaps this has been covered already and I couldn't find it. During a datalog something caught my attention on the per cylinder ignition timing. Arranging the channels by firing order I was expecting to see the ignition timing update 1 by 1 in order. They didn't

Image

Arrange the channels by Ignition Channel # instead of cylinder firing order, now the ignition timing does update in order and you can watch the timing cascade down as the frames are advancing like I was originally expecting by firing order.


Image

I can verify the system does indeed repeat the 4 fuel and 4 ignition channels in order every 360 degrees. Which is why I found it odd that cyl/channels 5-6-7-8 are still updating.

If I view channels 1-2-3-4 it appears the system still uses 720 degree's to update the four channels rather than 360 degrees:

Image

This means, depending where in the cycle the ignition timing change occurs it'll update 2 or 3 channels, a gap as the 2nd crank rotation occurs, then update the remaining channels. If the timing change occurs at the beginning of a cycle it'll update the 4 channels, pause for the 2nd crank rotation and then update the 4 channels.

In the best case scenario the reporting in the log is inaccurate and the cylinders are actually updating in firing order as the system is using the data from the first 4 cylinders and the last 4 cylinders while is cycling them every 360 degrees.

In the worst case scenario the data in the log is correct and the ignition timing doesn't update in firing order and skips revolutions.

As an experiment I did tell the system to run a 2-stroke 4 cylinder, although I couldn't get a 1-2-3-4 firing order to match the ignition channel output order. I used 1-2-4-3 as close enough to test.

On a datalog the 4 channels updating in order every 360 degrees looks like this:

Image


The idle is smoother, the exhaust note changed and the engine is bit more rev happy. So something has appeared to change physically in this test.

If a dev familiar with the ignition timing logic in the system could help me verify what is actually happening, I'd truly appreciate it. Thanks!

Re: Question- Ignition timing logic

Posted: Wed Oct 01, 2025 4:48 pm
by AndreyB
What is a one line summary of your question?

What is a three line summary of your question?

Please attach relevant tune and logs.

Re: Question- Ignition timing logic

Posted: Wed Oct 01, 2025 9:52 pm
by Mykk
Does the ignition timing update by firing order, or by channel order? The log suggests it's by channel order

In waste spark does each channel update every 720 degrees or 360 degrees of crank rotation? The log suggests it's 720 degrees

Re: Question- Ignition timing logic

Posted: Wed Oct 01, 2025 11:00 pm
by AndreyB
Mykk wrote:
Wed Oct 01, 2025 9:52 pm
Does the ignition timing update by firing order, or by channel order? The log suggests it's by channel order
you have access to source code. What is https://xyproblem.info/?

Re: Question- Ignition timing logic

Posted: Wed Oct 01, 2025 11:02 pm
by AndreyB
What I am wonder is: why would anyone care? Is something broken? Is something asking to be improved?

Re: Question- Ignition timing logic

Posted: Wed Oct 01, 2025 11:36 pm
by Mykk
I don't know code.

ignition timing updating not in firing order means some cylinders will have new data and some will have old data, right? So if the ignition timing request jumps from 10 degrees to 18 degrees it could look like one cylinder would get 18, the next would get 10, next 10, next 18, next 10, next 18....etc.... Right?

The same said for channels that update with 720 degrees while in waste spark.... some cylinders will have old data and some will have new data....right?

If this is actually what's happening, I don't know the code solution. The only way I'd know how is that every engine would have 1-2-3-4, 1-2-3-4-5-6, 1-2-3-4-5-6-7-8 firing orders in the tune and then the wiring or the pin assignments changed to match firing order.

Re: Question- Ignition timing logic

Posted: Thu Oct 02, 2025 12:04 am
by AndreyB
Mykk wrote:
Wed Oct 01, 2025 11:36 pm
if the ignition timing request jumps from 10 degrees to 18 degrees it could look like one cylinder would get 18, the next would get 10, next 10, next 18, next 10, next 18....etc.... Right?
Does not look like a real concern to me?

You use an emotionally loaded "jumps" followed by a pretty unrealistic change of 8 degrees between two consecutive revolutions? While I would assume that in reality it's much closer to 0.8 or 0.08 degrees?

Re: Question- Ignition timing logic

Posted: Thu Oct 02, 2025 7:35 am
by Dron_Gus
Sorry I did not see timescale on your screenshots. And dont know RPM.
Few things:
1. update (re-calculation) of ignition advance happens 200 times per second. in periodicFastCallback()
So you should see smooth change of ignition advance... until you have some input(s) that changes rapidly
2. MAP is sampled for each cylinder. See "MAP sampling" under Sensor menu.

Re: Question- Ignition timing logic

Posted: Thu Oct 02, 2025 11:53 pm
by Mykk
I'm happy to say that upon further channel digging in the datalog I found the answer I was looking for, it's exactly the outcome I was hoping for.

Image

The ignition timing in the log updates by channel number, however the 'Ignition Event Counter by Cylinder" updates by firing order.
Channel vs Ign Cylinder Count event:
1 = 1
2 = 5
3 = 4
4 = 8
5 = 1
6 = 5
7 = 4
8 = 8
The ignition timing does update by firing order, and for waste spark it also completes it's cycle in 360 degrees. Thank you.