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

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #30 on: December 29, 2017, 12:44:15 PM »
Hi,

the quest continues.

A solid footing helps determining cause and effect, so a stepper motor was added to the board. Which resolves the idle system error message.





The last tests were made with a Stelvio 1200 8V BIN, which resulted in finding another bit change in 0x15 when the ATC setting is changed.

Cheers
Meinolf
« Last Edit: December 30, 2017, 12:53:26 AM by Meinolf »

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #31 on: January 13, 2018, 03:22:18 PM »
Hi,

somehow I do tend to get sidetracked. So sad....

Anyway, a signal analyzer (8ch, 24MHz, Saleae clone HW - Sigrok SW) was added to the measuring equipment and a first look at what is happening on the CAN bus, which is the means of communication between the ECU, the dashboard and the ABS subsystem, was taken.





Having no previous knowledge about the CAN bus I'm still very much in the early look and see phase. Identifying IDs, understanding the data inside the packets send back and forth and finding a use for it is the target. Logging data on the CAN bus results in enormous amounts of data, currently I'm looking for a tool to analyze the collected data, It can be done with Excel or the like, but handling data exceeding 1mio data sets slows down things a lot.

Cheers
Meinolf

Offline Chuck in Indiana

  • Gaggle Hero
  • *****
  • *
  • *
  • *
  • Posts: 29445
Re: ECU Simulator next gen - 5AM
« Reply #32 on: January 13, 2018, 07:07:04 PM »
Nice.. since a friend told me about can bus problems with his Beemer several years ago, (he was a BMW mechanic) I decided I didn't want a bike with one.  :smiley: Maybe you'll eventually change my mind.
Chuck in (Elwood) Indiana/sometimes SoCal
 
87 AeroLario
95 Skorpion tour
22 Royal Enfield Classic 3 fiddy
 "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe."
Albert Einstein

Offline Sasquatch Jim

  • Gaggle Hero
  • *****
  • Posts: 9600
  • Sidecar - Best drive by shooting vehicle ever
Re: ECU Simulator next gen - 5AM
« Reply #33 on: January 13, 2018, 11:11:23 PM »
 I am certainly happy that I don't understand a word of all this.  And not afraid to admit it.
  It all sounds like poo baah to me.
« Last Edit: January 13, 2018, 11:13:14 PM by Sasquatch Jim »
Sasquatch Jim        Humanoid, sort of.

Wildguzzi.com

Re: ECU Simulator next gen - 5AM
« Reply #33 on: January 13, 2018, 11:11:23 PM »

Online Ncdan

  • Global Moderator
  • Gaggle Hero
  • *
  • *****
  • *
  • *
  • *
  • *
  • *
  • Posts: 5878
