Page 1 of 2

Harley Requirements

Posted: Sun Oct 31, 2021 6:47 pm
by nmstec
Will update as I remember more things

Software side:
Support 45* firing angle
Automatic Compression Release (Activates two solenoids upon crank, until minimum engine RPM is reached)
Enable/Disable support for Traction control
Emulation of CAN data
Boost by Gear
Play nice with OEM immobilizer

Hardware side:
PnP to two different types (3 connector & 1 Connector)
Built in igniter, with option to bypass to regular coil (common upgrade)
Dual Wideband (must be built in, and have external wires for it. Original bikes do not come with it. See picture below)
Additional connector with 2hi & 2lo outputs, and 4 Analogue inputs. (For boost control for example, and ride height)

Re: Harley Requirements

Posted: Mon Nov 01, 2021 4:20 am
by AndreyB
45:
we have
image.png
image.png (24.63 KiB) Viewed 64827 times
but we need same for injection phase https://github.com/rusefi/rusefi/issues/3441

compression: https://github.com/rusefi/rusefi/issues/3442

Emulation of CAN data, Play nice with OEM immobilizer: need way more data :) open Q if Play nice with OEM immobilizer is even possible

Boost by Gear: what kind of gear sensor do you have? https://github.com/rusefi/rusefi/issues/3007

Re: Harley Requirements

Posted: Mon Nov 01, 2021 5:23 am
by nmstec
I'll work on the Can-bus stuff.

The Boost by gear can be calculated the usual way most bikes, including harleys do, RPM & VSS.

Re: Harley Requirements

Posted: Fri Nov 05, 2021 7:29 pm
by AndreyB
Making progress on small test board for 18 pin connector.

Need help: can you please take a picture of the front of ECU and mark which pin is "1" and which one is "9"? Do they go 1 to 18 or A to R or what convention does HD use on wiring diagrams?

Do you by any chance have a picture of a naked PCB without case? No worries if you do not have it.

Re: Harley Requirements

Posted: Fri Nov 05, 2021 7:38 pm
by nmstec
<3

Re: Harley Requirements

Posted: Fri Nov 05, 2021 7:54 pm
by nmstec
<3 2

Re: Harley Requirements

Posted: Fri Nov 05, 2021 8:12 pm
by nmstec
3 pin ECU cut apart. Literally. Nice of them to leave jtag header on it.

This is OEM ecu, and not ThunderMax

Also single pin 81, OEM.

Also close ups on the 3 connector ECU. All photos taken in the same orientation with the connector on the left side.

https://github.com/rusefi/rusefi_documentation/tree/master/OEM-Docs/Harley/photos

Re: Harley Requirements

Posted: Thu Nov 11, 2021 5:45 pm
by AndreyB
Injection phase https://github.com/rusefi/rusefi/issues/3441 not critical for first start

Re: Harley Requirements

Posted: Sun Nov 14, 2021 5:12 pm
by nmstec
HD 32-2Known applications include:•Harley Davidson with 32-2 crank triggerA VR sensor is used on the crank trigger. As standard there is no cam sensor. Phase detection is possible using
the MAP sensor.Typical settings:Spark mode = HD 32-2Trigger angle/offset = 0 (adjust with strobe)Ignition input capture = Set according to whichever edge gives the most stable signal. (If timing advances with
RPM, try flipping it.)Spark output = Going highCam sensor = MAPThe front cylinder is considered cyl#1 and therefore connects to SpkA. Sequential fuel is allowed.

Re: Harley Requirements

Posted: Sun Nov 14, 2021 5:16 pm
by AndreyB

Re: Harley Requirements

Posted: Sun Nov 14, 2021 10:31 pm
by AndreyB
Compression Release is now done in Lua

See https://github.com/rusefi/rusefi/issues/3442 for script

Re: Harley Requirements

Posted: Sat Nov 20, 2021 5:40 pm
by AndreyB
Shall we tell Mark that Harley shares 81 pin connector with Lada Samara? Really hope there is not a single overlapping pin in the pinout :)

Re: Harley Requirements

Posted: Sun Nov 21, 2021 2:00 am
by nmstec
Will need internal IGBT driver. Much importance. Very importance.

Re: Harley Requirements

Posted: Sun Nov 21, 2021 2:35 am
by nmstec
Needs proper power in constant to drive IGBTs, oxygen sensor heaters, and decently high current solenoids.
The way motorcycles usually work is they have an ignition switch to power up all the electronics, and then a kill switch as well, to power up injectors and fuel pump.

