Building the new Controller Programming App

Kingfish

100 MW
Joined
Feb 3, 2010
Messages
4,064
Location
Redmond, WA-USA, Earth, Sol, Orion–Cygnus Arm, Mil
Greetings
This project formally began yesterday on 6/21 however it has many roots, references to other threads, and great contributors. Some of these are listed below in the Reference section.

Goals
Replace proprietarily-controlled software application with all-encompassing user-configurable design, lending extensibility and utility to the greater ES community.

Task List
The TL will have each step ending with success before proceeding to the next step:
  1. Craft a serial port communicator and test connection.
  2. Establish communication to Controller.
  3. Pass a configuration string.
  4. Mimic similar User Interface which will load/save ASV files, and flash the controller (Prove that we can execute just as well as the current proprietary applications).
  5. Create new configurable UI with ES-suggested features.
  6. Create Installer.
  7. Distribute to ALPHA Users
  8. Create FAQ.
  9. Poll for cross-platform support if there is significant interest.
  10. Develop final Feature List
  11. Impliment features
  12. Deploy to BETA Users
  13. Code and Feature complete; fix bugs.
  14. Ship it.
Current Status
  • I have only spent a few minutes on this but in that short time I cobbled together a serial port communicator where I could repeatedly send “38 38 38 888”. Once I closed the momentary connection (like we would normally on flash) I received back a profound reply of “U”. Tasks 1 and 2 are completed.
  • In the process of completing Task 3, I have been evaluating the configuration string that is generated by the former application. It turns out we have a bit of work to do here. I will post the data structures very shortly and explain.
Schedule
I will work on this project ad hoc until I leave for holiday which is next Monday. I haven’t decided yet to take a netbook/laptop, but it would likely keep me from going stir-crazy during travel and late evenings when normal people sleep. However this has my attention when not distracted.

Request for volunteers
It would be great to get others involved. We need to identify the patterns in the data structure, gather feature requests, test our output, and manage feedback. Who wants a piece?

References
Keywin E-bike Lab Parameter Designer Software Manual ver 1.2
Beta Testers Wanted On Updated Lyen Controller Program @370A
Infineon has REGEN BRAKING (and more)

Resources
Serial Port Monitor

Thanks for your contributions.
~KF
 
I'm definitely in. We definitely need alternative programmers from the infineon controllers. Would be happy to ALPHA test.
 
Data Structure

This is work in-progress. I have identified the following relationships between the ASV file and the data as written to the controller. More effort is required here because the patterns are not obvious, though we may be able to draw some early conclusions.

Infineon/EB806 example
Controller_DataStruct.png

Link to full image here.

As you can see ~ I am still working on sorting out the relationships. It is time-consuming and tedious. I would greatly appreciate some help here should anyone like to take this on. Here's what I've gather so far:

Controller_DataWrites0.png

Link to full image here.

  • There is a relationship between Index 2 of the Written Data and any parameter; my thinking is that this is a checksum.
  • Also there are non-linear progressions on Phase Current sequences, as well as differences between Board Types. I simply don't have enough data to create a pattern though.
That's what I know so far; I should be able to return to this later this evening.
~KF
 
grindz145 said:
I'm definitely in. We definitely need alternative programmers from the infineon controllers. Would be happy to ALPHA test.

Thanks grindz145 :)

I am using the Serial Port Monitor from the Resources section; Mike1 - I tried the one you suggested but I could not get it to execute on my system. I suppose any of these monitoring apps will do; I grabbed the first one I could fine (it has a 14-day timeout on the demo).

The fields that are tedious are the ones with a boat-load of values. The Phase Current appears to skip around when written out.

grindz145, can you take a stab at collecting information? Can you take Reverse Speed, use an AVS that you know, start at the top, record each change, how it affects the Written Data, and remit back please? :)
 
Which parameter designer are you trying to reverse engineer a protocol for?

I have a physical level wedge for serial IO (protocol analyzer) I built up some time ago for other purposes but I've got logs of 846 MCU flashing on 6, 9 and 12 FET versions of Infineon and I can assign just silly values to allow tracking of what parameters go when...

This is an endeavour I got into a while ago (reversing the protocol and writing a replacement package) but I've been so busy I didn't get beyond a basic UI with a plugin interface for each controller MCU - basically handling the serial IO in the GUI portion (sort of) and then implementing the individual save, load and restore/flash protocol for each specific controller mcu type... seemed the most logical method so it could be easily adapted to other MCUs as they come on scene.

Let me know if I can be of any assistance - I may be able to save you some serious work!

-Mike
 
Here is the revised Data Structure et al…

Controller_DataStruct1.png

Link to full image here.

Briefly, the differences are:
  • Infineon writes 24 sequential bytes of data, beginning with two signature bytes, with the 3rd byte as the checksum, and the last six held in reserve, whilst the ASV is 16 rows in length.
  • 116 writes 32 sequential bytes of data, beginning with two signature bytes, though using the last byte as the checksum, with the last seven of eight held in reserve, and having an ASV that is 22 rows in length.
Toss in a little bit of color-coding for differentiation, and we can better appreciate this cryptic information :roll:

Hey Mike (mwk), thanks for the offer; I am certain we can work something out my friend :)

The part that is difficult for me to kanoodle is when
  • We change boards, what is changing and why
  • We change values where there are more than three choices
My initial investigation suggests that there is some jumping around and non-linear progressions in the data written. I can’t define a pattern until I see all the data for all the params.

