Author Topic: ECU Simulator next gen - 5AM  (Read 29925 times)

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #90 on: November 10, 2018, 12:27:47 PM »
Hi Omo,

you should have mentioned earlier that you are referring to a two lambda model. The code is quite different from the one lambda models and the offsets also. My focus is still on the one lambda BIN and I haven't spent much time yet on the two lambda BIN.

But, here's a look at the current status of the two lambda BIN. The offset of the idle fuel is 0x4D78C, y- and x-axis are the same, idle rpm and stepper motor values.
 




Cheers
Meinolf
« Last Edit: November 10, 2018, 12:42:05 PM by Meinolf »

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #91 on: November 10, 2018, 12:38:06 PM »
Hi Omo,

I am assuming that the idle fuel table is in use when PADS shows message idle on its screen, and thats when the lambda correction values are also very high.
When I give it some revs the PADS shows off idle and the lambda correction values come back to normal +/- 5%.

I'm not familiar with PADS, I work with GuzziDiag only, so the idle status as shown in PADS might be different from the one shown in GuzziDiag. But, let's assume PADS also uses the OBD function, then the reported status should be the same.

I assume you have checked other potential causes such as defective stepper motor or air leakage (bypass screws?) and have reset TPS and learned values?

Cheers
Meinolf

Offline Omobono

  • New Egg
  • *
  • Posts: 3
Re: ECU Simulator next gen - 5AM
« Reply #92 on: November 10, 2018, 01:15:28 PM »
Hi Meinolf,

Yes I have checked the stepper motor and done the normal tune-ups, TPS/learned values resets etc.

It is odd that the problem is in both cylinders. Both lambda corrections (left/right) are high when idling. Thats why I am thinking there cant be something mechanically broken/air leaks etc... on both cylinders.

I just thought that tweaking the idle fuel table would give me some answers. But if it cant be done then I just have to keep on trying to figure out what is wrong with this bike.

Ciao
Omo

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #93 on: November 10, 2018, 02:40:18 PM »
Hi Omo,

my mistake, of course you can change the values in the idle fuel table, I've done so.

What I was trying to say is that the matching logged AFR data against the rpm/stepper position values to change values based on measurements is difficult, I haven't found a fact-based approach yet.

The problem is that logging stepper values in sync with TPS and rpm is not possible with the logging equipment I use. Stepper values are sent with a low frequency (12Hz in total, shared by all values requested) as OBD packets, while the data logger (ZT-2) samples at 60Hz and is directly connected to TPS and rpm signal, so sync'ing the data stream is not possible.

So, change away, but it's a hit and miss procedure.

Cheers
Meinolf

Wildguzzi.com

Re: ECU Simulator next gen - 5AM
« Reply #93 on: November 10, 2018, 02:40:18 PM »

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #94 on: November 10, 2018, 02:55:27 PM »
Hi Omo,

It is odd that the problem is in both cylinders. Both lambda corrections (left/right) are high when idling. Thats why I am thinking there cant be something mechanically broken/air leaks etc... on both cylinders.

if it concerns both cylinders one possible avenue to explore could be the lambda sensors. Either check the sensors or disable closed loop to eliminate one or both of them as possible cause.