In harleys case, kill switch is canbus controlled. no biggy as BCm also supplies a "ign" signal to the ecu and injectors. however on harleys the BCM also wants to hear the ECU talking. Not possible if kill switch is on.

Re: Harley Requirements

Posted: Sun Nov 21, 2021 2:54 am
by nmstec
Fucking harley also uses PWM controlled fans... depending on model, some have no fan, some have oil fan, some have oil & coolant fan... Fucking stupidity.


Some models... also have a water pump... because a few models have... water cooling heads.... Jesus.

Re: Harley Requirements

Posted: Sun Nov 21, 2021 2:14 pm
by AndreyB
Damn is official wiring diagram unreadable for everyone or just me?
I've clicked at https://serviceinfo.harley-davidson.com/sip/content/document/view?id=1463966551648382215 and selected police model.
Main harness ECM pinouts is blurry or jpeg?
image.png
image.png (235.85 KiB) Viewed 64024 times

Re: Harley Requirements

Posted: Sun Nov 21, 2021 7:59 pm
by nmstec
Click on "view interactive image".

Re: Harley Requirements

Posted: Sun Nov 21, 2021 9:12 pm
by nmstec
Limited RE so far:
500kbaud
ALL PACKETS IN THIS POST ARE FROM ECU ONLY.

543 - zz xx yy ww ss tt qq rr
zz - 13
xx - stays at 57 on no APP, then increases slightly till 10% and stays at 61 (57 58 59 .. 61)
yy - 13
ww -46-47
ss - APP position 00 - 0% c7 - 100%
tt - e8
qq- counter 40 -> 7f
rr - checksum (j1850 SAE crc8) http://www.sunshine2k.de/coding/javascript/crc/crc_js.html
15ms

542 - zz xx yy ww ss tt qq rr
zz 20 CC off - 60 CC ON
xx - a2 kill, 82 unkill,c2 crank, c0 run - e0 - a0 "kill while running" / 40 RUN WITH NO MIL? / 42 CRANK WITH NO errors?
yy - 81
ww - d9
ss -00
tt - 00
qq - 00
rr - 00
50ms

541
zz - RPM
xx - RPM
yy - 00
ww - 00
ss - 00
tt - temp? looks like in plain hex to C* - 0x45 = 45C?
qq - 00
rr -ff
15ms

544
0e ca 40 ff ca 00 00 00 static
50ms

540
zz - 00
xx - 00
yy - 5a
ww - 4c
ss - ff
tt - 00
qq - COUNTER TIME? low
rr -COUNTER TIME? high (resets upon ign off. Runs only when engine running. 1 byte per every 250ms it seems? will have to confirm later with timing)
200ms

502
01 (keep alive WHEN AWAKE) 00 (Tell rest of bike you about to sleep. Then go to sleep)
1000ms

546
35 48 44 31 46 48 (1-6 vin)
1000ms

547
50 41 31 4b 42 36 (7-12 vin)
1000ms

548
33 34 38 32 32 00 (13 -17 vin)
1000ms

Re: Harley Requirements

Posted: Sun Nov 21, 2021 9:16 pm
by nmstec
logs.

Re: Harley Requirements

Posted: Mon Nov 22, 2021 6:01 pm
by AndreyB

Re: Harley Requirements

Posted: Thu Nov 25, 2021 4:59 am
by nmstec

Code: Select all

outputIndex = 0
startPwm(outputIndex, 100, 0)

rpmLimitSetting = findSetting("compReleaseRpm", 300)
compReleaseDulationLimit = findSetting("compReleaseDur", 6000)

every200msTimer = Timer.new();
everySecondTimer = Timer.new();
every50msTimer = Timer.new();
offCounter = 0
-- cranking!
packet542 = {0x20, 0x82, 0x81, 0xd9, 0x00, 0x00, 0x00, 0x00}
packet543 = {0x13, 0x57, 0x13, 0x45, 0x00, 0xe8, 0x00, 0x00}
packet541 = {0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0xFF}

-- every 200ms
packet540 = {0x00, 0x00, 0x5a, 0x4c, 0xff, 0x00, 0x00, 0x00}

-- every 1000ms
packet502 = {0x01}
packet546 = {0x35, 0x48, 0x44, 0x31, 0x46, 0x48}
packet547 = {0x50, 0x41, 0x31, 0x4b, 0x42, 0x36}
packet548 = {0x33, 0x34, 0x38, 0x32, 0x32, 0x00}

