Teensy 3.1 and CAN Bus

I can help if you share the updated code (have 1M setup ready)
Sure, thanks. There is a branch called clock16 in the github repo. The github repo has an issue started so you can post findings there. I won't get to testing until Sunday afternoon so I wasn't spreading it around too much yet. Comment out the #error stuff in the header if testing at an odd CPU clock - I will remove that after getting things tested.
 
Sure, thanks. There is a branch called clock16 in the github repo. The github repo has an issue started so you can post findings there. I won't get to testing until Sunday afternoon so I wasn't spreading it around too much yet. Comment out the #error stuff in the header if testing at an odd CPU clock - I will remove that after getting things tested.

OK, will try to do some testing this evening.
 
Did some quick test @ 1M. Works fine with (24, 48, 72, 96, 120, 144 and 168 MHz). Did not try on 16, 8, 4 and 2 MHz as I'm using the USB serial which is disabled with these clock values.
 
Did some more tests @ 1M with 16, 8, 4 and 2 MHz. Works with 16 and 8 MHz, but I could not get it to work reliably with 4 and 2 MHz which I believe is not a surprise at that data rate.
 
I could not get it to work reliably with 4 and 2 MHz which I believe is not a surprise at that data rate.
Ha. No doubt. I remember having micros at 2 and 4 MHz and hand optimizing every little thing to get what I needed out of them. Thanks again for all your work, this driver wouldn't be available for teensyduino 1.20 without your involvement.
 
Ha. No doubt. I remember having micros at 2 and 4 MHz and hand optimizing every little thing to get what I needed out of them. Thanks again for all your work, this driver wouldn't be available for teensyduino 1.20 without your involvement.

Thanks for the lib! You are doing all the hard work here :)
 
In addition to the pawelsky testing above, I was able to confirm operation at the lower bit rates. The clock16 branch has been merged into master on the repo and we are good to go. The CAN clock input is taken from the 16MHz XTAL. Please post any issues or requests on the repository. Thanks for all the help.

https://github.com/teachop/FlexCAN_Library
 
Paul if you are still listening on this thread I need some teensy advice. I made this change and updated CAN phase timings to work directly from the XTAL. CAN works, yea. However, I needed to do this:
Code:
  OSC0_CR |= OSC_ERCLKEN;

Yes, that's perfectly fine.
 
teachop, Paul and everyone else,

First I want to thank you guys for this library. I have been following this thread for a while and finally got a chance to get a teensy 3.1 and try it out. I have been working on on my own boards using ATmega328p with MCP25625 CAN controller/receiver for home automation (lightsm, sprinkler system, HVAC, etc) so having the teensy 3.1 talk in native CAN then I can use it as a Network Manager. Hell, at the low price of the teensy, I might just add teensy 3.1 headers and bypass my own boards all together.

I know this might be a little early but has anyone thought about having a separate library for CANopen or a higher level protocol? I found this code created for PIC and wonder if it could be ported to the teensy 3.1 using the FlexCAN library http://sourceforge.net/projects/canopennode/?source=navbar

Also, looked like arachnic labs was working on a simple version of VCSP but that stopped back in december.

Anyway, I am available for any testing any of you would like to run. I have CANalyzer access as well as PCAN USB with PCAN explorer and lots of test boards.

FYI, I was the person that tried to combine all MCP2515 libraries and provide a better/easier library. Since then, Neil McNieght has forked the library and is trying to use a Unified library approach.

Thanks,

Dro
 
Hi all

Just wanted to thank you for putting this together and to say that I'll be following it pretty closely. I'm trying to make a gauge for my race car that will talk over the CAN bus. This is my first micro-controller project (ambitious I know) so forgive me if this is a dumb question, but what is required to connect the Teensy 3.1 CAN pins to a vehicle via the OBDII port? I'm trying to use some arduino-based projects as a reference but it's difficult because they all seem to be based on an external controller and transceiver (MCP2515/MCP2551 for example). Can someone dumb this down a bit for me?

Thanks
 
I would like to know if the example in the library can sniff CAN messages?
Anyone happen to have any examples of sending messages?
 
Fyod, I use a modified version to sniff the messages on my motorbike and it works a treat. Not sending anything in (as it will likely just result in errors)
 
Can chance the library could get a "listen only" example that just prints info to the Arduino Serial Monitor for everything it hears on the bus?

BTW: I'm planning to put FlexCAN in the Teensyduino 1.20 installer. Is the Teachop's copy on Github the best to use?
 
Fyod, I use a modified version to sniff the messages on my motorbike and it works a treat. Not sending anything in (as it will likely just result in errors)

If you have a nice example the library could use it. If so and willing to share please post a pull request on the repo.
 
Also, thanks to everyone who has worked on this!
This is another great advancement to the Teensy and I'm glad I have atleast 4 Teensies lying around to try all this awesome stuff.
 
Reading through all this stuff I'm unsure whether to use pins 3/4 or 5/6.
Library says 5/6, pin diagram says 3/4.

Cheers!
 
Back
Top