Teensy 3.2 Reading CAN

This forum is for the discussion of other projects on Megasquirt/Microsquirt hardware that don't fit into any of the other forums

Moderators: jsmcortina, muythaibxr

Raymond_B
Super MS/Extra'er
Posts: 1398
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Teensy 3.2 Reading CAN

Post by Raymond_B »

After reading some of the CAN gauge threads I thought it'd be fun to try to learn more on this. I've always been interested in microcontrollers so I figured something simple like an Arduino based Teensy would be a good start. I bought a 3.2 that is CAN enabled and I have a MS V3 that is going to be my trans controller for my project, but is not installed yet. So I reflashed it with 3.4.1beta1,hooked up my JimStim and got it going in TS. I hooked the CAN connections up to the Teensy and found a CAN monitor sketch to load up.

In the MSEXTRA manuals I see references to CAN, but not many breakdowns of the info. Is this valid info http://www.megamanual.com/com/CAN.htm ? <---- Nevermind I found http://www.msextra.com/manuals/ and just had to scroll to the bottom of the page...

I am seeing the below information in the Serial Monitor coming from the Teensy, is it valid? Not really the values so much as the format?

ID: 0xC DLC: 8 DATA: 0 0 0 6E 0 93 0 93
ID: 0xC DLC: 8 DATA: 0 0 0 6E 0 93 0 93

I know there's quite a ways to go to get it to a display, but I am enjoying learning. I have Real Time Data Broadcasting turned on and enabled 03 TPS, Batt, EGO1, 2.
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
Raymond_B
Super MS/Extra'er
Posts: 1398
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Teensy 3.2 Reading CAN

Post by Raymond_B »

Well bleh, my project was cut short. Must have set my JimStim on something and shorted it. Poly fuse gets super hot and my 12v screw terminal only has 3.4 dropping down to like 2.9.... I guess the JimStim and Microsquirt are gonna go out to DIY Monday to get tested and fixed hopfully I did not hurt the Microsquirt.
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
racingmini_mtl
Super MS/Extra'er
Posts: 9129
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Teensy 3.2 Reading CAN

Post by racingmini_mtl »

Have a look at the troubleshooting section of the JimStim web site: http://jbperf.com/JimStim/JimStim_v1_5_ ... ml#testing

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
Raymond_B
Super MS/Extra'er
Posts: 1398
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Teensy 3.2 Reading CAN

Post by Raymond_B »

Thank you, I'll go over the steps.
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
Raymond_B
Super MS/Extra'er
Posts: 1398
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Teensy 3.2 Reading CAN

Post by Raymond_B »

Decided to see if I hurt my Microsquirt in the debacle. I believe it's OK, I used a bench 12v power supply and it fired up and talked to TS. I have been going over the Megasquirt 11bit CAN broadcasting protocol, including dash broadcasting PDF located here http://www.msextra.com/doc/pdf/Megasqui ... adcast.pdf. So I think I am making some progress as the base message ID seems to match the documentation and the setting in TS for "Dash Broadcasting" of 1512 (0x5E8). However it looks as if I am only seeing the same message over and over. When I cycle the MS I can see the data changes

Example:

This repeats
ID: 0x5E8 DLC: 8 DATA: 0 5F 0 0 7 8 0 3

Power Cycle MS and this repeats until next powercycle.

ID: 0x5E8 DLC: 8 DATA: 0 6F 0 0 7 8 0 25

And so on.

Attached is the Sketch, it's a simple one I pulled down from the pjrc Teensy forums. Simple is good for now as I want something basic to build off of :)
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
Raymond_B
Super MS/Extra'er
Posts: 1398
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Teensy 3.2 Reading CAN

Post by Raymond_B »

racingmini_mtl wrote:Have a look at the troubleshooting section of the JimStim web site: http://jbperf.com/JimStim/JimStim_v1_5_ ... ml#testing

Jean
I went over all the troubleshooting steps.

Testing the LED's passed no problem.

