Tuner Studio for custom application
Posted: Sat Oct 24, 2015 5:20 am
I realize that this is not directly connected with RusEFI, but Andrey has made considerable progress in working with TS and I'm hoping that he or others may be able to lend me a hand.
I'm working on my own simple controller using the Freescale MC9S12XEP100 (same as MS3) and coded in assembler (because I don't speak any of the higher languages). I'm self taught in these matters so progress is very slow. I have test hardware built and basic code to communicative with TS, similar to how MS does it, but I have run into a major road block.
I’ve studied the assembler source code for MS1 and MS1-Extra and tried to makes some sense out of the "C" code for MS2, MS2 Extra and Megashift, as well as and comparing the TS .ini files for them and RusEFI. I thought I had a pretty good idea of how TS works and how it communicates. Not so in practice so it turns out. I’m trying to figure out the multibyte commands that are necessary for any page related command as well as the single page value write, but this is where I have come to a halt.
I’m using the Megashift .ini as a base, same as RusEFI. I started rather ambitiously with several pages, but when I couldn’t get that to work, I went back to a single page lay out.
These are the command settings I’m using TS:
queryCommand = "H"
signature = "MShift v0.01" ; (Tuner Studio MUST have this)
endianness = big
nPages = 1
pageReadCommand = "C"
burnCommand = "B"
pageSize = 1024
pageValueWrite = "W%2o%v"
ochGetCommand = "O"
Through experimentation I was able to determine that when connected to TS the first command sent by TS is the queryCommand. When the correct “signature” is returned, it sends the pageReadCommand to get the configurable constants. When the correct amount of data is returned, it sends the ochGetCommand to get the real time variables. When these are returned communication is established and it resends the ochGetCommand at ~ 125 ms intervals. When any of the configurable constants are changed in TS it sends the pageValueWrite command which (should) write the new value to the correct offset location from the start of the page (into RAM). After the change has been sent, pressing the “Burn” button will send the burnCommand which jumps to a burner routine to burn the new page in RAM to Flash.
So far, the single byte commands work as they should and communication is good, but I can’t get any multi byte command to work. In it’s simplest form, the pageValueWrite command. It should send a “W”, then the offset Hi byte, then the offset Lo byte, then the data byte. All I receive is the “W”, no other bytes. It’s like TS doesn’t recognize anything beyond the first command byte.
Any suggestions?
I'm working on my own simple controller using the Freescale MC9S12XEP100 (same as MS3) and coded in assembler (because I don't speak any of the higher languages). I'm self taught in these matters so progress is very slow. I have test hardware built and basic code to communicative with TS, similar to how MS does it, but I have run into a major road block.
I’ve studied the assembler source code for MS1 and MS1-Extra and tried to makes some sense out of the "C" code for MS2, MS2 Extra and Megashift, as well as and comparing the TS .ini files for them and RusEFI. I thought I had a pretty good idea of how TS works and how it communicates. Not so in practice so it turns out. I’m trying to figure out the multibyte commands that are necessary for any page related command as well as the single page value write, but this is where I have come to a halt.
I’m using the Megashift .ini as a base, same as RusEFI. I started rather ambitiously with several pages, but when I couldn’t get that to work, I went back to a single page lay out.
These are the command settings I’m using TS:
queryCommand = "H"
signature = "MShift v0.01" ; (Tuner Studio MUST have this)
endianness = big
nPages = 1
pageReadCommand = "C"
burnCommand = "B"
pageSize = 1024
pageValueWrite = "W%2o%v"
ochGetCommand = "O"
Through experimentation I was able to determine that when connected to TS the first command sent by TS is the queryCommand. When the correct “signature” is returned, it sends the pageReadCommand to get the configurable constants. When the correct amount of data is returned, it sends the ochGetCommand to get the real time variables. When these are returned communication is established and it resends the ochGetCommand at ~ 125 ms intervals. When any of the configurable constants are changed in TS it sends the pageValueWrite command which (should) write the new value to the correct offset location from the start of the page (into RAM). After the change has been sent, pressing the “Burn” button will send the burnCommand which jumps to a burner routine to burn the new page in RAM to Flash.
So far, the single byte commands work as they should and communication is good, but I can’t get any multi byte command to work. In it’s simplest form, the pageValueWrite command. It should send a “W”, then the offset Hi byte, then the offset Lo byte, then the data byte. All I receive is the “W”, no other bytes. It’s like TS doesn’t recognize anything beyond the first command byte.
Any suggestions?