Sync Injection Proposal

Official FreeEMS vanilla firmware development, the heart and soul of the system!
Post Reply
socrace
TO220 - Visibile
Posts: 5
Joined: Sat Feb 07, 2009 9:26 pm
Location: Illinois
Contact:

Sync Injection Proposal

Post by socrace »

I have come up with a method that I think is a realistic way to use the Adapt s12X board to manage sync injection and 8 coil ignition on a v8. The key to this is that it's really only necessary to use 2 timers for injection and 2 timers for ignition to manage any arbitrary number of cylinders. Should also work well on odd-fire and wankel engines, or staged injection on 4 cyl engines. Have demonstrated it using a 2mHtz 68hc11, so should work here as well. Not sure how to proceed on this, maybe if anyone's interested in helping adapt this idea to this project? This is my first post here, so apologies if it's the wrong place or method to bring this up.
Bob D
Yet Another EFI Project: http://users.ameritech.net/socrace/Main2.html
User avatar
jharvey
1N4001 - Signed up
Posts: 1607
Joined: Tue Jun 10, 2008 5:17 pm

Re: Sync Injection Proposal

Post by jharvey »

Welcome along, and I'd say your in the right general location. I thought your page sounded familiar then I saw the carbon surprise, and I remembered it.

I'd say there are interested folks here. Sounds like the hardware layout we have so far would lend it's self nicely to this as well. I'm not all that familiar with the PIT timmer, but from what I know it looks like that's very flexible, and may allow so options when it come to multiplexing a timer.
johnsop1
DIP8 - Involved
Posts: 26
Joined: Tue Jan 13, 2009 1:56 am

Re: Sync Injection Proposal

Post by johnsop1 »

I would also like to see what you have done.

Philip
Last edited by johnsop1 on Wed Mar 18, 2009 11:39 pm, edited 1 time in total.
socrace
TO220 - Visibile
Posts: 5
Joined: Sat Feb 07, 2009 9:26 pm
Location: Illinois
Contact:

Re: Sync Injection Proposal

Post by socrace »

The basic idea is to divide crank rotation into firing periods. During any 1 firing period, only 1 injector will be turned off, so that one uses the first timer. All the other injectors are on the second timer.
That's the basic two timer theory.
The code then swaps out injector pins between the 2 timers each period.
Yes, the PIT timers seem good for this, looks like there's 4 of them so they could support all injection and ignition needs.
But, could also use 4 regular compare channels instead, maybe as an alternative method to using them in the regular way (just in case this idea fails, although I don't think it will)?

Bob D
Yet Another EFI Project: http://users.ameritech.net/socrace/Main2.html
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Sync Injection Proposal

Post by Fred »

Thanks for your post Bob, sounds like we have the same plan :-)

The only trouble is that you don't get the accuracy that you would with ECT fuel injection (or ignition). Some people may prefer to use 4 channel semi sequential injection with higher accuracy than have true sequential.

Feel free to post some code or pseudo code and discuss the details of it.

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
socrace
TO220 - Visibile
Posts: 5
Joined: Sat Feb 07, 2009 9:26 pm
Location: Illinois
Contact:

Re: Sync Injection Proposal

Post by socrace »

Hi Fred, guess I should have posted this under "advanced proposals", eh?
Has the group decided on a main timer period yet? Most commercial ecus seem to use anywhere from 2us-8us, to get reasonable pulse widths out of 16bits.
So in that range, thats about 80-320 bus clocks at 40mHtz. If the interrupts can be written to be shorter than 150-650 bus clocks, there's no loss in accuracy at all.
The cpu seems to average about 2 clocks per instruction, so that's anywhere from 75 to 325 lines of machine code, not too bad a target for an interrupt.
But yes, would have to be watched.
Unless xgate was used, of course, then no problemo anymore!
Bob D
socrace
TO220 - Visibile
Posts: 5
Joined: Sat Feb 07, 2009 9:26 pm
Location: Illinois
Contact:

Re: Sync Injection Proposal

Post by socrace »

Here's the demonstration 'HC11 code I was talking about.
Sorry it's assembly, but pretty heavily commented at least.
The first section "determine inj(s) to turn ON" is all that's needed to do sync injection using normal timers.
It's designed for a 4 tooth crank signal on a v8 and fires 4 injector pairs.
It can fire injectors with constant starting angle or constant ending angle, and can handle odd-fire angles between cylinders.
The second section is where the 2-timer action happens.
The subroutine INJ_CMP is where the timers are actually set.
Bob D
Attachments
two_timer_inj.asm.zip
(2.59 KiB) Downloaded 653 times
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Sync Injection Proposal

Post by Fred »

Sorry for the delay Bob... things have been hectic.
socrace wrote:Hi Fred, guess I should have posted this under "advanced proposals", eh?
No need, this is what I consider core functionality, even if it is a bit tricky.
Has the group decided on a main timer period yet? Most commercial ecus seem to use anywhere from 2us-8us, to get reasonable pulse widths out of 16bits.
Currently it is 0.8us IIRC. with 32 bit for input capture using a common technique and 16 bit for output timing, this is more than sufficient period wise.
So in that range, thats about 80-320 bus clocks at 40mHtz. If the interrupts can be written to be shorter than 150-650 bus clocks, there's no loss in accuracy at all.
This neglects the other interrupts that are running and blocking execution thereby causing interrupt start latency and associated inaccuracies. If you use the ECT output then you have specific accuracy, if you bit bang, no matter how cunning you no longer have that accuracy. Sure, if ALL of the interrupts are kept below the timer period and you make the (possibly rash) assumption that no more than one is waiting at any time then it's going to be negligible. I agree that it's a small thing (but not zero) and intend to make sure of that to allow good accuracy of those channels not fired with ECT.
But yes, would have to be watched.
Unless xgate was used, of course, then no problemo anymore!
Actually, still problemo. The xgate code must run from RAM to be full speed. Thus it must be compact or it will displace various features that we need RAM for. Additionally, the xgate threads also block each other, so they need to be short for all the same reasons and then some.
socrace wrote:Here's the demonstration 'HC11 code I was talking about.
Sorry it's assembly, but pretty heavily commented at least.
Thank you very much. I'll try to take a look at that tomorrow. Tonight I didn't get home until 10pm and I'll be up at 530am again tomorrow too. What is the license on this code? If it is any of these that would be excellent :

http://www.gnu.org/licenses/quick-guide ... bility.png

Cheers, Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
socrace
TO220 - Visibile
Posts: 5
Joined: Sat Feb 07, 2009 9:26 pm
Location: Illinois
Contact:

Re: Sync Injection Proposal

Post by socrace »

Ok, 0.8us timer period looks good.
Could possibly assume that there would be no other interrupts..
For example my hc11 code uses only 1 interrupt, to generate a PWM signal (which the S12X does in hardware). Everything else, including serial comms, is done by relying on hardware buffers and checking things within the main program loop before they expire.
So far it looks like the interrupt for the injection and ignition timer would just need one line, to write a bit mask to the port register, to turn off the pins. The rest of the code (the hc11 stuff) all runs in the main program loop.
The code I posted is 100% my work and free, anyone can use it for whatever. Attribution would be appreciated, of course.
Hope things get less hectic for you, I remember back when things got like that for me, next thing was my wife got pregnant..
Bob D
Post Reply