When I tested the tach signal the IAC would kind of flicker as I turned the RPM fine pot, but mostly stayed solid. I get no LED light at all when testing with the #3 DIP switch on and the jumper in the middle of the primary tach jumper header, but the poly fuse gets really hot.

I removed the CPU and have the following readings, also with the CPU removed the polyfuse does not get hot.

10.9v at + pin for x4 with JimStim plugged in.

1 2.95
2 0
3 2.95
4 0
5 0
6 0
7 0
8 0
9 -0.58 ??
10 -0.58??
11 0
12 0
13 0
14 0
15 0
16 0

I did notice that the mounting leg of the SPARE pot was really close to a pin for the RPM fine. I ran a knife between the two to see if the solder was bridging, but it made no difference.

Image
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
Raymond_B
Super MS/Extra'er
Posts: 1398
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Teensy 3.2 Reading CAN

Post by Raymond_B »

Looks like D4 is bad. It fails the diode check on my DVM, .624 Anode-Cathode and 1.084 Cathode-Anode.
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
Raymond_B
Super MS/Extra'er
Posts: 1398
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Teensy 3.2 Reading CAN

Post by Raymond_B »

Ordered a new protection diode and CPU. Hopefully that takes care of it.
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
Raymond_B
Super MS/Extra'er
Posts: 1398
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Teensy 3.2 Reading CAN

Post by Raymond_B »

Posting because I like talking to myself :)

So I have been messing around with this some more. It seems as if either;

1. My Microsquirt is only broadcasting one type of message ID, the base ID and nothing more. <---- I really doubt this as obviously I am a noob flopping around trying to figure this out.
2. For whatever reason the code only pics up the base message ID.

I imagine it's something in the code that I have done, but what? I have fiddled with all the different settings in the Microsquirt, Dash Broadcasting, Real Time Data Broadcasting, etc. For whatever reason I only see the default message ID. I can change that ID in TS and I see it reflected in the broadcast, but no data comes over. I've also changed the base ID of the messages I am listening for to match the offsets where the different data groups should be. I've gone over the CAN pdfs for both 11 bit Dash broadcasting and 29bit full broadcasting.

I am using xrattiracers's code here https://github.com/merkur2k/MSCan_Gauge/tree/teensy I simply turned on or added serial output (for the different message IDs starting at line 903) so I could watch it in the IDE serial monitor.
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
jsmcortina
Site Admin
Posts: 39611
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Teensy 3.2 Reading CAN

Post by jsmcortina »

Raymond_B wrote:Posting because I like talking to myself :)

So I have been messing around with this some more. It seems as if either;

1. My Microsquirt is only broadcasting one type of message ID, the base ID and nothing more. <---- I really doubt this as obviously I am a noob flopping around trying to figure this out.
2. For whatever reason the code only pics up the base message ID.
Is this with standard firmware? If so post an MSQ.

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".
Raymond_B
Super MS/Extra'er
Posts: 1398
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Teensy 3.2 Reading CAN

Post by Raymond_B »

Thanks James. This is with ms2extra-pre3.4.1beta1 in a cased Microsquirt V3. I briefly tried with the latest Trans code, but I figured that was out of the scope of this test so I flashed it back to ms2extra-pre3.4.1beta1.

Not really a full on tune, just changed some items so it wouldn't be default. This is the last one I was fiddling with that had Dash Broadcasting enabled and set to automatic.


Thanks again!
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
Raymond_B
Super MS/Extra'er
Posts: 1398
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Teensy 3.2 Reading CAN

Post by Raymond_B »

Are there minumum requirements that must be met for CAN to start moving data? If I go in to TS and choose Tools ---> then Protocol Stats canData shows 0.0
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
jsmcortina
Site Admin
Posts: 39611
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Teensy 3.2 Reading CAN

Post by jsmcortina »

Raymond_B wrote:Are there minumum requirements that must be met for CAN to start moving data? If I go in to TS and choose Tools ---> then Protocol Stats canData shows 0.0
No idea what that means, it is nothing to do with the firmware - best to ask on the TunerStudio forum.

