ECUs and Tuning Discuss Engine Management, Tuning, & Programming

Your dream ECU

Old 03-14-2013, 10:36 AM
  #41  
Elite Member
 
JasonC SBB's Avatar
 
Join Date: Jul 2005
Posts: 6,420
Total Cats: 84
Default

Originally Posted by Jeff_Ciesielski
Propellers are neat and all, but they're quite unsuitable for anything serious. I know they now have GCC support and they look great on paper, but you have to bit-bang everything. Weak. You end up defeating the coolness of the hub + processing spokes architecture by burning up entire cores to interface with external ICs. By the time you've covered SPI, CAN, I2C, and USART, you're half occupied. Also, even though the hub memory window shifts predictably, I'd be hesitant to rely on a hard real time system that could potentially miss out on it's memory access.
Interesting input, thanks. I suppose the architecture could be improved while still maintaining its neat ideas.
JasonC SBB is offline  
Old 03-14-2013, 10:45 AM
  #42  
Elite Member
 
JasonC SBB's Avatar
 
Join Date: Jul 2005
Posts: 6,420
Total Cats: 84
Default

Originally Posted by Leafy
If you had that accelerometer though. You could use it to determine both acceleration in the direction of travel and road inclination. And you could use it to tune spark that way. Maybe. How accurate is a moderately priced 2 axis or 3 axis accelerometer?
The ECU would already have acceleration info in the RPM trace. And such data would probably have too much noise from outside sources (bumps, etc).

Theoretically Adaptronic did the right approach, dithering say, +/- 2* of timing, and looking for the resulting change in acceleration that is synchronous with the timing change.
JasonC SBB is offline  
Old 03-14-2013, 10:46 AM
  #43  
Junior Member
iTrader: (1)
 
vtjballeng's Avatar
 
Join Date: Feb 2011
Location: Richmond, VA
Posts: 342
Total Cats: 24
Default

Originally Posted by Jeff_Ciesielski
Did somebody say McLaren?

My dream ECU is simple: MS2 featureset, with a proper power supply, on a single board, with real connectors, a better communication protocol and a codebase that isn't a huge, flaming pile of ****. I'm sorry guys, I know it works, but MS has some of the _worst_ code I've ever seen. It's so bad, we show it to developers here as an example of how to get fired.

Seriously.
Most of the McLaren stuff I have seen is built for a specific series so it is neutered by the regs, though I'm sure there are fully capable ones I haven't yet run into. The Bosch stuff is where I see the craziest setups but that is just from my experience. Audi has some insane logging / electronics pacakge for their LeMans prototype cars as an example.

I think most code projects started by a community / non-pro have "the_worst_code" issue. I can think of a number of web projects like bulletin boards, ecommerce packages etc that suffer from poor initial structure, poor initial code and then the project just gets worse as other non-pros pour their semi-functional tidbits into the poorly organized package. Whenever you look at it you wish it was just re-started with good practices from scratch, then you figure out how long that would take and just move on.

I also don't like the multi-board setups that add insertion loss, capacitance, vibration issues, etc etc etc. Would be nice to have a very capable single board MS solution with no licensing requirements... oh wait, here is a close version except still some licensing something or other issues and relatively expensive for a low cost board MS3-Pro Module - An EMS on a circuit board, for building your own systems. The majority of the cost built into ECUs is for support as a general rule in industry (that may not be the case for MS builders here).
vtjballeng is offline  
Old 03-14-2013, 10:47 AM
  #44  
Elite Member
 
JasonC SBB's Avatar
 
Join Date: Jul 2005
Posts: 6,420
Total Cats: 84
Default

Originally Posted by Jeff_Ciesielski
... a codebase that isn't a huge, flaming pile of ****. I'm sorry guys, I know it works, but MS has some of the _worst_ code I've ever seen. It's so bad, we show it to developers here as an example of how to get fired.
Is it the overall architecture, or the coding of functions?
JasonC SBB is offline  
Old 03-14-2013, 10:52 AM
  #45  
Boost Czar
iTrader: (62)
 
Braineack's Avatar
 
Join Date: May 2005
Location: Chantilly, VA
Posts: 79,484
Total Cats: 4,076
Default

Even Ken complains of the code, and he writes the msextra stuff. But that's mostly the B&G code he has to work around.

it runs my car well with more features than I can use, so whatever. and when somethign doesnt work, I just text/IM/email him and bother him enough and he fixes it.
Braineack is online now  
Old 03-14-2013, 10:52 AM
  #46  