It seems unlikely that the idle values should suddenly (that's my assumption) should be wrong, the influence must be elsewhere. Hence changing the idle fuel values would be working on the symptom, not the root cause.

Cheers
Meinolf

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #95 on: January 21, 2019, 11:41:49 PM »
Hi,

the exploration of the code is proceeding steadily, but the low hanging fruits are picked and learning curve gets flatter.

Last year I noticed several times that idle rpm when stopping with gear engaged and clutch pulled was several hundreds revs higher than expected. In the meantime we found the RAM variables representing the status of clutch and neutral, so this was revisited.

Actuating the clutch causes a change between the two idle ignition tables. Increasing the timing leads to, within certain limits, increased engine power and thus to higher rpm if everything else is unchanged. But, in the 2230 BIN for the Norge 1200 2V both tables contain the same values, so this was not the cause of the increased idle rpm.





However, this serves as a good example for the flexibility of the program code. While this function seems unnecessary on a bike with a dry clutch, it makes sense with a wet clutch. The friction between the clutch plates due to the oil viscosity will act like a brake and lead to a drop of the idle rpm.

The 2230 uses only one main ignition table , the values for the right cylinder are calculated separately as a delta value, if the TPS in the "not closed" state. We also found the steering and learning function responsible for determining the change from closed to open and from open to WOT.

Cheers
Meinolf

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #96 on: January 21, 2019, 11:51:46 PM »
Hi,

the idle ignition function of the 3222 BIN is basically the same. However, a few twists were added.

Not only does the clutch switch act as branch condition for switching between the two idle functions, but the neutral switch is added. Which, following the thoughts about the increased friction between the clutch plates, makes a lot of sense. In neutral with the gears not engaged the friction would not be a factor.





Cheers
Meinolf

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #97 on: January 22, 2019, 12:02:20 AM »
Hi,

seeing that the identical values used in both idle ignition tables would not lead to changes in idle rpm, another direction was explored. Which is concerning the changes caused by engine temperature.

The 2230 has two idle ignition tables which trim ignition in line with engine temperature and are also selected by the clutch switch. Which makes sense, as the oil viscosity and thereby the braking effect will decrease with increased oil temperature. If the clutch is a wet type. Which it isn't, so again identical trim values in both tables.





And the question could be asked if this control mechanism is needed in an engine with idle stepper control in the first place.

Cheers
Meinolf


Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #98 on: January 22, 2019, 12:05:42 AM »
Hi,

above might explain why one of the two idle ignition temperature trim tables was dropped from the 3222 BIN.





Cheers
Meinolf

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #99 on: January 22, 2019, 12:15:23 AM »
Hi,

while, driven by curiousity, a Ducati 5AM BIN was analyzed in between, the main focus is on the Guzzi 2230, then the Guzzi 3222 and finally the Aprilia Mana BIN. And thus it was interesting to find a parameter setting a number of possible gear box configurations.

The parameter at 0x4CF60 (2230, a different offset in the 3222) contains values from 1-6 and 20 and 21. The values from 1-6 represent the number of gears, though a transmission with two or three gears probably is no longer state of the art. The value 20 is used if the bike is using a CVT automatic transmission, as is the case with the Mana. The function of value 21 is unclear, but it is queried as branching condition value in the code. Possibly for a different automatic transmission or a double clutch system.





Cheers
Meinolf

Offline pauldaytona

  • Gaggle Hero
  • *****
  • Posts: 2562
    • Paul's fast Guzzi Page
Re: ECU Simulator next gen - 5AM
« Reply #100 on: January 22, 2019, 03:46:28 AM »
Meinolf,

in the griso map, what addresses are the different idle ignition tables? The 2230G803 map I use does have the idle rise with pulled clutch and not in neutral, Switching to neutral gest idel normal again.
Paul

Daytona 1225, Stelvio 1151





Download Guzzidiag here: http://www.von-der-salierburg.de/download/GuzziDiag/

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #101 on: January 22, 2019, 04:54:21 AM »
Hi Paul,

the offsets are for the idle ignition maps are legible in the picture above, 48D9E and 48DFE.

Cheers
Meinolf

Offline pauldaytona

  • Gaggle Hero
  • *****
  • Posts: 2562
    • Paul's fast Guzzi Page
Re: ECU Simulator next gen - 5AM
« Reply #102 on: January 22, 2019, 08:19:40 AM »
Yes they are different, now waiting until its a bit hotter to test. I had it most when hot. I see the normal ignition/temp table doesn't do anything over 7 degree. And making both ignition tables the same didn't change your behaviour. The neutral switch makes the difference, switching to neutral makes idle good again.

Paul

Daytona 1225, Stelvio 1151





Download Guzzidiag here: http://www.von-der-salierburg.de/download/GuzziDiag/

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #103 on: January 22, 2019, 09:47:38 AM »
Hi Paul,

yes, moving to neutral leads to a normal idle.

Finding the code section which uses the neutral flag and leads to functions which would influence idle speed is a challenge, though. One of the most convoluted subs uses the neutral flag about a dozen times. Working thru it and backtracking the numerous other variables called takes days and weeks, and that's only one of hundreds of subs and thousands of possible combinations including timing conditions.






Cheers
Meinolf

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #104 on: February 23, 2019, 05:34:41 AM »
Hi,

some more tidbits, this time with the focus on the fuel acceleration function. Which takes cares of adding or subtracting fuel if the throttle if moved rapidly.

The underlying model is called X-Tau and takes into account

X, the amount of fuel clinging to the port walls, etc.,
and
Tau, the time it takes for the film to dissipate.

More details can be found here: http://www.megamanual.com/ms2/xtau.htm

The calculation is handled by two subprograms, in which an enormous amount of scaling takes place. The first one covers the scaling of TPS and rpm.








The 2nd sub handles the scaling of engine and air temperature. The cut-off rpm for acceleration/deceleration fuel change is 7000rpm.





Next comes the code which handles TPS change speed and amount, based on comparisons between current and historical values.





Now the calculation of  fuel_time values for the boundary -0,5°TPS > TPS change > 0,5°TPS. The -0.5/0.5° are the thresholds below which no fuel re-calc takes place.





The a final scaling and the result are fuel_accel_left- and  fuel_accel_right values, which then are added to the fuel time values calculated in the previous code sections.





Cheers
Meinolf

« Last Edit: February 23, 2019, 05:38:00 AM by Meinolf »

Offline Kiwi_Roy

  • Gaggle Hero
  • *****
  • Posts: 9796
  • Location: New Westminster BC
Re: ECU Simulator next gen - 5AM
« Reply #105 on: December 22, 2019, 09:44:20 AM »
While I don't pretend to understand this logic I can see some similarity to a crude Programmable Logic Controller.
I would be interested in seeing the section that deals with the low Voltage interlock i.e. the part that prevents the Start Relay from picking up.
What i the set point below which it will no longer pick up?
Could you perhaps explain this part of the logic as used on a Norge
Is it similar on the 2 Valve Griso?

Is it possible to make changes to the logic or is it cast in stone?

What is the software called that compiles this code?
72 Eldorado
17 V7iii Special
76 Convert
Half a V9 Roamer

Moto Guzzi - making electricians out of riders since March 15 1921

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #106 on: December 22, 2019, 01:27:22 PM »
Hi Roy,

as chance goes I've started to work on the code again. It's too cold and wet for driving for the time being.

I'll look for the respective code and post it. The software used to translate the high level language used for programming into a binary file is a compiler. The version depends on which CPU the binary is intended for. In the case of 5AM a Freescale CPU is used, the ST10-269.

Guzzi has 2 BIN streams for the CARC models. 2230 is used in all one lambda models, be it Griso, Norge, Breva,...
3220 is used in all two lambda models. The respective BIN streams differ only slightly, for example the value for speedo correction across the model range. The actual code in each stream is mostly identical. Not so when comparing the streams, the code is quite different.

Cheers
Meinolf

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #107 on: December 23, 2019, 05:44:16 AM »
Hi Roy,

Is it possible to make changes to the logic or is it cast in stone?

fundamentally the actual code can be changed, but that's a hot iron. Beard and I tried this with the code of a 15M, but even a minor change screwed the timing up. At least the 15M needs all the processing power it has to function in real time operation, a single changed assembler instruction needing one or two more cycles meant mayhem.

Changing the parameters is safer, but still the consequences of a changed parameter are very difficult to predict or analyze.

Cheers
Meinolf

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #108 on: December 23, 2019, 11:23:38 AM »
Hi Roy,

I would be interested in seeing the section that deals with the low Voltage interlock i.e. the part that prevents the Start Relay from picking up.

while the code dealing with the start relay is still unresearched, the following code snippet is checking the voltage while starter active/not active. And might be the one preventing the starter relay from engaging if the voltage is below 9V when pressing the starter button.

 



Cheers
Meinolf

Offline Kiwi_Roy

  • Gaggle Hero
  • *****
  • Posts: 9796
  • Location: New Westminster BC
Re: ECU Simulator next gen - 5AM
« Reply #109 on: December 24, 2019, 01:14:42 AM »
The programming reminds me of "flow chart" I find it very interesting even though I don't understand it.
Decision blocks where the the input takes one of two paths out depending on the script (one input two outputs)
Action blocks that modify a signal or calculate (one input one output)
The blocks operate in sequence down the string then loop back to the top
I imagine there must be some strings that execute very fast whereas others like the Voltage one or discrete inputs could be quite slow to leave more time for the fast ones.
At least that's what we had to do with small Programmable Logic Controllers.
Perhaps when you make a change you need to re-order the blocks so that they operate in sequence properly otherwise it might be trying to execute
on one scan and have to wait for the next scan before it can carry on to the next instruction.
I'm not very good at putting thoughts into words and I was never very good at script language, ladder logic was more my speed.
I think its best not to have an electronic background if you work on computers otherwise you overthink it.
 
« Last Edit: December 24, 2019, 01:23:27 AM by Kiwi_Roy »
72 Eldorado
17 V7iii Special
76 Convert
Half a V9 Roamer

Moto Guzzi - making electricians out of riders since March 15 1921

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #110 on: January 16, 2020, 03:57:14 AM »
Hi,

I mentioned some time ago that the project team looking at the innards of the 5AM consists of 2. John, a proficient EE, found most of what we know today. And since December we are at it again, the weather is mostly to cold and wet for riding.

John's interest is based on furthering the development of Trikings using the 5AM and CARC engines.





A giant step forward in understanding the details of the program code was the dissassembly of a 5AM. John managed to dig out the PCB, which is buried in sealant stuff.





And actually reverse engineered the connections leading from the ECU pins to the ECU and the 2 ASCIs. I'm no EE and found this to be absolutely breath taking, the amount of knowledge and dedication is astounding.









He even drew up schematics of some of the circuits.





Cheers
Meinolf

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #111 on: January 31, 2020, 10:53:07 AM »
Hi,

the last months were spent mostly working through the system programs (located below 0x4000h). These have the charme of being used almost unchanged across the all BINs and manufacturers, thus facilitating a smoother entry when looking at a new BIN.

And due to John's persistent and very analytic approach more and more of these low-level routines are understood. Only recently did it become clear that a sub I assumed to count down a time value really counted engine revs. Which neccessitated a re-work of all involved values and functions and conclusions based thereupon.

For relaxation I regularly re-visit already analyzed parts of the code and include the new findings. Last week the 11 engine run modes were the target, they are becoming much clearer now. The respective code has cross connections to other parts, for example the ignition timing calculation. There is one sub in the convoluted calc which wasn't understood so far.

After working through many factors such as temperature caused corrections, accel/decel influence, which engine run mode is currently active, there comes one sub in the convoluted calc which wasn't understood so far.





It's the branch at loc_1BC62. This uses the current ignition timing value and and then proceeds thru another branching dependent on CAN50_flag1_D8EA. This ones get's its value of a CAN50 packet, the meaning of which wasn't known.

As I don't have the disassembled and reverse engineered BIN of the dashboard, scenario playing was required. Almost all pins on the ECU, the dashboard and the ABS module are understood, but one remained so far. That's the line between dashboard pin29 and ABS modul pin12.





So, the idea was to go thru the code with the assumption that this line would contain the information about ABS being active or not and how the ignition timing would be influenced.





First the branching to the left was looked at, ABS assumed to be active. The table at 494F6 contains ignition values, all being negative (-30=-1°). This table is indexed by table 494D6, which is indexed by data coming from the CAN50 package. The next step is towards loc_1BF52, where the negative ignition value is added, or rather subtracted, from the current ignition value. The result is a retardation of 1°.

Next the branching to the right, ABS not active, was followed. The threshold value at 4956 is negated and compared with table 494F6 values. The branching, using "if Table value > 49516", is always true with the values in the BIN, as -10 is bigger than -30. Consequently the branching jumps again to the right and eventually lands up with a 0 value being added to the current ignition value. So, no ignition change if ABS is not active.

If above criteria wouldn't be met, the left branch would be followed. Adding -30 (threshold value) to -10 (table value) and the resulting 4° would be subtracted from the current ignition timing.

Cheers
Meinolf

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #112 on: January 31, 2020, 10:55:08 PM »
Hi,

further consultation with John brought to light that the CAN50_flag1_D8EA doesn't originate from the dashboard, but another device not fitted to CARCs bikes.

So, the scenario playing was only useful in confirming that the routine is not used in CARCs.

Cheers
Meinolf

Offline little750

  • New Egg
  • *
  • Posts: 17
Re: ECU Simulator next gen - 5AM
« Reply #113 on: February 01, 2020, 07:34:35 AM »
The Stelvio has traction control could this be ignition retard mentioned above.

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #114 on: February 01, 2020, 11:06:37 AM »
Hi,

The Stelvio has traction control could this be ignition retard mentioned above.

unfortunately it's not. The Stelvio (BIN 3222) has a routine with the similar structure and the same function. Disregard any ABS mentioned in the picture, I haven't updated the comments and names yet.





However, the entry point to this routine is a branch condition at loc_1E90E, which checks the value at 4BC10, and this value being 0, bypasses the ignition retard function.





However, after further deliberation and cross-check with the BIN from an Aprilia Mana it turns out that the CANBus device probably is the TCU and the ignition retardation occurs when using the manual gear change buttons (The Mana has automatic gear box). The ignition retard of 30° fits to the purpose.

While the traction control flag has been found, I haven't followed this thru and looked for the routines involved in the traction control.

Cheers
Meinolf

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #115 on: February 04, 2020, 11:27:50 AM »
Hi,

some more tidbits which you might find interesting.

Several of the ECU pins are active, even though the ECU plug doesn't have live plugs and cables connecting them to the wire loom. There's also live code supporting the respective PINs. All below are ECU plug B/V (blue).

PIN 9, output. Supplies a engine rev signal. 2 pulses every 720° crankshaft. This can be used to connect a rev counter. Either a digital one for counting engine revolutions or a regular one to show engine revs.

PIN 13, output. Other makes use this output for a relais to activate a fan. Not really neccessary with CARCs, but can be used by gadget-lovers to drive an engine temperature activated aLED, for example, to indicate engine temperatur status. The engine temp upper and lower thresholds are user configurable.

PIN 23, input. Other makes use this as input for brake switches or the signal from an analogue fuel level sensor. The incoming signal is reflected in a CANBus paket, this could be used for data-logging via CANBus or OBD to capture an additional input.

For those who are interested, here are links to revised wiring diagrams.

Norge 1200 2V: https://drive.google.com/open?id=1j4pE71vCgqv6HCUBSJLBMeulRcd3vnT9
Norge 1200 8V: https://drive.google.com/open?id=18aA3VwTYLwZXGsqg9Jc1rah6FfCN2mEe

Cheers
Meinolf

Offline rjamesohio

  • Gaggle Hero
  • *****
  • Posts: 2244
  • Location: Waynesville OH
Re: ECU Simulator next gen - 5AM
« Reply #116 on: August 27, 2020, 09:18:55 PM »
This is an outstanding thread!

I will read the complete thread with great interest, thanks to those who took the time to post
Ron James
Ex LM V
Ex SP1000
Ex Eldorado
Ex Quota - parts live on after crash
EX 1000G5
EX 850T3
EX 2003 V11 Stone
EX 1996 California 1100i
EX 2006 Big Breva
1979 1000 G5
1993 California iii
Spine Frame Mongrel
1999 BMW R1100R
Waynesville, Oh
9372715697

Offline 80CX100

  • Gaggle Hero
  • *****
  • *
  • *
  • *
  • *
  • *
  • Posts: 1433
  • Location: Ontario, Canada
Re: ECU Simulator next gen - 5AM
« Reply #117 on: August 28, 2020, 01:22:25 AM »
     This is the 2nd time, I've read this complete thread, but it's the first time I've read it owning ECU bikes and having dabbled a little bit with guzzidiag and fuel maps etc.

     I still don't understand most of it, lol, but I now have a much greater appreciation for just how valuable this work is to us guzzi owners.  :thumb:

     Meinolf, I realize that there have been many contributors and collaborators to get to this point, but time, energy, focus and head space are all finite resources, thank you very much for being so generous in your efforts to help us modern guzzi owners.  :bow:

     Much gratitude and respect

     Kelly
« Last Edit: August 28, 2020, 01:24:54 AM by 80CX100 »
2008 California Vintage
2003 V11 Lemans
2007 Griso 1100
1979 G5 & 1980 Lemans CX100
2010 Suzuki DR650 & 1978 SR500

In a time of universal deceit, telling the truth becomes a revolutionary act. George Orwell

 

Quad Lock - The best GPS / phone mount system for your motorcycles, no damage to your cameras!!
Get a Wildguzzi discount of 10% off your order!
http://quadlock.refr.cc/luapmckeever
Advertise Here