While it seems like it's just me talking to myself here I wanted to post some progress on this anyway. Between prepping for the holidays, keeping my daughter's car on the road and doing battle with a squirrel that's taken up residence in my attic time has been pretty sparse. Last night I finally managed to find the "forehead slapper" bug in my code that was preventing dwell to happen correctly and collected some more or less successful debugging data while connected to the car.
The first thing I'm finding is that I believe it will be necessary to utilize a separate dwell table for cranking / initial startup.
Code:
ready in: 97ms
cyl=-1
sa=10
dwl=5
lri=451183 << this is the low-res interval - microseconds between low-res rising edge signals (90 degrees of crank rotation)
deg=77
stalled
detect norm, degFalling=55 << sequence detection
sequenced
c7 fire 13 << this is the interrupt routine for the EST line showing which coil is being fired and the degree count (13 btdc here)
cyl=2 << this is signifying the low res rising edge was caught - cyl 2 is now on the compression stroke
sa=13 << detected spark advance from two lines earlier
dwl=5 << dwell requirement from lookup table
lri=230646
deg=0 << this is how many degrees (counting down from 90) were left when the low res rising edge was caught (sometimes this wraps around to 254 and sometimes 1 or 2 are "left over")
c2 dwl 18 18 << this signifies that coil #2 dwell has been commanded - the first number is the desired dwell start and second the actual degree count (btdc) when the routine turned the pin on
c2 fire 13
cyl=1
sa=13
dwl=5
lri=113033
deg=0
c1 dwl 18 18
c1 fire 8 << this is a problem - at this angular velocity we're around 1.3 ms per crankshaft degree so when the ECM commanded 5 degrees less spark advance than the previous cylinder, the dwell time went from 6.5ms to 13ms
cyl=8
The issue here is that the coil might reach it's dwell limiting and fire itself prematurely. That's probably not a problem in this particular instance, but it highlights the need to use a much lower amount of dwell while cranking due to instability of angular velocity. Doing that necessitates a routine to detect when the engine is running that works similar to the ECM so it knows when to switch to the normal dwell table.
The other issue I'm running into is ringing on the EST line. If you recall back on page 13 where vilefly posted waveforms of the EST signal, it wasn't a perfectly clean square wave. Sometimes the microcontroller picks up this ringing when the ECM drives the EST line high and is seen as a falling edge.
Code:
cyl=4
sa=25
dwl=27
lri=18670
deg=0
c4 dwl 52 52
c4 fire 45 << coil fires here @ 45btdc !
c4 fire 45 << more ringing
c4 fire 26 << true falling edge
cyl=3
cyl=8
sa=28
dwl=21
lri=16707
deg=0
c8 fire 53 << ECM begins dwelling the opti's coil before microcontroller does so we'd experience a miss here
c8 fire 29
cyl=4
The second instance can probably be worked around by removing a failsafe I added trying to resolve the bug mentioned earlier. But the first instance is a problem requiring debouncing of this input logically. I have an idea how to accomplish this, but I'd like to do it while keeping the interrupt routines as lightweight as possible.
I'm still hoping to test fire the engine with this before the new year. If I can sort out these two issues (and any others I uncover) my plan is to verify sequence on a running engine by comparing the opti system and mine using a single LS coil and two timing lights. If that works without hiccups I plan to test fire with the coil per cylinder setup temporarily "patched in". But I'm a bit worried there may be many other demons lurking in the details.
Bookmarks