Little endian CAN passthrough troubleshooting

For discussion of Phil Tobin's Tuner Studio software (Only about the tuning software itself, not about how to tune or firmware features)

Moderator: LT401Vette

Little endian CAN passthrough troubleshooting

Postby KeithBoden » Sun Nov 19, 2017 9:43 am

I'm building a CAN bus device that is compatible with Tunerstudio's 29-bit CAN passthrough. So far, my controller properly handles MSG_CMD, MSG_REQ, MSG_BURN, MSG_XTND, MSG_PROT, and properly sends MSG_RSP and MSG_BURNACK messages. I can start TunerStudio MS with my CAN device hooked to the CAN bus off my MS3-Pro, and can see TunerStudio request the Signature, RevNum, Protocol and the 1 page of data I have (64 bytes). When this happens, I can see TunerStudio making 8 requests for the page, 8 bytes at a time as expected.

I am currently doing this with the .ini file for the device set as big endian. Data does get written to my device ram and eeprom on a burn, however, since my device is actually little endian, the data for multi-byte values doesn't go into my struct for the page correctly. Totally makes sense, TunerStudio is sending the data big endian as requested.

If I change the ini file to little, reload it in TunerStudio for the device, and then go online, here is what happens:

TunerStudio requests Signature and RevNum. Since these are character strings, endianness doesn't come into play and TunerStudio is happy.
TunerStudio requests the Protocol. I send [2, 0, 64, 0, 64]. I'm not 100% sure what these values do but I think since my page size is 64, they are ok. (I also tried [2, 64, 0, 64, 0] in case the blocking factor and write blocking factor are interpreted based on the endianness in the .ini file)
Then TunerStudio starts requesting the table data but it continues to request blocks of data after the 8 requests:
Req Table 4 Offset 0
Req Table 4 Offset 8
Req Table 4 Offset 16
...
Req Table 4 Offset 56
Req Table 4 Offset 64 <- This one doesn't happen when set to big endian

If I don't respond to the request, TunerStudio errors out stating that it didn't get a response (makes sense). If I respond with junk data, TunerStudio keeps requesting additonal data, 72, 80, 88... until a timeout occurs since it has taken too long to get the page.

Is it possible that TunerStudio is interpreting my pageSize, which has to at least be a 16 bit number, using the same endianness as the .ini file? In other words, my specified table size of 0x0040 is being interpreted as 0x4000 = 16384? Or is there something wrong in my .ini file or protocol response that is causing this behavior?

.ini file attached, and I can gladly send logs of anything you would like to see to help work this out!
Attachments
controller.ini
(6.58 KiB) Downloaded 4 times
Camaro, Mark IV aluminum big block Chevy, 8.8l, Procharger F1-R @ 12psi, MS3Pro
KeithBoden
MS/Extra Newbie
 
Posts: 25
Joined: Tue Oct 11, 2016 2:22 pm

Re: Little endian CAN passthrough troubleshooting

Postby KeithBoden » Sun Nov 26, 2017 9:22 am

LT401Vette, you are probably the only one who can help - appreciate your time if you can spare a few minutes!

I'm working on this to help out another guy that wants to run a hydraulically controlled differential with his MS3. (http://www.msextra.com/forums/viewtopic.php?f=125&t=67471) I think the best way to do it is with an add on device and we'd love to be able to tune it through the CAN passthrough. Is it possible that the endianness issue is a small fix in TunerStudio? I'm running the paid version of TunerStudio and don't mind sending some Paypal to bump the priority up on this if it helps :D
Camaro, Mark IV aluminum big block Chevy, 8.8l, Procharger F1-R @ 12psi, MS3Pro
KeithBoden
MS/Extra Newbie
 
Posts: 25
Joined: Tue Oct 11, 2016 2:22 pm

Re: Little endian CAN passthrough troubleshooting

Postby LT401Vette » Mon Nov 27, 2017 9:29 am

I will have a look and try to get a fix in the beta.
I don't have any little endian boxes around here that use a blocking factor :-P
Phil Tobin
EFI Analytics, helping to simplify EFI
Next Generation tuning software.
Supporting all MegaSquirt versions and firmwares.
http://www.TunerStudio.com
http://www.efiAnalytics.com/MegaLogViewer/
Support the firmware running your engine:
http://www.msextra.com/doc/donations.html
User avatar
LT401Vette
Super MS/Extra'er
 
Posts: 10389
Joined: Sat Jul 16, 2005 8:07 am
Location: Moorseville, NC

Re: Little endian CAN passthrough troubleshooting

Postby LT401Vette » Mon Nov 27, 2017 10:14 am

Can you capture a Comm Debug log of this?

in my testing blocking seems to be working in little endian.
Phil Tobin
EFI Analytics, helping to simplify EFI
Next Generation tuning software.
Supporting all MegaSquirt versions and firmwares.
http://www.TunerStudio.com
http://www.efiAnalytics.com/MegaLogViewer/
Support the firmware running your engine:
http://www.msextra.com/doc/donations.html
User avatar
LT401Vette
Super MS/Extra'er
 
Posts: 10389
Joined: Sat Jul 16, 2005 8:07 am
Location: Moorseville, NC


Return to Tuner Studio

Who is online

Users browsing this forum: No registered users and 3 guests