Re: ECU Simulator next gen - 5AM
« Reply #34 on: January 14, 2018, 08:57:17 AM »
You guys with this ability and mental capacity to produce these projects are totally amazing. I am struggling to just understand the deference between open and closed systems. I am making some progress with the guidance of some guys here on the forum. However I don’t think us older guys who started late in life will ever get up to top levels of this fast advertising technology. By the time we make some progress everything we learned the past year is already old technology. Thanks for this post I’ll try and figure it out somewhat:(

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #35 on: January 14, 2018, 10:18:52 AM »
Hi,

it's much less amazing than it might seem at first glance. I'm 58, my education is mechanical engineer, my business experience mktg/sales/mgt. No previous electronic or programming experience at all. I'm just lucky to have the time and inclination to "deep"-dive into this stuff and enjoy the learning experience, it keeps the brain busy. And, very important, Beard is always willing to help me out when I ask the most stupid questions.

When I post you only see the tip of the iceberg. So much time being sidetracked or plain ignorance is spent between the posts. To paraphrase and adapt an old saying, for me it's "99.999% transpiration, 0.001% inspiration". If not even less.

So, you are never to old to learn new stuff. And keeping an old Beatles song "Long and winding road" in mind helps :laugh:

Cheers
Meinolf
« Last Edit: January 14, 2018, 10:21:00 AM by Meinolf »

Offline Chuck in Indiana

  • Gaggle Hero
  • *****
  • *
  • *
  • *
  • Posts: 29445
Re: ECU Simulator next gen - 5AM
« Reply #36 on: January 15, 2018, 08:06:28 AM »
Great post, Meinolf.. :thumb:
Chuck in (Elwood) Indiana/sometimes SoCal
 
87 AeroLario
95 Skorpion tour
22 Royal Enfield Classic 3 fiddy
 "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe."
Albert Einstein

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #37 on: January 15, 2018, 02:10:23 PM »
Hi,

Nice.. since a friend told me about can bus problems with his Beemer several years ago, (he was a BMW mechanic) I decided I didn't want a bike with one.  :smiley: Maybe you'll eventually change my mind.

allow me to put this into perspective. The CANBus in itself is interesting, great stuff to get acquainted with, but of no big use, as far as I can make out, in optimizing the BIN. But, understanding what's happening should help in identifying scalars in the BIN. Those are most difficult to pin down, as a single byte in the huge hexdump is less likely to be found than a table.

And a special thanks to John, a British Triking fan, who read this thread and kindly shared his findings about the IDs and data on CANBus.

Cheers
Meinolf

Offline stick

  • New Egg
  • *
  • Posts: 65
  • Greater Worcester, MA
Re: ECU Simulator next gen - 5AM
« Reply #38 on: January 16, 2018, 11:15:10 PM »
Meinolf,

Again, a gracious thank-you for you persistent aggression into the reverse-engineering of our ECU "brains"!

I have a 5AM ECU that I'm planning to use on my ST4s Ducati...     And I "think" that the 59M ECU that was OEM on this model had CAN bus merely for the anti-theft (IMMO) module "hand-shake".  So given that I am willing to delete the IMMO function with the newer 5AM ECU, I am hoping that much of the CAN bus logic can be ignored also for the 2003 ST4s that I am getting ready again for this 2018 riding season.

A bit of history: My ST$s was giving me intermittent issues with the IMMO light, and most recently running issues -- after I stirred the hornet's nest by wiggling the harness beneath the gauges...    Anyway, I did find a lousy fuse connection for the "display" (a 3A fuse that also seemed to interfere with the IMMO LED). 

In the long run, I'm hoping that the 5AM will make my Ducati 2003 ST4s run like, or better, than it use to.

FWIW, the 5AM that I bought, came from a HM1100s, and it was able to immediately start my engine (which the 59M was seemed no longer capable of -- and I checked many things B4 doing the swap...). 

So I was wondering if the CAN bus could be disabled in the 5AM, since I really have no need for it?










Stick

Nothing like stuffing a Goose between your legs

2013 Stelvio NTX
2002 V1100 Lemans
1996 Sport 1100
2003 Ducati ST4s

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #39 on: January 17, 2018, 03:03:00 AM »
Hi,

So I was wondering if the CAN bus could be disabled in the 5AM, since I really have no need for it?

hm, an interesting question. The CANBus HW is in the ECU and controlled by the program code. Which is probably different between Guzzis and Ducatis. As I don't plan to explore the Ducati BINs your existing thread http://www.ducati.ms/forums/241-tech-forum/687521-2003-st4s-planning-install-5am-ecu.html in the Ducati forum is more likely to provide an answer.

Btw, just copying a table or two from one BIN to another is a rather naive approach. The 5AM code is full of yet unknown scalars and tables and. Exchanging a single or a couple of tables is very unlikely to produce reliable results.

Cheers
Meinolf
« Last Edit: January 17, 2018, 03:07:18 AM by Meinolf »

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #40 on: January 19, 2018, 09:11:35 AM »
Hi,

it's been some days since the last post. The last couple of days were mostly spent on installing the recently arrived CANBus shield and trying to get Arduino sketches running. I did mention that programming is not my forte, didn't I?
But once again Beard came to the rescue and quickly programmed a sketch and library which now sent the CANBus frames to the serial monitor.

The CAN H/CAN L data lines are connected to the still unpopulated TCU connector of the Aprilia wiring loom. The CANBus runs at 125kBit/s, and only five identifiers have been found so far. The data in the CANBus frames contains includes speed, rpm, air pressure and more.



 

The electronic equipment in use has increased a lot. From left to right, an EEPROM programmer, the Arduino Uno and the plugged-in CANBus shield, the OBD2 adapter and the signal analyzer.



 

A lot of display real estate is needed to have all the required programs visible at the same time.



 

It now pays off that the former living room was re-purposed as inside workshop when the youngest daughter moved out some time ago.





Recently fabricated was a holder to attach 4 plugs to the ignition coils. Which took care of the ignition related ECU errors, but sends a lot of high voltage spikes into the loom, even disturbing the USB interfaces of the PC. Plus, with the plugs and stepper motor attached the power supply runs at ~2.6Amps. Which is probably more power that the PCs requires.



 

Also fabricated was the infamous resistor module used in the Aprilia Mana. A couple of resistors and a diode, connected to side stand, ECU, starter button and front brake switch. It's not needed when a Guzzi BIN is loaded, but the virtual engine won't start when an Aprilia BIN is active.





The standard programs used include Arduino and the serial monitor as well as Sigrok, the frontend used to analyze and display the signals measured with the signal analyzer





The 2nd monitor shows the Guzzidiag suite and the EEPROM programming software.




upload photo


And last but not least, Tunerpro and a Hexeditor on the 3rd display.





Cheers
Meinolf

Offline Chuck in Indiana

  • Gaggle Hero
  • *****
  • *
  • *
  • *
  • Posts: 29445
Re: ECU Simulator next gen - 5AM
« Reply #41 on: January 19, 2018, 04:21:22 PM »
You've been busy..  :thumb:
Chuck in (Elwood) Indiana/sometimes SoCal
 
87 AeroLario
95 Skorpion tour
22 Royal Enfield Classic 3 fiddy
 "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe."
Albert Einstein

Offline Bluerobotz

  • New Egg
  • *
  • Posts: 67
Re: ECU Simulator next gen - 5AM
« Reply #42 on: January 19, 2018, 04:35:51 PM »
Great job Meinolf! I've got a room suitable for that purpose too, but I'm find hard to get the wife to agree to the conversion  :sad:
I hope you've put heavy duty castors on that desk, when you're finished,  its going to be the fastest desk in the Euro zone!  :bow:
2003 B750, 1984 GPz900R A1, 1985 GPz900R A2, 1981 V50 Monza, 1973 Eldorado Civilian

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #43 on: January 20, 2018, 12:16:45 PM »
Hi,

I'll be posting more details on the CANBus now. Both to keep John T., who kindly sent his findings on the CANBus, and the guys from www.ducati.ms (http://www.ducati.ms/forums/241-tech-forum/627217-ducati-998-999-iaw59m-canbus-3.html) in the loop.

Again Beard came to the rescue and provided the sketch to get analyzable data from the CANBus shield. So, here's the first take. The BIN used is from a Stelvio (2229STA42Z).





Cheers
Meinolf

Offline Chuck in Indiana

  • Gaggle Hero
  • *****
  • *
  • *
  • *
  • Posts: 29445
Re: ECU Simulator next gen - 5AM
« Reply #44 on: January 20, 2018, 04:15:36 PM »
Good start.
Chuck in (Elwood) Indiana/sometimes SoCal
 
87 AeroLario
95 Skorpion tour
22 Royal Enfield Classic 3 fiddy
 "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe."
Albert Einstein

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #45 on: January 21, 2018, 07:13:13 AM »
Hi,

it's not uncommon for programmers to leave their signatures or witty comments in the code, which is only shown when certain key-combinations are pressed.

In this instance it seems that one of the programmers working on the BIN of the 2-Lambda models hid the following message in 2 Canbus packets.

"Streetfighter"









And maybe there's another message hidden within the message. The last Byte in the 2nd line is $18, which, in the ASCII-code, is defined as CAN(celed). So somebody is sending the message that Guzzi canceled Streetfighters every few ms over the CANBus.

Cheers
Meinolf

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #46 on: February 20, 2018, 12:51:17 AM »
Hi,

the last weeks were spent in assigning every byte which assumedly is data, not program code, to parameters in an XDF.

An iterative process was used, first trying to identify tables and their format (signed/unsigned, 8/16Bit, array structure like 2x8 or 32x20). The next step was to fill in the holes and assign scalars or flags to those adresses where no structure indicating a table was visible. Again, every single value was evaluated if signed/unsigned or 8/16bit provided a plausible interpretation.

The result is a XDF with more than 400 parameters, well knowing that firstly many of the interpretations are likely to be wrong or incomplete and secondly knowing that not every table, scalar or flag found will be used by the program code in Guzzi BINs.

Concurrently the results of the analysis were tested on the ECU simulator and the idle fuel map was found at 0x4D7B0. The assumed array is 16x8.





The range it's active in is TPS closed, rpm > 200 (I haven't tested below 200rpm), rpm < 2600 when engine speed is decreasing and rpm <2650 when engine speed is increasing. While the tests show that one axis if the table is rpm, the meaning of the 2nd axis couldn't be determined yet. Neither engine or air temperature nor vehicle speed have any influence nor clutch, brake, neutral or sidestand.