Elite Member
Thread Starter
iTrader: (1)
 
Leafy's Avatar
 
Join Date: Jun 2012
Location: NH
Posts: 9,479
Total Cats: 104
Default

Originally Posted by JasonC SBB
That's not an issue with the ECU, that's an issue with the tuning software. Whether it's VE based or injW based, the tuning software will send the same tables to the ECU. Put another way, one can re-write the tuning software to present VE based tuning to you, then translate it into whatever the ECU needs.
How? My understanding of how a computer calculates required injector pulse width involves actually doing out the ideal gas law equation. I know with injector pulse width I can just setup my comp tables correctly and not have to worry about it and have an excel file do the translating between ipw and ve so I can more easily adjust the tune. But I lost my ipw to ve converter spreadsheet so I'll have to make it again.
Leafy is offline  
Old 03-14-2013, 12:00 PM
  #47  
Elite Member
iTrader: (10)
 
Reverant's Avatar
 
Join Date: Jun 2006
Location: Athens, Greece
Posts: 5,976
Total Cats: 355
Default

Interesting that the Bosch ECU doesn't handle low-side outputs capable of more than 4 amps; say a PWMed water injection pump.
Reverant is offline  
Old 03-14-2013, 12:48 PM
  #48  
Junior Member
iTrader: (1)
 
vtjballeng's Avatar
 
Join Date: Feb 2011
Location: Richmond, VA
Posts: 342
Total Cats: 24
Default

Originally Posted by Reverant
Interesting that the Bosch ECU doesn't handle low-side outputs capable of more than 4 amps; say a PWMed water injection pump.
The modern method with higher level ECUs these days is to have a dedicated PDM communicating over CAN with detailed current programmability, retry timing, retry failure scenarios etc. A good PDM is, at this point, as advanced or more advanced than some basic ECUs.

MoTeC > About Power Distribution > Overview

They really haven't made it down to the consumer level yet but likely will. Isis power is trying to push them in the aftermarket at the low end as an example but I have no idea how well that is going for them. There has actually been a lot more advancement in the last 5 years in power distribution than in ECUs imo.
vtjballeng is offline  
Old 03-14-2013, 12:50 PM
  #49  
Elite Member
iTrader: (1)
 
richyvrlimited's Avatar
 
Join Date: Jun 2006
Location: Warrington/Birmingham
Posts: 2,642
Total Cats: 42
Default

Originally Posted by Braineack
Even Ken complains of the code, and he writes the msextra stuff. But that's mostly the B&G code he has to work around.

it runs my car well with more features than I can use, so whatever. and when somethign doesnt work, I just text/IM/email him and bother him enough and he fixes it.
Tell him to fix my bug then
richyvrlimited is offline  
Old 03-14-2013, 12:54 PM
  #50  
Elite Member
iTrader: (10)
 
Reverant's Avatar
 
Join Date: Jun 2006
Location: Athens, Greece
Posts: 5,976
Total Cats: 355
Default

Originally Posted by vtjballeng
The modern method with higher level ECUs these days is to have a dedicated PDM communicating over CAN with detailed current programmability, retry timing, retry failure scenarios etc. A good PDM is, at this point, as advanced or more advanced than some basic ECUs.
I agree, however the problem with CAN is that its not suitable for time critical applications. For example, if you want to activate a high-current device at a specific crank angle, you can't. Or to put more scientifically, you can try, but you are not guaranteed to apply it in the correct time frame.
Reverant is offline  
Old 03-14-2013, 12:58 PM
  #51  
Elite Member
iTrader: (1)
 
richyvrlimited's Avatar
 
Join Date: Jun 2006
Location: Warrington/Birmingham
Posts: 2,642
Total Cats: 42
Default

Originally Posted by Braineack
Even Ken complains of the code, and he writes the msextra stuff. But that's mostly the B&G code he has to work around.

it runs my car well with more features than I can use, so whatever. and when somethign doesnt work, I just text/IM/email him and bother him enough and he fixes it.
Tell him to fix my bug then
richyvrlimited is offline  
Old 03-14-2013, 01:45 PM
  #52  
Elite Member
 
JasonC SBB's Avatar
 
Join Date: Jul 2005
Posts: 6,420
Total Cats: 84
Default

Nobody here agrees that the most important feature for most enthusiasts are wizards for auto tuning the time consuming stuff like boost control and idle?
JasonC SBB is offline  
Old 03-14-2013, 01:55 PM
  #53  
