Base GPIO code to work from?

A forum for discussing the applications and implementations of the DIY general code template for the GPIO and its 25 user inputs and outputs (+ serial & CAN). The code is 99% complete, the user just has to add their own conditional I/O logic and compile (with a free special Edition of CodeWarrior).
SebastianS
Posts: 16
Joined: Fri Apr 26, 2013 1:30 am

Re: Base GPIO code to work from?

Post by SebastianS »

Lance,

you're the best! Thank you!
With this firmware and INI, everything works as it should and I can connect to the GPIO by serial cable as well as by CAN pass through.

Now I can move on to the "real" challenge in my project: getting the EGT1 and VR 1 through 4 to work and display ;)

-Sebastian
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: Base GPIO code to work from?

Post by Bernard Fife »

Sebastian,

Great, I'm glad it's working for you. Good luck with your project!

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
Boben
Posts: 2
Joined: Sun May 12, 2013 2:47 am

Re: Base GPIO code to work from?

Post by Boben »

I have tried to get the serial communication with TS running for several times now with this new firmware.
The .s19 file seems to flash to the controller as it should, but ones I try to detect the board from TS I get this error message:
"A controller was found on COM3. However there appears to be no firmware loaded". I am using the INI provided in the TemplateCWproject_1101.zip.
When I load the processor with the latest MS2 firmware, the communication with TS is working fine.
I am using the associated MS2 firmware update bat for MS2 firmware and MS Download 2.0 for GPIO firmware.

Any thoughts on what I am doing wrong?
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: Base GPIO code to work from?

Post by Bernard Fife »

Boben,

I just tried this here (downloading and extracting the zip file from the website to make sure it isn't corrupt) and it all works fine for me. I tried with both monitor S19 files in the BIN folder - both worked fine while using the included GPIO.INI. There are a few potential issues:

- some versions of TunerStudio may not recognize the signature as valid. I am using v2.213 and it works. I couldn't say if earlier versions of TS will work. So if you haven't updated TS lately, you might want to do that.
- follow the instructions for loading embedded code here: http://www.msgpio.com/manuals/mshift/V2code.html#load (except for using the template project S19 and INI where appropriate, of course). Don't use any other procedure from any other site.
- make sure the bootloader pin is not grounded after you have loaded the code - and be sure to cycle the power (I am sure you are doing this, since you have other code working properly),
- be sure to load the original version of the S19, BEFORE compiling any code, otherwise you won't know if it might be the compiler setup that is the issue.

If those are all fine, then you likely have an intermittent serial communications issue. There are some serial comms troubleshooting tips here: http://www.msgpio.com/manuals/mshift/gpconnect.htm

I would also make sure the power supply is functioning properly. Depending on how it is built, the GPIO board can draw currently different while running than during code loading compared to MS-II, so this is one thing to check (ideally with a scope, but alternatively with a voltmeter).

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: Base GPIO code to work from?

Post by Bernard Fife »

I am using the associated MS2 firmware update bat for MS2 firmware
Boben,

I just noticed that line (above). You might want to check if any special instructions are required when loading 'normal' code after using the batch file. I recall people having an issue with this before on MS-II when returning to B&G code from other variants.

You could also try to load B&G MS-2 code using the downloader - if it fails too, then you have found the problem and you need to return the controller back to its original state to use the downloader. (But be sure you are jumpering the bootloader header when powering up before loading code, and that you remove the jumper before cycling the power after loading the code.)

I have never used the batch file to load code, so I can't help with any special procedures that might be required after using it to enable the downloader to work normally. You could ask its developer how to tackle this problem.

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
Boben
Posts: 2
Joined: Sun May 12, 2013 2:47 am

Re: Base GPIO code to work from?

Post by Boben »

Hello Lance,

Although the instructions recommend to first confirm communication with the included .s19 file, I went on and compiled a new .s19 file in CW without any modifications to the code and flashed it in with MS download 2.0 and guess what... Communication with TS is working just fine now!
I guess it's time to start playing with the code now.
SebastianS
Posts: 16
Joined: Fri Apr 26, 2013 1:30 am

Re: Base GPIO code to work from?

Post by SebastianS »

Hello everyone, it's me again.

I have now installed the GPIO with my MS3 and another CAN controller in my car and I managed to get a connection on first try (positively surprised there ;) ).
MS3 is CAN ID 0, GPIO is ID 1 and the other controller is ID 2.
Problem is: When connecting to the GPIO by CAN Pass Through, TS is sending out pinging error sounds every now and then, a "Protocol Error" light flashes up shortly and it seems that some data in the MS3's data storage are being altered (most notably RPM, as the other controller reads and displays that value).

The CAN termination resistors are placed on the MS3 and the the other controller, with the GPIO placed in between without a termination resistor.

However, this error does not occurr if I unplug the GPIO.
Any ideas what might cause this?

-Sebastian
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: Base GPIO code to work from?

Post by Bernard Fife »

Sebastian,

Without looking at any data, I would guess that the CAN outpc or inpram settings are note correct. You can read about how these work in the MShift code here: http://www.msgpio.com/manuals/mshift/V41tune.html#oa

I don't recall off the top of my head how much of this is in the the template code. You may have to add some parameters to the CAN code to be able to adjust the table numbers and offsets, etc. (The defaults are likely for the B&G code, so they may not work for other codes - and this is why they were made 'adjustable' in the MShift code). It's not hard to do, you just have to replace the fixed table values in the code with user parameters (and add them to the INI so you can adjust them, of course).

I do recall that the CAN adjustments are not sent to the engine controller in the template code (the contents of the sendCANAdj() function is commented out). If you have uncommented this function and/or enabled it anywhere, you need to sort out what to send and where to match the memory map (tables and offsets) of the controller you are sending to.

Also, make sure your code and the engine controller have the same outmsg structure. If they don't have the same number of bytes and offsets, there will be problems. Search the code for "outmsg" OR be sure not to enable the can_testout parameter.

Otherwise, the code only receives info (PW, load, etc.) from the other controller, it doesn't send info at all, so you need to look at the other controller CAN functions.

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
SebastianS
Posts: 16
Joined: Fri Apr 26, 2013 1:30 am

Re: Base GPIO code to work from?

Post by SebastianS »

Lance,

since the page you linked is referring to the MS2, is it consistent with the MS3 too? If not, what are the differences?

Where do I find the respective table numbers and offsets?

Sebastian
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: Base GPIO code to work from?

Post by Bernard Fife »

Sebastien,

I have no idea about MS3 and how it might be different from the B&G code. However, in theory you should be able to find all the values in the applicable INI (they have to be there for TS to work with the various input and output tables/parameters/variables). They can be obscure, though, so finding them is sometimes a chore. Your best bet is to ask on the MS3 forums for the relevant table and offset values.

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
Post Reply