Title: McMess syncronous crank read -> am i blind ?!!! Post by: fluke9 on October 16, 2019, 02:16:18 PM Got mcmess syncronous crankshaft reading running, but only once...
I switch to sync mode by 3d and begin to send my bytes in a the timeslots i want the results but it only returns the 6 bytes once, then craps out. What i can think of is that S0RBUF is filled with its own answers and it branches out the check in 0x82246E or is there a way either with S0CON or any other way that i does not see its own answers? Does Bosch run mcmess with seperate rx/tx ? As i want to patch it later on relocate ram to a bigger table i might patch that anyway but i am just wondering. The function on the crank trigger looks like this: Code:
Title: Re: McMess syncronous crank read -> am i blind ?!!! Post by: fluke9 on October 16, 2019, 02:23:43 PM Oh and forgot to mention, ofcourse i set the 9th bit for the request bytes...
Title: Re: McMess syncronous crank read -> am i blind ?!!! Post by: fluke9 on October 16, 2019, 02:59:55 PM man, i feel stupid...
and man this protocol sucks... answering myself: yes, it sees its own answer and therefore tears down the connection, the solution is to send a request as soon as you see the last answer byte so you overwrite whats in S0RBUF currently... Which forces you to log every revolution or none at all... Small patch would make this much more usable as you could trigger every revolution after x ms have been elapsed, it just should not bail out and tear down everything... Title: Re: McMess syncronous crank read -> am i blind ?!!! Post by: woj on October 17, 2019, 03:51:20 AM I am too lazy to go through your code in detail, and my knowledge about C167 serial communication over k-line was much better several years ago when I also had to go through some unbearable crap to get it working. In any case, these are some fragments of what I think I remember, with k-line there is some weird interaction going on between TX and RX, and it's not only about echoing but also the interrupts. Long story short, these are my sending and receiving procedures I use in my boot code for ST10:
Code: send_byte: Not exactly what you would expect after reading the specs... Not sure though if this is what you stumbled across and whether it solves your problem. Title: Re: McMess syncronous crank read -> am i blind ?!!! Post by: fluke9 on October 17, 2019, 04:55:04 AM My send/receive code ages ago looked similar ;-) Thanks, got it working, mcmess really kicks itself out. So if you want to use the syncronous crank reading feature you must read every rotation, otherwise you are kicked out because it reads a byte which it sent itself. And as the databytes it sends itself do not have the 9th bit set (9N2) it will jump out and tear down the connection. Solution is as i said to send a byte with the 9th bit set as soon as you are done reading the last databyte it sends, this will overwrite the byte in S0RBUF. i patched this with a nop and now i can read at my pace. Next thing is to bump up the table size to something more useful and maybe move the sending routine from the crank to a periodic task like the 2ms task. Title: Re: McMess syncronous crank read -> am i blind ?!!! Post by: prj on October 17, 2019, 10:38:16 AM If you're patching shit anyway then why are you bothering with all this bullshit?
Just send a constant stream of data to the port at a very high baud rate. 187500+ Send two sync bytes at the start, so your client knows where the packet starts, job done. If you want to be more advanced, listen to incoming stuff as well and have two commands - one that sends a list of addresses which are written to RAM and a 2nd one that sends their values. Like Dynadefine... I've been doing it this way on all older Porsche and VAG control units. Title: Re: McMess syncronous crank read -> am i blind ?!!! Post by: fluke9 on October 17, 2019, 12:46:05 PM If you're patching shit anyway then why are you bothering with all this bullshit? Because the mcMess routines are all the same in the ME7.1 ME7.3.1 and ME7.6 binarys i disassembled.Setting up the addresses is already in McMess, works fine, only needs a larger table. So its like Dynadefine already. Looks like i can get this done with a few quite simple byte patches, and as the signatures for the mcmess routines will be the same i can do a fully automated patcher easily. Thats the plan, so i dont have to patch that shit in manually anymore after it has been done once. I've been doing it this way on all older Porsche and VAG control units. Yeah can do, i want something more generic and highspeed McMess is already at 125kbaud and can be done with the shittiest KKL cables i have here.Title: Re: McMess syncronous crank read -> am i blind ?!!! Post by: prj on October 18, 2019, 03:07:12 AM FT232 KKL cables happily do 187500 baud and even more. BTDT.
If you're patching the code, as I said, just patch in your own protocol instead of the mcmess. That can be done fully automated too, and you are free of all restrictions. But really, to tune the car, readMemoryByAddress is enough, it works on all the ECU's and gives enough sample rate (if you don't try to log the world) to fully tune the car... Here's Alfa 166 3.2L with SC for example: (https://scontent.fhen1-1.fna.fbcdn.net/v/t31.0-8/28827185_1860850790656153_1907030497016871086_o.png?_nc_cat=100&_nc_oc=AQmZByfz-MnkBTWDkq3cpSS4C8kOPuWVh8M4qJsa8yqrmDRqf-_SX4PTJPK83OhrJsU&_nc_ht=scontent.fhen1-1.fna&oh=043f02eab11f13baafe56a0071caafe8&oe=5E27120F) All I used was readMemoryByAddress and was able to modify everything that I needed. Title: Re: McMess syncronous crank read -> am i blind ?!!! Post by: fluke9 on October 18, 2019, 03:51:22 AM FT232 KKL cables happily do 187500 baud and even more. BTDT. Never tried, even 125kbaud is blazingly fast enough.If you're patching the code, as I said, just patch in your own protocol instead of the mcmess. Sure, thinking of replacing the mc mess ;-)That can be done fully automated too, and you are free of all restrictions. But i would keep the "infrastructure code" around it as it nicely blends in with kwp2000 and co, Resets everything correctly after the McMess session is done. So you can establish a KWP2000 session later and is safe to use in one of the tasks at uses the PECC to transfer the data out so you wont add silly delays to the existing code which might or might not mess things up if you transfer out a lot of data. Has a decent enough init with the fast init sequence and so on etc etc. But really, to tune the car, readMemoryByAddress is enough, it works on all the ECU's and gives enough sample rate (if you don't try to log the world) to fully tune the car... Sure, would/will be enough, but i also like to poke and play around a bit. Want to do some more asm modding stuff too like using spare outputs for a shiftlight or water/methanol injection and things like that. Of course i want to do the SC tune later on but this will most likely happen after the SC has been fitted during the winter months. Meanwhile i will play with the spare ECU on my bench as i have an old megasquirt stim to supply signals. Here's Alfa 166 3.2L with SC for example: Nicely done, was getting about the same power/torque curve albeit a bit lower in total (347PS) on my GTV 3.0. All I used was readMemoryByAddress and was able to modify everything that I needed. Did you need to retard ignition ? Had to do nothing there, as there was no knock and it is still going strong after having covered almost 40000km with ignition on the old ME3.7.1 and fueling on a megasquirt. Title: Re: McMess syncronous crank read -> am i blind ?!!! Post by: prj on October 18, 2019, 05:59:29 AM Ignition maps needs axis extending and cell by cell tuning.
Throttle control needs adjusting. On this car returnless system was removed and return was fitted, so the compensation needed to be zeroed out. FKKVS needs to be cell by cell tuned. Load limit obviously increased. Zero patches needed to the code though on this ECU. It all just works if you know what you are doing. Setting correct lambda has huge influences on power. Without dyno tough to find. Title: Re: McMess syncronous crank read -> am i blind ?!!! Post by: fluke9 on October 19, 2019, 12:52:23 PM Ignition maps needs axis extending and cell by cell tuning. Throttle control needs adjusting. On this car returnless system was removed and return was fitted, so the compensation needed to be zeroed out. FKKVS needs to be cell by cell tuned. Load limit obviously increased. Zero patches needed to the code though on this ECU. It all just works if you know what you are doing. Setting correct lambda has huge influences on power. Without dyno tough to find. Thanks for the info ! Was the pump pressure not ok with the returnless system ? I was running my C30-94 in an 156 2.5 (swapped a 3.0 in) before and fuel supply did not seem to be an issue on the returnless system. Did use 470cc injectors (from the Z20LET or LEH iirc). Title: Re: McMess syncronous crank read -> am i blind ?!!! Post by: prj on October 21, 2019, 11:14:51 AM I don't know, I did not build the car. They brought it how it was and I made it work.
IIRC we had to fix a few bits and bobs, but nothing significant needed changing, it was surprisingly solid. Title: Re: McMess syncronous crank read -> am i blind ?!!! Post by: fluke9 on October 21, 2019, 03:02:34 PM Got it running with a few patched bytes,
can happily read a lot of data at 2 x crankspeed (see hz) Next thing is to wrap it up in a usable and configurable form and do an automated patcher... (https://i.ibb.co/QkJf4vv/crank.png) (https://ibb.co/r3QmV22) |