Further investigations will show if in fact 16x8 is the correct size, the values in that array indicate so, or if it's different. A likely candidate for the rpm-axis is the 8x1 table at 0x4D7A0.

Another tidbit found was that the warm-up function, which was assumed to be active only after starting the engine, also kicks in when the revs decrease rapidly. As the standard setting of the warm-up function is a duration of 2000 engine revolutions after start this hindered the measurement of the idle fuel injection time influence a lot.

Cheers
Meinolf

beetle

  • Guest
Re: ECU Simulator next gen - 5AM
« Reply #47 on: February 20, 2018, 01:00:12 AM »
Excellent work, Meinolf.

 :thumb:

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #48 on: February 20, 2018, 01:00:45 AM »
Hi,

while going thru the entire BIN strange findings pop up. Such as the "STREETFIGHTER" string found previously.

A new candidate for strangeness was a string at 0x1820A, "5AM     PTPD    1234". I found this string in all 5AM BINs regardless of motorcycle make they were used in.

A bit of research pointed towards https://en.wikipedia.org/wiki/PTPd. PTPd is an Open Source implementation of a Precision Time Protocol from the UNIX world. As it turns out the Open Source license agreements dictate that programs which make use of them mention this.

Now why would this string be in the program code of an ECU?

Some more research and this was found http://www.ieee802.org/1/files/public/docs2013/new-tsn-diarra-in-vehicle-global-synchronization-0716-v01.pdf

