[rusEfi] frankenstein 0.11 on nissan sr20ve neo vvl #34

Your chance to introduce yourself and your vehicle
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by AndreyB »

matt wrote:writeconfic once after all massages?
Only once. Please post your TunerStudio tune file with your changes for me to try to reproduce your situation.

I am now trying to change the code to make this area more user-friendly. Any ideas how this could become more convinient?
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
matt
donator
donator
Posts: 271
Joined: Fri Aug 26, 2016 11:32 am
Location: Malaysia

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by matt »

i type these massage --->go--->writeconfig
fsio.png
fsio.png (116.89 KiB) Viewed 15939 times
here is my msq after writeconfig in console.

[The extension msq has been deactivated and can no longer be displayed.]

i would suggest if shift light button can be add at engine config. at least if not using shift light, it can be as mivec/vtec/neo vvl on/off solenoid controller. those three engine use same expression solenoid trigger.
matt
donator
donator
Posts: 271
Joined: Fri Aug 26, 2016 11:32 am
Location: Malaysia

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by matt »

found this on internet and might be useful https://wiki.r31skylineclub.com/index.php/Crank_Angle_Sensor

my one probably pattern no 1: inner slot with 8,2,2,2 pattern.
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by AndreyB »

Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by AndreyB »

matt wrote:found this on internet and might be useful https://wiki.r31skylineclub.com/index.php/Crank_Angle_Sensor

my one probably pattern no 1: inner slot with 8,2,2,2 pattern.
What is this about exactly? I've probably lost context. Is that the pattern you have and you want it added? What vehicle again exaclt / what should we call it? Just want to make sure we are talking about the same thing.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
matt
donator
donator
Posts: 271
Joined: Fri Aug 26, 2016 11:32 am
Location: Malaysia

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by matt »

this screenshoot claim taken from Haltech IIRC
Cas_nissan_sensor2.gif
Cas_nissan_sensor2.gif (40.94 KiB) Viewed 15921 times
there is three pattern in nissan 360/4 slot. my one is Pattern number 1.
Cas_nissan_waveform.gif
Cas_nissan_waveform.gif (24.34 KiB) Viewed 15921 times
this probably pattern number 3.

And yes.. if you would like to add this pattern, i can be a lab rat. :D
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by AndreyB »

I am sorry I do not follow, I am confused (mostly because I lose focus too often)

Back in march https://rusefi.com/forum/viewtopic.php?f=3&t=1194&start=30#p24494 we've seen to get your Nissan trigger working. Does it currently work? Is that Nissan trigger?

Why do we need to change something?

I see that the code says 15,5,5,5. Do you think that 15,5,5,5 is not precise and that's us guessing? Do you think the real values are 16,4,4,4?
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
matt
donator
donator
Posts: 271
Joined: Fri Aug 26, 2016 11:32 am
Location: Malaysia

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by matt »

I mean it could be better if add the 360 slot. Currently I running with Speeduino with 360 slot add. I modified little bit about inner slot calculation base on above attachment.

Here is 360/ 4-8-12-16 pattern write by Josh.

void triggerSetup_Nissan360()
{
triggerFilterTime = (1000000 / (MAX_RPM / 60 * 360UL)); //Trigger filter time is the shortest possible time (in uS) that there can be between crank teeth (ie at max RPM). Any pulses that occur faster than this time will be disgarded as noise
triggerSecFilterTime = (int)(1000000 / (MAX_RPM / 60 * 2)) / 2; //Same as above, but fixed at 2 teeth on the secondary input and divided by 2 (for cam speed)
secondaryToothCount = 0; //Initially set to 0 prior to calculating the secondary window duration
secondDerivEnabled = false;
decoderIsSequential = true;
toothCurrentCount = 1;
triggerToothAngle = 2;
MAX_STALL_TIME = (3333UL * triggerToothAngle); //Minimum 50rpm. (3333uS is the time per degree at 50rpm)
}