You need to check your receiving software or hardware. Loading your MSQ and monitoring the CAN bus with a CAN analyser I have shows all the expected data there.

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".
Raymond_B
Super MS/Extra'er
Posts: 1398
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Teensy 3.2 Reading CAN

Post by Raymond_B »

OK, thanks for looking. With CAN broadcasting is it just that, the Megasquirt is broadcasting data on the bus or does it need to have data requested from it? I was reading the CAN docs and wasn't sure if there were two methods. One where it is broadcasts out with no interaction with the other device and then another method where the two devices talk back and forth like when using two devices like in the case of a MS trans controller and MS for the engine
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
jsmcortina
Site Admin
Posts: 39611
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Teensy 3.2 Reading CAN

Post by jsmcortina »

CAN broadcasting is just that. Turn it on and the data is spewed out.

The proprietary "Megasquirt CAN" is a non-standard request and reply protocol. Don't bother with it.

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".
Raymond_B
Super MS/Extra'er
Posts: 1398
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Teensy 3.2 Reading CAN

Post by Raymond_B »

Ok thanks! That seemed obvious, but I wanted to be sure.
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
Raymond_B
Super MS/Extra'er
Posts: 1398
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Teensy 3.2 Reading CAN

Post by Raymond_B »

So I am pretty sure I found my problem, and it's 100% me :) I was under the assumption the Teensy 3.2 had a CAN transceiver, it does not obviously it has a controller and requires a transceiver... Duh!

Anyway I have one on the way (next day Amazon prime for 8.00 rocks!) so I should be able to verify. I picked up this http://www.amazon.com/gp/product/B00KM6 ... dp_summary and a few other things. This gave me time to update my sketch which I think should be ready once I get past my self imposed roadblock.

Attached is a picture of a small 2.8" display showing some CAN data.
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
Raymond_B
Super MS/Extra'er
Posts: 1398
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Teensy 3.2 Reading CAN

Post by Raymond_B »

Just confirming that it was my misunderstanding that caused the issue. Teensy is now reading everything I choose to broadcast. Now the real work comes in trying to figure out what I want to log and how I want to display it. For now I am just going to play with the small 2.8" LCD and get the formatting straight.


Thanks again James for your patience.
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
Raymond_B
Super MS/Extra'er
Posts: 1398
Joined: Thu Mar 06, 2014 2:17 pm
Location: Texas
Contact:

Re: Teensy 3.2 Reading CAN

Post by Raymond_B »

Woot working! https://youtu.be/NWIU7iMkxlc

Parts list:

Teensy 3.2 $20.00
2.8" 320x240 LCD $12.00
Wave Share CAN transceiver $10.00 (you can find it cheaper if you want to wait, I got it from Amazon with Prime next day for $8.00 extra.)

Help from folks here and on PJRC.com, priceless :)


Playing with coloring the data based on conditions.

https://youtu.be/43hbbCE1144

Here's the display and the pinout

http://www.pjrc.com/store/display_ili9341_touch.html

For the CAN transceiver it's just Tx to Tx and Rx to Rx on the Teensy CAN pins.
1995 Ford Lightning. Dart based 427 Windsor, Novi 2000, full sequential, E-85, etc. MS3X/v3.57
http://www.buildpics.org/
midnite88
Helpful MS/Extra'er
Posts: 53
Joined: Fri Dec 10, 2010 10:33 am
Location: Ogden UT

Re: Teensy 3.2 Reading CAN

Post by midnite88 »

Looking really good man, I'v been following you on the FB page. I plan on trying this soon. I have a RPi2 that I will be trying to us a CAN transceiver with as well. How hard is all this arduino coding stuff? This will be the first time for me.
88' F150 5.0 TFS Heads Comp XE258 Cam....Block now in two pieces
93 Foxbody...under construction Barra 4.0T
94 Jeep ZJ Bone Stock
97 Jeep ZJ Bone Stock
08 Buell XB12R, custom exhaust, soon to be turbo'd and MS3'd :yeah!:
Post Reply