Addon device with CAN pass through
Moderator: LT401Vette
-
- MS/Extra Newbie
- Posts: 22
- Joined: Sat Apr 20, 2013 4:06 am
Re: Addon device with CAN pass through
I have tried option #2 with the most recent TS beta version and both with MS3 firmware versions "pre 1.3-alpha2" and "release 1.2.1" but didn't get a stable connection.
When powering up the MS3 and GPIO, TS tries to read data from the controller but is stuck at 0%.
Then after a few seconds the error message "Error reading data..." appears and yet another few seconds after that, another window pops up telling me that there was a connection but the firmware had configuration errors on my MS3.
I re-flashed the MS3 after that but with no effect.
When powering up the MS3 and GPIO, TS tries to read data from the controller but is stuck at 0%.
Then after a few seconds the error message "Error reading data..." appears and yet another few seconds after that, another window pops up telling me that there was a connection but the firmware had configuration errors on my MS3.
I re-flashed the MS3 after that but with no effect.
-
- Super MS/Extra'er
- Posts: 12733
- Joined: Sat Jul 16, 2005 8:07 am
- Location: Moorseville, NC
- Contact:
Re: Addon device with CAN pass through
Did you set the CAN ID on both the GPIO and in TunerStudio's Project Properties to mach?
It sounds like TS may have been set to talk to the wrong CAN ID.
It sounds like TS may have been set to talk to the wrong CAN ID.
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
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
-
- MS/Extra Newbie
- Posts: 22
- Joined: Sat Apr 20, 2013 4:06 am
Re: Addon device with CAN pass through
As I read in the "GPIO_template.ini", the GPIO's CAN ID is 1 while the MS3's is 0.
So naturally I set the target ID to 1 too.
So naturally I set the target ID to 1 too.
-
- Site Admin
- Posts: 39621
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
Re: Addon device with CAN pass through
Are you using the TemplateCWProject source code?
I've just had a look and that looks not to support the serial format and revision commands over CAN, meaning that TS will not be able to interrogate it.
To fix it, try the following changes to main.c and recompile and re-load the code. I have not tested this, but it is similar code from MS2/Extra that does work.
Around line 1416 replace
with
Such that row 0 in the table array is cltfactor, row 1 is sprfactor, row 14 is Signature and row 15 is RevNum.
James
I've just had a look and that looks not to support the serial format and revision commands over CAN, meaning that TS will not be able to interrogate it.
To fix it, try the following changes to main.c and recompile and re-load the code. I have not tested this, but it is similar code from MS2/Extra that does work.
Around line 1416 replace
Code: Select all
{ NULL, NULL, 0 },
// { NULL, (unsigned int *)&RevNum, sizeof(RevNum) }
};
Code: Select all
{ (unsigned int *)&Signature, (unsigned int *)&Signature, sizeof(Signature) },
{ (unsigned int *)&RevNum, (unsigned int *)&RevNum, sizeof(RevNum) }
};
James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
-
- MS/Extra Newbie
- Posts: 22
- Joined: Sat Apr 20, 2013 4:06 am
Re: Addon device with CAN pass through
I'm using the pre-copmiled version of that template, yes.
I've downloaded the source code too, but I'm unable to compile it because the compiler says that some code files are missing (though they're present in the folder). Am I missing some compiler parameters?
I've downloaded the source code too, but I'm unable to compile it because the compiler says that some code files are missing (though they're present in the folder). Am I missing some compiler parameters?
-
- Site Admin
- Posts: 39621
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
Re: Addon device with CAN pass through
I just tried and I get a boat load of errors with it too. Looks like the project was saved using absolute pathnames instead of relative.
James
James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
-
- Site Admin
- Posts: 39621
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
Re: Addon device with CAN pass through
Try the attached project file in place of the supplied one. It allows me to build here, but I have not tried the resulting firmware.
The ROM_VAR errors are an error, according to the Codewarrior documentation there's no such #pragma - I believe it should be
#pragma CONST_SEG ....
James
The ROM_VAR errors are an error, according to the Codewarrior documentation there's no such #pragma - I believe it should be
#pragma CONST_SEG ....
James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
-
- MS/Extra Newbie
- Posts: 22
- Joined: Sat Apr 20, 2013 4:06 am
Re: Addon device with CAN pass through
Hm... still not working as intended.
After starting the "make" process with the main.c (that's the correct file to start from, right?), I'm getting many warnings (regarding possible loss of precision) and errors (regarding uninitialized variables).
Could you upload the complete project folder so I can rule out errors on my side?
After starting the "make" process with the main.c (that's the correct file to start from, right?), I'm getting many warnings (regarding possible loss of precision) and errors (regarding uninitialized variables).
Could you upload the complete project folder so I can rule out errors on my side?
-
- Site Admin
- Posts: 39621
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
Re: Addon device with CAN pass through
Try the attached, it compiles with a couple of warnings, but I have not tested it on hardware.
If it works, you'll need to upload it to MSGIO to comply with the license. I do not have a user account there.
The warnings you are seeing about floating point might indicate that the code is using some code that accidentally triggers floating point maths, I noticed in the compiler flags that I removed a flag to disable floats. Floating point is generally a poor idea on the S12 as it will likely consume a lot of CPU cycles.
James
If it works, you'll need to upload it to MSGIO to comply with the license. I do not have a user account there.
The warnings you are seeing about floating point might indicate that the code is using some code that accidentally triggers floating point maths, I noticed in the compiler flags that I removed a flag to disable floats. Floating point is generally a poor idea on the S12 as it will likely consume a lot of CPU cycles.
James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
-
- MS/Extra Newbie
- Posts: 22
- Joined: Sat Apr 20, 2013 4:06 am
Re: Addon device with CAN pass through
I don't get it...
All I'm getting is the attached picture, though I'm absolutely certain that the "missing" files are right there in the same folder the main.c is located.
All I'm getting is the attached picture, though I'm absolutely certain that the "missing" files are right there in the same folder the main.c is located.
-
- Site Admin
- Posts: 39621
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
Re: Addon device with CAN pass through
main.mcp ? Where did that come from ? template.mcp is the project file you should be using.
James
James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
-
- MS/Extra Newbie
- Posts: 22
- Joined: Sat Apr 20, 2013 4:06 am
Re: Addon device with CAN pass through
Oh well, my bad - probably been too tired yesterday.
I've managed to compile the Project to a .s19 file and flashed it onto the GPIO board.
Afterwards I tried the CAN pass through connection with both methods mentioned before, here's what happened:
#1: Create Project as usual, add CAN device in the corresponding tab with the template's .INI file for the GPIO board
Result:
--> Yes
Shortly afterwards:
#2: Create Project as usual, switch CAN ID in the devices tab to 1 (which should be the GPIO's ID)
Result:
To be honest, my experience with programming microcontrollers is fairly limited, so I'm not quite sure how to resolve this.
And by the way, thanks for all the help so far!
I've managed to compile the Project to a .s19 file and flashed it onto the GPIO board.
Afterwards I tried the CAN pass through connection with both methods mentioned before, here's what happened:
#1: Create Project as usual, add CAN device in the corresponding tab with the template's .INI file for the GPIO board
Result:
Code: Select all
There were 9 errors and 1 warnings during project load.
Would you like to review them now?
Code: Select all
9 Errors:
Error: Variable 'vss2' used in expression, but not defined as OutputChannel or Setting Parameter., Problem at:
[ms3Supplement.ecu]:[Line:47]: tsVehicleSpeedMph = { tsSpeedSource == 0 ? GPS.gpsSpeedMPH : (tsSpeedSource == 1 ? vss1 : (tsSpeedSource == 2 ? vss2 : (tsSpeedSource == 2 ? userSpeedMph : 0 ) ) ) }, "MPH" ; provides selector for speed channel
Error: Variable 'staged_pri_size' used in expression, but not defined as OutputChannel or Setting Parameter., Problem at:
[ms3Supplement.ecu]:[Line:49]: tsInjectorSize = { staged_pri_size }, "cc/min" ;normalized to cc/min
Error: Variable 'rpm' used in expression, but not defined as OutputChannel or Setting Parameter., Problem at:
[ms3Supplement.ecu]:[Line:50]: tsSmoothRPM = { rpm }, "RPM";, hidden ; MS2 already has a Lag built in to RPM
Error: Variable 'rpm' used in expression, but not defined as OutputChannel or Setting Parameter., Problem at:
[ms3Supplement.ecu]:[Line:52]: tsWorkingRpm = { rpm }, "RPM", hidden
Error: Variable 'altDiv1' used in expression, but not defined as OutputChannel or Setting Parameter., Problem at:
[ms3Supplement.ecu]:[Line:56]: tsNetDutyCycle1 = { cycleTime1>0 ? 100.0*nSquirts1/altDiv1*(pulseWidth1-injOpen1)/cycleTime1 : 0 }, "%"
Error: Variable 'nInjectors' used in expression, but not defined as OutputChannel or Setting Parameter., Problem at:
[ms3Supplement.ecu]:[Line:57]: tsFuelFlow= { tsNetDutyCycle1*tsInjectorSize*nInjectors/100 }, "cc/min" ;
Error: Variable 'pulseWidth1' used in expression, but not defined as OutputChannel or Setting Parameter., Problem at:
[commonSupplement.ecu]:[Line:68]: instantMPG = { pulseWidth1 == 0 ? 99 : tsInputSpeedMPH/tsFuelFlowGph }, "MPG"
Error: Variable 'pulseWidth1' used in expression, but not defined as OutputChannel or Setting Parameter., Problem at:
[commonSupplement.ecu]:[Line:71]: instantMPL = { pulseWidth1 == 0 ? 49 : tsInputSpeedMPH/tsFuelFlowLph }, "Miles/L"
Error: Variable 'pulseWidth1' used in expression, but not defined as OutputChannel or Setting Parameter., Problem at:
[commonSupplement.ecu]:[Line:74]: instantKmPL = { pulseWidth1 == 0 || tsVehicleSpeedKph < 1 ? 0 : tsVehicleSpeedKph/tsFuelFlowLph }, "Km/L"
1 Warnings:
Warning: [UserDefined] field assigned to invalid Constant 'staged_pri_size'., Problem at:
[ms3Supplement.ecu]:[Line:11]: field = "Primary Injector Size", staged_pri_size
Code: Select all
Error reading data from after 3 attempts
Error message returned:
Serial Failure, Unable to get all pages of data after multiple attempts.
Application will now go offline. To attempt going back online
check the Project menu when connection problems are resolved.
#2: Create Project as usual, switch CAN ID in the devices tab to 1 (which should be the GPIO's ID)
Result:
Code: Select all
Warning!!!
Communication Established!
However, there is a configuration error with your firmware.
Check to make sure your MS3 firmware is correctly loaded.
Going offline
And by the way, thanks for all the help so far!
-
- Super MS/Extra'er
- Posts: 12733
- Joined: Sat Jul 16, 2005 8:07 am
- Location: Moorseville, NC
- Contact:
Re: Addon device with CAN pass through
All those errors are based on an MS3 project.
Weren't you trying to talk to the GPIO?
Weren't you trying to talk to the GPIO?
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
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
-
- MS/Extra Newbie
- Posts: 22
- Joined: Sat Apr 20, 2013 4:06 am
Re: Addon device with CAN pass through
Yes I was, and when I disconnect the GPIO or don't change anything in the CAN devices tab, everything works just as intended.
-
- Super MS/Extra'er
- Posts: 12733
- Joined: Sat Jul 16, 2005 8:07 am
- Location: Moorseville, NC
- Contact:
Re: Addon device with CAN pass through
Ok... So the GPIO was still a secondary CAN controller.
That may be related to the problem 2.2.11 has with connecting to secondary controllers.
What if you make a project with just the GPIO board in it?
That may be related to the problem 2.2.11 has with connecting to secondary controllers.
What if you make a project with just the GPIO board in it?
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
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
-
- Super MS/Extra'er
- Posts: 9130
- Joined: Sun May 02, 2004 6:51 am
- Location: Quebec, Canada
- Contact:
Re: Addon device with CAN pass through
When using the second method, you need to tell TS to use the GPIO ini file not let it auto-detect or tell it to use the MS3 ini. Then once this is done, you set the CAN ID to 1. What you are now doing is simply creating another MS3 project with the wrong CAN ID.
Jean
Jean
-
- Super MS/Extra'er
- Posts: 9130
- Joined: Sun May 02, 2004 6:51 am
- Location: Quebec, Canada
- Contact:
Re: Addon device with CAN pass through
One more thing you need to do when setting the CAN ID to 1 is to tell TS to use the MS3 1.1+ serial protocol. This is in the same tab as the CAN ID.
Jean
Jean
-
- MS/Extra Newbie
- Posts: 22
- Joined: Sat Apr 20, 2013 4:06 am
Re: Addon device with CAN pass through
racingmini_mtl wrote:When using the second method, you need to tell TS to use the GPIO ini file not let it auto-detect or tell it to use the MS3 ini. Then once this is done, you set the CAN ID to 1. What you are now doing is simply creating another MS3 project with the wrong CAN ID.
Jean
When I do that, the CAN devices tab in the Project Properties gets greyed out and I can't open it (thus can't change anything there). Plus TS reports 9 errors and 7 warnings.
-
- Super MS/Extra'er
- Posts: 9130
- Joined: Sun May 02, 2004 6:51 am
- Location: Quebec, Canada
- Contact:
Re: Addon device with CAN pass through
Well, that's the only way to do it correctly so it's either that you have something wrong in the ini or that you're doing something wrong or a combination of the two. Please zip your project directory and post it here.SebastianS wrote:racingmini_mtl wrote:When using the second method, you need to tell TS to use the GPIO ini file not let it auto-detect or tell it to use the MS3 ini. Then once this is done, you set the CAN ID to 1. What you are now doing is simply creating another MS3 project with the wrong CAN ID.
Jean
When I do that, the CAN devices tab in the Project Properties gets greyed out and I can't open it (thus can't change anything there). Plus TS reports 9 errors and 7 warnings.
By the way, I do know how to create a project for CAN devices because I do that all the time with multiple devices. I've never done it for the GPIO but I know that with a valid ini file the way I described it is the correct method.
Jean
-
- Super MS/Extra'er
- Posts: 12733
- Joined: Sat Jul 16, 2005 8:07 am
- Location: Moorseville, NC
- Contact:
Re: Addon device with CAN pass through
Add this to your ini:
#unset CAN_COMMANDS
Then the CAN Deives Tab will enable.
#unset CAN_COMMANDS
Then the CAN Deives Tab will enable.
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
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