counter543 = 0;
setTickRate(66);


canRxAdd(0x570)
canRxAdd(0x500)

function onCanRx(bus, id, dlc, data)
  --print('got CAN id=' .. id .. ' dlc='  .. dlc)
  id11=id%2048

if id11 == 0x500 then --Check can state of BCM
    canState = data[1]
if canState == 01 then
    packet502[1] = 0x01
else
    packet502[1] = 0x00
end
if id11 == 0x570 then
    curState = data[1]

if curState == 06 then -- Cranking TODO: MUST ONLY DO THIS ON RPM TILL STARt
packet542[2] =  0x82
end

if curState == 04 then -- Kill off
packet542[2] =  0x82
end

if curState == 01 then -- Kill
packet542[2] =  0xA2
end
end
end
	


end
function onTick()
 
    if packet502[1] == 01 then
    offCounter = 0
 counter543 = (counter543 + 1) % 64
    packet543[7] = 64 + counter543
    packet543[8] = crc8_j1850(packet543, 7)
    APP = getSensor("AcceleratorPedal") 
    if APP == nil then
        packet543[5] = 0
    
else
    packet543[5] = APP *2
end
 
    txCan(1, 0x543, 0, packet543)
	txCan(1, 0x541, 0, packet541)
   
    if every200msTimer:getElapsedSeconds() > 0.2 then
       every200msTimer:reset();
       txCan(1, 0x540, 0, packet540)
    end

    if every50msTimer:getElapsedSeconds() > 0.05 then
       every50msTimer:reset();
	txCan(1, 0x542, 0, packet542)
end
	
    if everySecondTimer:getElapsedSeconds() > 1 then
       everySecondTimer:reset();
       txCan(1, 0x502, 0, packet502)
       txCan(1, 0x546, 0, packet546)
       txCan(1, 0x547, 0, packet547)
       txCan(1, 0x548, 0, packet548)
    end


	rpm = getSensor("RPM")
	rpm = (rpm == nil and 0 or rpm)
    --print('Rpm ' .. rpm)
	--print('getTimeSinceTriggerEventMs ' .. getTimeSinceTriggerEventMs())
	enableCompressionReleaseSolenoid = getTimeSinceTriggerEventMs() < compReleaseDulationLimit and rpm < rpmLimitSetting
    duty = enableCompressionReleaseSolenoid and 100 or 0
    print("Compression release solenoid " .. duty)
    setPwmDuty(outputIndex, duty)
else
    if offCounter == 0 then --goodbye sweet love, and fuck you
    txCan(1, 0x502, 0, packet502) --goodbye
    offCounter = 1 --One shot 
    end

end
end

Re: Harley Requirements

Posted: Thu Nov 25, 2021 2:10 pm
by AndreyB
Mark, I've formatted the code manually and I think you have a bug in can handler - it becomes obvious once you format the code.

Code: Select all

  if id11 == 0x500 then --Check can state of BCM
    canState = data[1]
    if canState == 01 then
      packet502[1] = 0x01
    else
      packet502[1] = 0x00
    end
    if id11 == 0x570 then
      curState = data[1]
      if curState == 06 then -- Cranking TODO: MUST ONLY DO THIS ON RPM TILL STARt
        packet542[2] =  0x82
      end
note how id11 == 0x570 check is within id11 == 0x500, so it's never executing? I could be wrong

Full script with formatting:

Code: Select all

outputIndex = 0
startPwm(outputIndex, 100, 0)

rpmLimitSetting = findSetting("compReleaseRpm", 300)
compReleaseDulationLimit = findSetting("compReleaseDur", 6000)

every200msTimer = Timer.new();
everySecondTimer = Timer.new();
every50msTimer = Timer.new();
offCounter = 0
-- cranking!
packet542 = {0x20, 0x82, 0x81, 0xd9, 0x00, 0x00, 0x00, 0x00}
packet543 = {0x13, 0x57, 0x13, 0x45, 0x00, 0xe8, 0x00, 0x00}
packet541 = {0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0xFF}

-- every 200ms
packet540 = {0x00, 0x00, 0x5a, 0x4c, 0xff, 0x00, 0x00, 0x00}

-- every 1000ms
packet502 = {0x01}
packet546 = {0x35, 0x48, 0x44, 0x31, 0x46, 0x48}
packet547 = {0x50, 0x41, 0x31, 0x4b, 0x42, 0x36}
packet548 = {0x33, 0x34, 0x38, 0x32, 0x32, 0x00}