A secure way of providing time synchronization is needed for real time data exchange in automotive applications. It's seems likely that the 5AM program code was built with this application in mind.

Cheers
Meinolf

pete roper

  • Guest
Re: ECU Simulator next gen - 5AM
« Reply #49 on: February 20, 2018, 01:54:21 AM »
Just wondering? Did that dashboard arrive and is it useful?

Pete

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #50 on: February 20, 2018, 01:58:02 AM »
Hi Pete,

yes, the dashboard arrived. It unfortunately died only a few minutes after powering it up.

Thanks again for your support
Meinolf

pete roper

  • Guest
Re: ECU Simulator next gen - 5AM
« Reply #51 on: February 20, 2018, 02:11:46 AM »
Shit! I'll keep my eyes out for another. I might have a Stelvio dash around but I think it's part of a full lock kit as well so it's worth something.

I might go down to Sydney and nag, in person, about that TCU and dash that AFAIK are still sitting there.

Pete

Online Huzo

  • Gaggle Hero
  • *****
  • *
  • *
  • *
  • *
  • Posts: 13202
  • Location: Creswick Australia
Re: ECU Simulator next gen - 5AM
« Reply #52 on: February 20, 2018, 02:31:37 AM »
Hi,

it's much less amazing than it might seem at first glance. I'm 58, my education is mechanical engineer, my business experience mktg/sales/mgt. No previous electronic or programming experience at all. I'm just lucky to have the time and inclination to "deep"-dive into this stuff and enjoy the learning experience, it keeps the brain busy. And, very important, Beard is always willing to help me out when I ask the most stupid questions.

When I post you only see the tip of the iceberg. So much time being sidetracked or plain ignorance is spent between the posts. To paraphrase and adapt an old saying, for me it's "99.999% transpiration, 0.001% inspiration". If not even less.

So, you are never to old to learn new stuff. And keeping an old Beatles song "Long and winding road" in mind helps :laugh:

Cheers
Meinolf
So far above my head, it's embarrassing... :embarrassed:

beetle

  • Guest
Re: ECU Simulator next gen - 5AM
« Reply #53 on: February 20, 2018, 02:42:31 AM »
I'm still stepping my way through it, but the table at at 0x482b4 looks suspiciously like the legend for a MAP correction table.

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #54 on: February 21, 2018, 12:55:07 AM »
Hi Mark,

I'm still stepping my way through it, but the table at at 0x482b4 looks suspiciously like the legend for a MAP correction table.

I don't think so.

The value range doesn't make sense for a non-charged engine. I've logged MAP over the entire driving range on the V11 and Jackal (for the purpose of creating target lambda tables). And the 5AM equipped Guzzi don't have a MAP sensor, only the baro sensor in the dashboard.

This might be an unused table.

Cheers
Meinolf

beetle

  • Guest
