Title: Add a new AFR variable in KWP1281 protocol. DONE Post by: fknbrkn on December 29, 2014, 03:41:30 PM ive got cluster fis control, he`s ability to display vcds measurement groups. and here`s an idea - declare new variables to show current AFR (simply calc with lamsoni and lambsg)
i know how to add its to vcds but idk how to make it from scratch and has no idea where to start from Title: Re: Post by: byzan a4 on January 02, 2015, 04:11:45 AM Interested in this. I have v1 fis box. Can this be done on that too
Title: Re: how to add a new variables Post by: fknbrkn on January 02, 2015, 06:46:11 AM im making my first steps with asm :)
all seems ok to add new variable in vcds group we need to know # of variable (page 1555 FR - 1 nmot, 2 rl, etc) but i cant find where variables are getting their # Title: Re: how to add a new variables Post by: fknbrkn on January 02, 2015, 08:37:53 PM holy sh
i did it! can log 0x385EE0 for now :) which is copy of lamsoni_w oh its very hard for me still dont know how to multiply its by 14.7 (bricked ECU with MUL-s tryouts :() and where is variable physical #`s stored to saw that variable in vcds Code: pussy_afr EQU 5EE0h ;385EE0h Title: Re: Add a new AFR variable me7.5 Post by: fknbrkn on January 03, 2015, 09:27:29 PM ok ive recovered bricked ECU (btw nefmoto, mpps and galleto doesnt help me in boot mode, only chiploader with dumb kkl cable helps)
and multiply my new variable by 14 but dont know how to multiply it by 14.7 :))) offcourse i can simply use any other factor with untouched value but still dont know where those factors are stored in ecu any help will be appreciated im totally noob in asm :) Title: Re: Add a new AFR variable me7.5 Post by: nyet on January 03, 2015, 11:02:38 PM and multiply my new variable by 14 but dont know how to multiply it by 14.7 :))) You can use cheap fixed point integer math: x * 15 - (x*30/100) or (x*15/50) or .. etc.. down to (x*3/10) depending on how much overhead you have in your variable. which will get you close. Title: Re: Add a new AFR variable me7.5 Post by: fknbrkn on January 04, 2015, 09:24:18 PM Thanks nyet ive made it!
here is mine alot of noob code for desired and actual AFR variables. ive using this formula for calculation ((x/2)*15)-((x/2)*3/10) Now im planning to find some 2 unused second O2 sensor (already turned off) variables which is already existed in FR and have their physical adress to add them into vcds group and use them to show AFR. then i log them and make a same fake variables to replace them in ecu routines. Am i right? Code: actual_afr EQU 5EE0h ;385EE0h Title: Re: Add a new AFR variable me7.5 Post by: aef on January 05, 2015, 03:50:07 AM i know how to add its to vcds It is descibed here: http://nefariousmotorsports.com/forum/index.php?topic=2349.0title= but I am not sure if i understood your last sentences. Title: Re: Add a new AFR variable me7.5 Post by: fknbrkn on January 05, 2015, 05:50:36 AM It is descibed here: http://nefariousmotorsports.com/forum/index.php?topic=2349.0title= im sorry my english isnt good :( i will try to explainbut I am not sure if i understood your last sentences. i know how to add existing variables to vcds because they have some kind of offset (1 nmot, 2 rl etc at page 1555 FR) but idk how to add a new variable which have not. i spend all night searching where stock variables getting this offset with no luck so im planning to take an unused second o2 sensor variables (that already have their offsets and can be added into vcds, i didnt searching right ones yet so lets imagine that they are called lam20 and lam21) and use them to show AFR in vcds. but they also gettings values from stock routine and im not sure that this new value will not affect to some other ecu stuff even if second o2 turned off, so i want to create dummy variables with fixed values (like a stock lam20 and lam21 with unplugged o2) and completely replace everywhere in ecu lam20 & lam21 to my dummy20 and dummy21 adresses. thats my masterplan! Title: Re: Add a new AFR variable me7.5 Post by: fknbrkn on January 05, 2015, 05:31:35 PM nope
nop nop seems that somewhere stored a table with a factor, value limits, offset etc like in .ECU file and linked to memory adress not variable. im completely moved all instances of lamelsh_w to another memory adress and now its factor, offset etc are changed my 14.7 working good at default lamelsh_w adress but in VCDS its limited to 1.99 nothing i can do now :( Title: Re: Add a new AFR variable me7.5 Post by: fknbrkn on April 22, 2015, 03:24:57 PM ok now i know how it works
here is the source code for 032HN_0001 working good on a bench will posting file tomorow after the road test :) Code: lamsbg_w EQU 09F78h ;38 desired afr 381ECAh = 9F78h Title: Re: Add a new AFR variable me7.5 Post by: vwaudiguy on April 22, 2015, 03:54:14 PM I know absolutely nothing about this type of stuff. Where is this code stored you are modifying? Pretty cool project!
Title: Re: Add a new AFR variable me7.5 Post by: fknbrkn on April 22, 2015, 04:54:47 PM Here is the original code at 0x835BA
Code: movbs r4, dwkrz_6 dwkrz_6 is unused variable in 1.8t (ignition retard cyl 7) and has phys num 94 (FS page 1555) now here is a kwp1281 formulas table http://nefariousmotorsports.com/forum/index.php?topic=22.0 r8 - data type / factor r7 - A r6 - B unfortunaly there is no available space for afr math so i changed it to Code: calls 8Bh, #3A00h and place a new code at 0xB3A00 and the other part for desired afr using dwkrz_7 with the same way after that i put 94 and 95 in a vag-com 17 channel (it was dwkrz_6 and dwkrz_7 and now its an actual and desired afr) edit: moved to 35ch - lambda section :) and job`s done :) im also creating a new variables "act_afr" and "des_afr" because im planning to send them via CAN to cluster display Title: Re: Add a new AFR variable in KWP1281 protocol. DONE Post by: vwaudiguy on April 25, 2015, 06:04:48 PM Another thing over my head, oh well! ;D Great work, and thanks for the explanation though! Time to get familiar with disasembly I guess??
Title: Re: Add a new AFR variable in KWP1281 protocol. DONE Post by: prj on April 26, 2015, 09:03:23 AM This is done way too complicated.
In KWP1281 there are certain formulas to be used. For example if you use formula 8, it is 0.1*a*b. If you set normvalue a to 1, then your formula becomes 0.1*b, that way you have a range between 0 AFR and 25.5 AFR with a granularity of .1 AFR. Taking lamsbg_w, the factor to convert to lambda is "0.000244141" and to AFR "0.0035888727" However, because the formula is 10 times bigger, it means the factor needs to get multiplied another time, by 10. So getting the factor of 0.035888727. All you need to do after that is convert this to a factor and a normvalue. Meaning solving the equation X/(2^Y) = 0.035888727, so that the answer is as precise as possible. If you take Y = 16, then you do not even have to shift anything, you can just take MDH, and bounds check it. With Y=16 , you get 2352.0036. That's precise enough. Meaning all of your code in case of formula 8 in KWP1281 can be abbreviated as: MOV R4, lamsbg_w MOV R5, #9E4 MULU R4, R5 A three liner, after which the result is in MDH. If you want you can bounds check it, but it should not be neccessary. just MOV R4, MDH and MOV answerbyte, RL4 Title: Re: Add a new AFR variable in KWP1281 protocol. DONE Post by: fknbrkn on April 27, 2015, 04:23:19 PM im not good at math :-\
|