counter543 = 0;
setTickRate(66);


canRxAdd(0x570)
canRxAdd(0x500)

function onCanRx(bus, id, dlc, data)
  --print('got CAN id=' .. id .. ' dlc='  .. dlc)
  id11 = id % 2048

  if id11 == 0x500 then --Check can state of BCM
    canState = data[1]
    if canState == 01 then
      packet502[1] = 0x01
    else
      packet502[1] = 0x00
    end
    if id11 == 0x570 then
      curState = data[1]
      if curState == 06 then -- Cranking TODO: MUST ONLY DO THIS ON RPM TILL STARt
        packet542[2] =  0x82
      end
      if curState == 04 then -- Kill off
        packet542[2] =  0x82
      end
      if curState == 01 then -- Kill
        packet542[2] =  0xA2
      end
    end
  end
end


function onTick()
 
  if packet502[1] == 01 then
    offCounter = 0
    counter543 = (counter543 + 1) % 64
    packet543[7] = 64 + counter543
    packet543[8] = crc8_j1850(packet543, 7)
    APP = getSensor("AcceleratorPedal") 
    if APP == nil then
      packet543[5] = 0
    else
      packet543[5] = APP *2
    end
 
    txCan(1, 0x543, 0, packet543)
	txCan(1, 0x541, 0, packet541)
   
    if every200msTimer:getElapsedSeconds() > 0.2 then
       every200msTimer:reset();
       txCan(1, 0x540, 0, packet540)
    end

    if every50msTimer:getElapsedSeconds() > 0.05 then
       every50msTimer:reset();
	   txCan(1, 0x542, 0, packet542)
    end
	
    if everySecondTimer:getElapsedSeconds() > 1 then
       everySecondTimer:reset();
       txCan(1, 0x502, 0, packet502)
       txCan(1, 0x546, 0, packet546)
       txCan(1, 0x547, 0, packet547)
       txCan(1, 0x548, 0, packet548)
    end


	rpm = getSensor("RPM")
	rpm = (rpm == nil and 0 or rpm)
    --print('Rpm ' .. rpm)
	--print('getTimeSinceTriggerEventMs ' .. getTimeSinceTriggerEventMs())
	enableCompressionReleaseSolenoid = getTimeSinceTriggerEventMs() < compReleaseDulationLimit and rpm < rpmLimitSetting
    duty = enableCompressionReleaseSolenoid and 100 or 0
    print("Compression release solenoid " .. duty)
    setPwmDuty(outputIndex, duty)
  else
    if offCounter == 0 then --goodbye sweet love
      txCan(1, 0x502, 0, packet502) --goodbye
      offCounter = 1 --One shot 
    end
  end
end
I've pushed it to git as is with what I suspect is the defect

Re: Harley Requirements

Posted: Thu Nov 25, 2021 4:13 pm
by nmstec
Heh, yeah that does help. Oddly enough, not sure wtf, but 570 still works...

Re: Harley Requirements

Posted: Fri Nov 26, 2021 12:05 am
by nmstec
So will need in tuner studio, a separate VE and timing map for both cylinders. One runs way hotter than the other.

Re: Harley Requirements

Posted: Fri Nov 26, 2021 3:26 am
by nmstec
would like to know if we can build something to translate other Standalone tunes into regular our tunes. They have 100s of base maps that are fantastic.

and as mentioned in my forum post, LATER ON (making capitals so andrey doesnt think right this second), we will need seperate timing and VE maps for both cylinders. They run differently when hot.

Re: Harley Requirements

Posted: Fri Nov 26, 2021 10:20 pm
by nmstec
New update. Harley wiring diagram makers are on both crack as well as meth. Knock sensor wires wrong, VR sensors swapped, dicks are tiny and in general plenty of other deficiencies.

Re: Harley Requirements

Posted: Sat Nov 27, 2021 7:44 pm
by nmstec
Well, I fried low 12 output I think. ACR took up to 5amps... Fuck. gonna relay it on low 11 this time, and see if LUA works or not for pwm. If not, then LUA problem.

Re: Harley Requirements

Posted: Sat Nov 27, 2021 10:31 pm
by mck1117
It proooobably shouldn't have killed it. I've PWM'd in to a dead short with those before and haven't killed one.

Re: Harley Requirements

Posted: Sat Nov 27, 2021 11:41 pm
by AndreyB

Re: Harley Requirements

Posted: Sun Nov 28, 2021 6:14 pm
by AndreyB