void triggerPri_Nissan360()
{
curTime = micros();
curGap = curTime - toothLastToothTime;
//if ( curGap < triggerFilterTime ) { return; }
toothCurrentCount++; //Increment the tooth counter
//addToothLogEntry(curGap); Disable tooth logging on this decoder due to overhead

toothLastMinusOneToothTime = toothLastToothTime;
toothLastToothTime = curTime;

if ( currentStatus.hasSync == true )
{
if ( toothCurrentCount == 361 ) //2 complete crank revolutions
{
toothCurrentCount = 1;
toothOneMinusOneTime = toothOneTime;
toothOneTime = curTime;
currentStatus.startRevolutions++; //Counter
}
//Recalc the new filter value
//setFilter(curGap);

//EXPERIMENTAL!
if(configPage1.perToothIgn == true)
{
int16_t crankAngle = ( (toothCurrentCount-1) * 2 ) + configPage2.triggerAngle;
//if(crankAngle > CRANK_ANGLE_MAX_IGN) { crankAngle -= CRANK_ANGLE_MAX_IGN; }
//if(crankAngle < CRANK_ANGLE_MAX_IGN) {
doPerToothTiming(crankAngle);
}

timePerDegree = curGap >> 1;; //The time per crank degree is simply the time between this tooth and the last one divided by 2
}
}

void triggerSec_Nissan360()
{
curTime2 = micros();
curGap2 = curTime2 - toothLastSecToothTime;
//if ( curGap2 < triggerSecFilterTime ) { return; }
toothLastSecToothTime = curTime2;
//OPTIONAL: Set filter at 25% of the current speed
//triggerSecFilterTime = curGap2 >> 2;


//Calculate number of primary teeth that this window has been active for
byte trigEdge;
if(configPage2.TrigEdgeSec == 0) { trigEdge = LOW; }
else { trigEdge = HIGH; }

if( (secondaryToothCount == 0) || (READ_SEC_TRIGGER() == trigEdge) ) { secondaryToothCount = toothCurrentCount; } //This occurs on the first rotation upon powerup OR the start of a secondary window
else
{
//If we reach here, we are at the end of a secondary window
byte secondaryDuration = toothCurrentCount - secondaryToothCount; //How many primary teeth have passed during the duration of this secondary window

if(currentStatus.hasSync == false)
{
if(configPage1.nCylinders == 4)
{
if( (secondaryDuration >= 15) && (secondaryDuration <= 17) ) //Duration of window = 16 primary teeth
{
toothCurrentCount = 16; //End of first window (The longest) occurs 16 teeth after TDC
currentStatus.hasSync = true;
}
else if( (secondaryDuration >= 11) && (secondaryDuration <= 13) ) //Duration of window = 12 primary teeth
{
toothCurrentCount = 102; //End of second window is after 90+12 primary teeth
currentStatus.hasSync = true;
}
else if( (secondaryDuration >= 7) && (secondaryDuration <= 9) ) //Duration of window = 8 primary teeth
{
toothCurrentCount = 188; //End of third window is after 90+90+8 primary teeth
currentStatus.hasSync = true;
}
else if( (secondaryDuration >= 3) && (secondaryDuration <= 5) ) //Duration of window = 4 primary teeth
{
toothCurrentCount = 274; //End of fourth window is after 90+90+90+4 primary teeth
currentStatus.hasSync = true;
}
else { currentStatus.hasSync = false; } //This should really never happen
}
else if(configPage1.nCylinders == 6)
{
//Pattern on the 6 cylinders is 4-8-12-16-12-8
//We can therefore only get sync on the 4 and 16 pulses as they are the only unique ones
if( (secondaryDuration >= 15) && (secondaryDuration <= 17) ) //Duration of window = 16 primary teeth
{
toothCurrentCount = 136; //End of third window is after 60+60+16 primary teeth
currentStatus.hasSync = true;
}
else if( (secondaryDuration >= 3) && (secondaryDuration <= 5) ) //Duration of window = 4 primary teeth
{
toothCurrentCount = 304; //End of sixth window is after 60+60+60+60+60+4 primary teeth
currentStatus.hasSync = true;
}
}
else { currentStatus.hasSync = false; } //This should really never happen (Only 4 and 6 cylinder engines for this patter)
}
else
{
if (configPage2.useResync == true)
{
//Already have sync, but do a verify every 720 degrees.
if(configPage1.nCylinders == 4)
{
if( (secondaryDuration >= 15) && (secondaryDuration <= 17) ) //Duration of window = 16 primary teeth
{
toothCurrentCount = 16; //End of first window (The longest) occurs 16 teeth after TDC
}
}
else if(configPage1.nCylinders == 6)
{
if(secondaryDuration == 4)
{
toothCurrentCount = 304;
}
} //Cylinder count
} //use resync
} //Has sync
} //First getting sync or not
}

