kettlekev wrote: ↑
Fri Jan 22, 2021 6:07 pm
Sorry....too many millis and micros.......tune file attached, but measuring again....
1k = 1.6ms on scope - tacho OP
10k = 166us on scope - tacho OP
1k = 60ms on IGN OP
10 k = 6ms on IGN OP
1k = 16.66hz=60ms maths check
10k = 166.6hz = 6ms maths check
SPEEDY IGN TIMING CORRECT!!
Tacho is 37.5 X less/faster on tacho
As promised I took a look at this on my test bench.
Firstly, your tune has the tacho pulse width set to 3ms. As mentioned earlier this is never going to work on a 10,000rpm motor. There just isn't the time available to execute it. What you are likely to be seeing here is the occasional moment when the pulse gets correctly switched, but there will be multiple events missed per crank revolution and the sequence will appear random. This is probably why you see a ratio that is not mathematically linked to the true frequencies.
Just to demonstrate the problem I tested 5000rpm with a tacho pulse width of 3ms. Tacho outputs at 242hz according to my (cheapo) logic analyser.
Checking the result;
5000rpm = 83.3rps
6 cylinder 2 stroke uses 3 ignition channels. Your config has wasted spark but I presume 2 stroke code ignores that.
There should be 3 ignition events per crank rotation.
83.3 * 3 = 250hz
At 5,000rpm each ignition event is 4ms apart (1000/250). With the pulse length at 3ms that's marginal. This is because, as I previously mentioned, the system only checks once every millisecond to see if tacho pulse should be toggled between high and low. And it's usually slightly late due to ignition and fuel interrupts.
I tested the same thing at 10,000rpm. I get no tacho pulses at all. But I don't get any ignition outputs either. I'm not sure what is going on with that; it will need some separate investigation. It seems like as soon as I take it over 10,000rpm (TS figure) it stops generating any outputs. I'm going to have to ignore that for now.
Theoretically though, 10,000rpm calcs are as below.
10000rpm = 166.6rps
166.6*3 = 500 ign events per crank rotation
Each event is going to be 1000/500 = 2ms apart.
Theoretically having the tacho pulse width set at 1ms it should cope, but in fact it won't as that theoretical time doesn't allow for actual processing to occur.
I can get an output at about 9,800rpm but it is not steady; some pulses are twice as long as others. This is pretty much what I'd expect and is what I was getting at earlier. You're at the limits of what the system can generate.
9,800rpm = 163.3rps
163.3 * 3 = 490 events/rotation
Time between events = 2.04ms
That's just about enough to pulse the tacho with 1ms on and 1ms off. But sometimes the system will do a bit more work as certain things such as sensors are read on a different frequency (tps 10hz for example). And then it may not be enough.
To get an accurate pulse at 10,000rpm we'd need to add more resolution to the pulse generator. Currently that is not possible as 1ms is the fastest timer available IIRC. I wrote some code that does it a different way a year or so ago, but it was never included as it generates more interrupts to gain the resolution needed and this was seen as a bit too much.