Re: ECU Simulator next gen - 5AM
« Reply #55 on: February 21, 2018, 02:02:36 AM »
Hi Mark,

I don't think so.

The value range doesn't make sense for a non-charged engine. I've logged MAP over the entire driving range on the V11 and Jackal (for the purpose of creating target lambda tables). And the 5AM equipped Guzzi don't have a MAP sensor, only the baro sensor in the dashboard.

This might be an unused table.


I'm afraid I disagree. I believe it is legend for a MAP sensor correction. I know it's not used, but the developers must have considered it at some point. It turns out the values are exactly the same as the MIU G3 intake correction legend. Yes, 2000 mBar is a bit outrageous, but values of around 1000 aren't. I don't recall what the 35mm (?) throttle body of a V7 produces, but the 50mm 1400 California is in the 650 mBar region.

Offline Meinolf

  • Gosling
  • ***
  • Posts: 243
  • Location: Germany
Re: ECU Simulator next gen - 5AM
« Reply #56 on: February 21, 2018, 02:23:52 AM »
Hi Mark,

even if it's not used in the 5AM, it's valuable information nevertheless. Do you know which to which table (value range and array size) it belongs in the MIU G3? And what the other legend is? If I can find a corresponding table in the 5AM it can be taken of the watch list.

The MAP values I have measured (Jackal) go down to ~40% of ambient pressure. The upper table are centiBar values, the lower table is the normalized view of the upper. Zeros at the breakpoints w/o data.




images upload


Cheers
Meinolf

beetle

  • Guest
Re: ECU Simulator next gen - 5AM
« Reply #57 on: February 21, 2018, 04:00:55 AM »
Intake pressure correction.

Intake air temperature (deg C) vs manifold absolute pressure (millibar)

Air temp is 16 values: 20 - 110 (Conversion X - 40).






« Last Edit: February 21, 2018, 04:01:32 AM by beetle »

Offline pauldaytona

  • Gaggle Hero
  • *****
  • Posts: 2562
    • Paul's fast Guzzi Page
Re: ECU Simulator next gen - 5AM
« Reply #58 on: February 24, 2018, 05:30:35 PM »
I think there are a number of tabels/legends not used at all. The marelli guys take a stock set of table/maps and start using what is handy. Since a lot of sensors they use have the same characteristics on car of MC.
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 #59 on: March 13, 2018, 11:48:29 AM »
Hi,

some weeks have passed since the last post. Beetle's information, and the tremendous work John Th. from the UK is doing on analyzing the code, provided plenty of information to update the XDFs for the one- and two Lambda Guzzi. While many of the arrays, scalars and flags identified are still unknown in regards to what they actually are for, or as Paul remarked, if they are really used by the program, the XDFs now contain hundreds of plausible parameters.

The idea for the ECU simulator was born when an Aprilia Mana was added to the motor pool, the cable loom and the ECU are used Aprilia parts. However, the virtual engine wouldn't start with an Mana BIN. The assumption was that the missing dashboard and maybe the missing TCU were cutoffs.

Some weeks ago a Aprilia fan from Poland, Robert, approached me and offered to assist in getting a Mana dashboard. Which arrived today. I knew that the mechanical condition wasn't mint, but as long as the electronics work all would be well.





The complete dissassembly is much easier than that of the Guzzi dashboard. The PCB was removed and power applied. And, it worked. The stepper motor stepped and the LEDs lit up.




pic upload


The EEPROM was quickly identified and cables soldered to the SDA/SCL pins. Then a connection to the programmer and the EEPROM content could be read. Great. The next step was to program the EEPROM with a Usercode and the transponder keys fitting to the ignition key used. Alas, programming didn't work, the software gave an error message. So, a quick study of the EEPROM datasheet and some thinking led to the assumption, that maybe the Aprilia dashboard made use of the Write Protect pin. Another cable was added and connected to ground. And now the EEPROM could be programmed as well.





Another quick check was made to verify if the algorithm (found for the Guzzi dashboards) for calculating the check sum protecting the mileage and other values in the EEPROM also worked with the Aprilia firmware. And yes, it's the same algorithm.

The next step will be to connect the dashboard to the ECU simulator and check if the virtual engine can now be started. Then the XDF describing the addresses and contents of the data can be validated. And take a look at what's happening on the CANBus as well.

And a special thanks to Robert and his support in getting the dashboard. Chapeau!!!

Cheers
Meinolf

 

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