uint16_t getRPM_Nissan360()
{
//Can't use stdGetRPM as there is no separate cranking RPM calc (stdGetRPM returns 0 if cranking)
uint16_t tempRPM;
if( (currentStatus.hasSync == true) && (toothLastToothTime != 0) && (toothLastMinusOneToothTime != 0) )
{
if(currentStatus.startRevolutions < 2)
{
noInterrupts();
revolutionTime = (toothLastToothTime - toothLastMinusOneToothTime) * 180;
interrupts();
}
else
{
noInterrupts();
revolutionTime = (toothOneTime - toothOneMinusOneTime) >> 1; //The time in uS that one revolution would take at current speed (The time tooth 1 was last seen, minus the time it was seen prior to that)
interrupts();
}
tempRPM = (US_IN_MINUTE / revolutionTime); //Calc RPM based on last full revolution time (Faster as /)
if(tempRPM >= MAX_RPM) { tempRPM = currentStatus.RPM; } //Sanity check
MAX_STALL_TIME = revolutionTime << 1; //Set the stall time to be twice the current RPM. This is a safe figure as there should be no single revolution where this changes more than this
}
else { tempRPM = 0; }

return tempRPM;
}

int getCrankAngle_Nissan360(int timePerDegree)
{
//As each tooth represents 2 crank degrees, we only need to determine whether we're more or less than halfway between teeth to know whether to add another 1 degrees
int crankAngle = 0;
int tempToothLastToothTime;
int tempToothLastMinusOneToothTime;
int tempToothCurrentCount;

noInterrupts();
tempToothLastToothTime = toothLastToothTime;
tempToothLastMinusOneToothTime = toothLastMinusOneToothTime;
tempToothCurrentCount = toothCurrentCount;
interrupts();

crankAngle = ( (tempToothCurrentCount - 1) * 2) + configPage2.triggerAngle;
unsigned long halfTooth = (tempToothLastToothTime - tempToothLastMinusOneToothTime) >> 1;
if ( (micros() - tempToothLastToothTime) > halfTooth)
{
//Means we're over halfway to the next tooth, so add on 1 degree
crankAngle += 1;
}

if (crankAngle >= 720) { crankAngle -= 720; }
if (crankAngle > CRANK_ANGLE_MAX) { crankAngle -= CRANK_ANGLE_MAX; }
if (crankAngle < 0) { crankAngle += 360; }

return crankAngle;
}

void triggerSetEndTeeth_Nissan360()
{
//This uses 4 prior teeth, just to ensure there is sufficient time to set the schedule etc
ignition1EndTooth = ( (ignition1EndAngle - configPage2.triggerAngle) / 2 ) - 4;
ignition2EndTooth = ( (ignition2EndAngle - configPage2.triggerAngle) / 2 ) - 4;
ignition3EndTooth = ( (ignition3EndAngle - configPage2.triggerAngle) / 2 ) - 4;
ignition4EndTooth = ( (ignition4EndAngle - configPage2.triggerAngle) / 2 ) - 4;
}
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by AndreyB »