Fortunately I have just finished doing the basic mapping; well… a quasi-mapping. It’s kinda like mapping DNA: I got through part of one controller, then switched over to the other controller and wrapped it up. In the process I discovered that though the two controllers look and act very similar, they are more like cousins than brothers. But they all belong to the same genus so we’re cool… we’re chillin’… in the groove man… 8)

They have signature bytes in the beginning, separate checksum bytes, data values, and reserved bytes; it’s very simple and pretty much the way I would have done it.

So the plan Stan is to start twiddling with the variables; what is exactly the progression for one board and does it apply to the next? Once we figure that out then we can write our own configurations with our own home-rolled interface :mrgreen:

And then we dogfood it (no offense DogMan)

Mike, do you have a way to automate the application to get these values?

Phooey; beat tired.
OT: At least I’ve got my new Lyen Mini Monster to play with; I hope to slap that puppy on P0 tomorrow :wink:

Cheerios, KF
 
K,

So I think I understood the half exhausted hack lingo -

1.) The various 116, 846 and even more recent Infineon based MCUs all share a similar flashing / parameter updating method. There are differences between both the values which their various softwares expose and in what they will actually accept (in regards to a hex edited Parameter Designer and setting things like LVC to 45v dead on).

2.) Other controllers and devices utilize a very similar (probably different pinout) protocol, or atleast they will all share the same fundamental serial IO and have their own protocols and data formats and structures.

3.) By automate the program - do you mean to enumerate all the "given" variables, selections offered in Parameter Designer for a given version? No need, we can strip it right from the .exe files or if you prefer I can whip a message app up that will enumerate all the possible values in each combo box presented on the screen...

Either way, you want not only the defaults but the ability for users to edit the definition of acceptible / displayed parameters too.

The part that is difficult for me to kanoodle is when

> We change boards, what is changing and why ?
Do you mean when we change board model in a particular parameter designer or literally when you physically switch from a 116 based board to a 846 based mcu and vice versa?

> We change values where there are more than three choices
Do you mean - you don't understand how they are handling the offering of more than 3 choices in the GUI? Those are comboboxes and as I have pointed out elsewhere... they are all loaded/populated with variables/strings stored right in the .exe file... thats why you can modify a copy of Parameter Designer for a given version with any values you may want to try... some will not be accepted and the flash will fail (as I recall the response from the controller will actually indicate error).

In pCode this would be:

Code:
'
' Load PrimaryCurrentLimit dropdown with 20-45A limits
'
Dim pArrayOfValues() as String = "20","25","30","35","40"
Dim x as Integer = 0

Do
 ComboBox_PrimaryCurrentLimit.Add pArrayOfValues(x)
 x += 1 ' Increment x
Loop Until x = uBound(pArrayOfValues)

Erase pArrayOfValues ' Cleanup

How do you plan to store the "hard definitions" as provided in the default programs? XML would work well for this as there are many nodes and levels but a simple interative text file (just like the asv files) could be used also - the previous would be more elegant and allow for a more "open ended" definition structure to be loaded using "named" elements.

Assuming this formats and allows the XML to be embedded... it would need to look somthing like this:

Code:
<controller name="Infineon EB2XX" mcu="116">
<boards>
 <board>EB206</board>
 <board>EB209</board>
 <board>EB212</board>
 ...
</boards>
<limits>
   <primary begin="10" end="85" increment="5" />
   <phase begin="15" end="130" increment="5" />
   <speed1 begin="50" end="100" increment="1" />
   <speed2 begin="50" end="110" increment="1" />
   <lvc begin="31.5" end="85" increment="5">
    <lvcitem volts="45" />
   </lvc>
   ...
</limits>
</controller>
<controller name="Infineon EB8XX" mcu="846">
...
</controller>
-Mike
 
Hello Mike

Item 3: Automate as in "create a test harness". I have zero-experience in that regard, however I have seen my SDETs wire these things up where they can iterate through each value of every combobox, submit, trap the result (if we use a serial monitor) and record it in whatever format for consumption downstream.

I have the values for the Booleans and tri-states; no issues there.

The problem is when we select Phase Current for example. Method:
  • Select value 30, submit, capture written data – particularly at the offsets that I have mapped out. Next…
  • Select value 35, rinse repeat all the way to value 160.
  • Reset.
  • Begin anew with Rated Current.
I have not gone through a whole series with one combobox, however this would be a perfect case for a test harness. I just don’t have any experience, and really – that’s what we need to bludgeon through all these comboboxes.

The second part of your statement with regards to XML is actually a preview of where I certainly would like to go as a configurable interface, but that’s cart-before-the-horse. First we have to figure out how the current apps are generating the content from our input because I believe it is not linear.

Example: Speed Limit
  1. I set the value to 30, submit, captured “26”.
  2. Set for 31, captured “28”
  3. Set for 32, captured “29”.
This tells me that there is a progression, possibly a curve, sine-function ~ who knows; can’t predict without more intelligence. I don’t wish to do this manually. A test harness would be perfect. Throw the data into Excel, fit a curve, get the formula; boom – done. Next…

Make sense? Yer on the East Coast; maybe I should call you in my morning.
~KF
 
Hi guys,

I'm not a coder, But I am an IT admin for a software company, and it looks like we need a SCM for code sharing. I setup a simple (blank) subversion repo on google code. I've gotta sleep. (work in 2 hours!) but if you want to join the project to add code, just let me know.
http://code.google.com/p/es-controller/
 
I stopped working on this a while ago. We have decided on a new direction with this thread:
http://www.endless-sphere.com/forums/viewtopic.php?f=2&t=20731

Enjoy, KF
 
Back
Top