Elite Member
Thread Starter
iTrader: (1)
 
Leafy's Avatar
 
Join Date: Jun 2012
Location: NH
Posts: 9,479
Total Cats: 104
Default

Originally Posted by JasonC SBB
Nobody here agrees that the most important feature for most enthusiasts are wizards for auto tuning the time consuming stuff like boost control and idle?
I would rather have many other more important things first. And I'd rather them not be present at all. The more wizards there are the more accessible tuning is to butting pushers rather than people who actually know what they're doing. It'll limit the amount of people that can tune the system, but it'll also limit the amount of complete **** tunes that a lot tuning shops sell for silly prices to people with more money than sense. And limit the amount of terrible tunes by billy the dsm'er who downloaded this tune from the internet and pushed some buttons and made his afr 8:1 because someone else on the internet said so. Tuning is an art and a science, something that you should easily be able to teach yourself how to do properly and become legitimately good at with practice. It shouldnt just involve pushing buttons that you don't quite understand what they do (unless you're learning and pushing random buttons just to see what they do) in order to "toon" the car.
/rant
Leafy is offline  
Old 03-14-2013, 02:05 PM
  #54  
Elite Member
 
Zaphod's Avatar
 
Join Date: Mar 2006
Location: Schwarzenberg, Germany
Posts: 1,553
Total Cats: 101
Default

Originally Posted by richyvrlimited
Tell him to fix my bug then
Just what I thought - there is simply no reply...
Zaphod is offline  
Old 03-14-2013, 02:46 PM
  #55  
hrk
Junior Member
iTrader: (6)
 
hrk's Avatar
 
Join Date: Oct 2005
Location: Atlanta GA
Posts: 335
Total Cats: 3
Default

OBD II port and support for emissions testing.
hrk is offline  
Old 03-14-2013, 02:49 PM
  #56  
Elite Member
iTrader: (10)
 
Jeff_Ciesielski's Avatar
 
Join Date: Oct 2008
Location: Rhode Island
Posts: 1,770
Total Cats: 31
Default

Originally Posted by JasonC SBB
Interesting input, thanks. I suppose the architecture could be improved while still maintaining its neat ideas.
I think that if they just added a shared peripheral block with basic serial busses, propeller would take off like a rocket.

Originally Posted by vtjballeng
Most of the McLaren stuff I have seen is built for a specific series so it is neutered by the regs, though I'm sure there are fully capable ones I haven't yet run into. The Bosch stuff is where I see the craziest setups but that is just from my experience. Audi has some insane logging / electronics pacakge for their LeMans prototype cars as an example.
I've not actually seen McLaren's ECU code (all of my code exists in non-critical sections of the car), but from what I have seen of theirs, it's quite robust, and their electronics are superb.

I think most code projects started by a community / non-pro have "the_worst_code" issue. I can think of a number of web projects like bulletin boards, ecommerce packages etc that suffer from poor initial structure, poor initial code and then the project just gets worse as other non-pros pour their semi-functional tidbits into the poorly organized package. Whenever you look at it you wish it was just re-started with good practices from scratch, then you figure out how long that would take and just move on.
I can't comment on that as all of the community projects I'm involved in are related to embedded systems. What I will say is that in my experience, if the maintainers are diligent, community driven projects actually tend to produce MUCH better code than commercial solutions. People tend to get in a tight feedback loop in their company, with no external criticism, and commit bullshit. Having 150 people tell you that your code looks like **** on the internet makes you shape up quick if you want it to be included

Originally Posted by richyvrlimited
I haven't the first clue as to how to code, so please excuse my ignorance, but could you explain to me why/how it is bad?

Is it just inefficiencies/bad math, or fragments of dead code left behind or?
Originally Posted by JasonC SBB
Is it the overall architecture, or the coding of functions?
There are a lot of problems with the MS codebase.

1) I shouldn't have to dig through 1300 lines of global variables and memory map structures to get to the definition of main() in a file called ms2_extra_main.c. The code is laid out in such a way that finding anything just defies reason. If you have bulk data that needs to be accounted for, put it in its own file, don't muddy up application code (this is one of the few times I think globally accessible variables/data are ok)

2) WHY THE **** ARE THERE SO MANY GLOBAL VARIABLES. Global variables (in general) are bad practice. Of course, occasionally this is unavoidable, but in almost every case you should have variables with local scope and be stored in the functions that they are going to be used in. If they need to be persistent, make them static. If the _absolutely_ need to be global, at least keep them in their relevant file. Global variables are just asking for concurrency issues to spring up.