russian wrote:I see that the code says 15,5,5,5. Do you think that 15,5,5,5 is not precise and that's us guessing? Do you think the real values are 16,4,4,4?
Yes? No? :)
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
matt
donator
donator
Posts: 271
Joined: Fri Aug 26, 2016 11:32 am
Location: Malaysia

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by matt »

Sorry. I don't know the correct answer. If you can change the code to 16-4-4-4 I can test and feel it how it goes.
Abricos
contributor
contributor
Posts: 849
Joined: Mon Aug 18, 2014 12:32 am
Location: Carteret, NJ 07008

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by Abricos »

matt wrote:Sorry. I don't know the correct answer. If you can change the code to 16-4-4-4 I can test and feel it how it goes.
lol
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by AndreyB »

firmware 20180101 is now 16-4-4-4. Please try to confirm it even runs.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
matt
donator
donator
Posts: 271
Joined: Fri Aug 26, 2016 11:32 am
Location: Malaysia

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by matt »

Thanks!!
I will do ecu setup (AFR/ignitions) by this week. If got chance and extra $$$ will do dyno again by next week. This time will be 3 ecu comparison. OEM vs Rusefi vs Speeduino.
Abricos
contributor
contributor
Posts: 849
Joined: Mon Aug 18, 2014 12:32 am
Location: Carteret, NJ 07008

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by Abricos »

matt wrote:Thanks!!
I will do ecu setup (AFR/ignitions) by this week. If got chance and extra $$$ will do dyno again by next week. This time will be 3 ecu comparison. OEM vs Rusefi vs Speeduino.
ecu . OEM winer ...))))
matt
donator
donator
Posts: 271
Joined: Fri Aug 26, 2016 11:32 am
Location: Malaysia

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by matt »

Abricos wrote: ecu . OEM winer ...))))
I'am sure not. At rpm5000 i can feel it cut something, probably fuel. No neo vvl engage if not install with oem rpm meter.
If do convertion on this engine without complete wiring harness better go to standalone ecu.
kezzab25
Posts: 1
Joined: Sat Apr 14, 2018 1:05 am

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by kezzab25 »

How do I select the 360 tooth wheel in Tunerstudio?
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by AndreyB »

kezzab25 wrote:
Sat Apr 14, 2018 1:06 am
How do I select the 360 tooth wheel in Tunerstudio?
Nissan 360 wheel was not yet implemented. Skipped wheel 360 is not what you are looking for.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
matt
donator
donator
Posts: 271
Joined: Fri Aug 26, 2016 11:32 am
Location: Malaysia

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by matt »

Hi.

Still negative on setting up shift light. Picture attach what I'm doing.
rusefi.shiftlight.jpg
rusefi.shiftlight.jpg (205.95 KiB) Viewed 15102 times
theflyingdutchp
Posts: 109
Joined: Wed May 18, 2016 11:03 pm

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by theflyingdutchp »

matt wrote:
Wed Oct 03, 2018 7:19 am
Hi.

Still negative on setting up shift light. Picture attach what I'm doing.
Hey mate I'm definitely not an expert on this controller by any means, but I think you need to pick commands 1, 2, and 3 OR 1, 2, 4, and 5.

To me it looks like command 4 would overwrite command 3 and then command 5 sets the value of the variable setup in command 4 (fsio_setting(3)) I suppose if the code is bug-less it shouldn't matter, but it can't hurt to be a little more careful.

Does it work in simulation? Have you physically confirmed that your light works? How is it wired to RusEfi? If you've answered these questions earlier in the thread, well sorry for asking again! :?
88 Camry Alltrac - 3SFE w/ CT26.
Ran ok, but rings are fried, moved on...
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: frankenstein 0.11 on nissan sr20ve neo vvl #34

Post by AndreyB »

theflyingdutchp wrote:
Thu Oct 04, 2018 9:50 pm
but I think you need to pick commands 1, 2, and 3 OR 1, 2, 4, and 5.
Yes. Please try just 1, 2, and 3 with writeconfig first
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
Post Reply