3) Your main loop shouldn't be 2000 lines long. Y U NO FUNCTION!?! Functions should be short, sweet, and to the point (also: appropriately named). I should be able to look at any given function and understand (roughly) what is going on. Looking at MS2s main loop feels like reading a short novel. If you are concerned about branch time being an issue, __attribute__((always_inline)) is your friend (though this will, of course, increase size)

4) There is no layering. Good embedded software is layered (in fact, all good software is layered).
My preferred layout for embedded software is thus:
HAL (hardware access layer) -> Hardware Device Drivers -> Software Device Drivers -> Application code (which can also talk directly to device drivers depending on what we're talking about).
You layer software in order to modularize functionality and to allow ease of debugging and flexibility for future growth.
The MS code violates this pretty much everywhere.

5) They overuse GOTO statements. There are a few cases where they are useful (see linux kernel for examples), but for the most part (especially the way MS uses them) they are unnecessary IMO. Why not just have a conditional jump to a function?

6) They use assembly in completely unnecessary places. I get why you might use it in a timing critical interrupt, but there is some stuff that just doesn't require it.

There are a few others, but these are the bigguns as far as I am concerned. I'd also do some sort of encoding of the serial communications, but that's just me.


Edit: I'd like to point out, that I _DO_ appreciate the hard work that the developers have put in, and it DOES work. I don't mean this to be accusatory or anything.

Last edited by Jeff_Ciesielski; 03-14-2013 at 03:01 PM.
Jeff_Ciesielski is offline  
Old 03-14-2013, 02:54 PM
  #57  
Elite Member
iTrader: (9)
 
TurboTim's Avatar
 
Join Date: Jun 2006
Location: Chesterfield, NJ
Posts: 6,891
Total Cats: 398
Default

Originally Posted by JasonC SBB
Nobody here agrees that the most important feature for most enthusiasts are wizards for auto tuning the time consuming stuff like boost control and idle?
I'll agree 200%. I'm not worried about DSMers or a pile of **** tunes that may come of it...if my life is easier then I like it. I drive around in open loop fueling because settng up the AEM O2 feedback is a PITA. It was easier to drive around with my laptop for a week or so and make sure the zones are right, but if there was a wizard that set up the control variables for me, awesome.

I know theoretically how to tune a PID (or PI in the case of the AEM?) control, but if a good wizard can do it faster and more accurately, then that would be awesome. With as often as I change setups (or in the case of a 'tuner', with as often as they tune different cars) and therefore have to redo the feedback maps, I would love a wizard.
TurboTim is offline  
Old 03-14-2013, 03:14 PM
  #58  
Elite Member
 
Zaphod's Avatar
 
Join Date: Mar 2006
Location: Schwarzenberg, Germany
Posts: 1,553
Total Cats: 101
Default

Originally Posted by JasonC SBB
Nobody here agrees that the most important feature for most enthusiasts are wizards for auto tuning the time consuming stuff like boost control and idle?
I definitly do, i always wondered how hard it would be for starters to do something like this in a log analyzer like Megalogviewer. I have no clue about software programming, but this surely is no rocket sience...?!
Zaphod is offline  
Old 03-14-2013, 04:29 PM
  #59  
Elite Member
iTrader: (1)
 
richyvrlimited's Avatar
 
Join Date: Jun 2006
Location: Warrington/Birmingham
Posts: 2,642
Total Cats: 42
Cool

Originally Posted by JasonC SBB
Nobody here agrees that the most important feature for most enthusiasts are wizards for auto tuning the time consuming stuff like boost control and idle?
I agree totally with you, that's one of the major plusses of MegaSquirt. Phil is working on other wizards, WUE AE etc
richyvrlimited is offline  
Old 03-14-2013, 07:20 PM
  #60  
Elite Member
iTrader: (2)
 
triple88a's Avatar
 
Join Date: Apr 2006
Location: Chicago, IL
Posts: 10,453
Total Cats: 1,796
Default

Autotune.. everything and automatically input everything. AFR, idle at all engine temps, smart air temp afr (changes teh afr multiplier at different air temps automatically), spark if possible. Basically load up the basic map and drive and have it automatically adjust everything on the fly.
triple88a is offline  

Thread Tools
Search this Thread
Quick Reply: Your dream ECU



All times are GMT -4. The time now is 11:41 AM.