Forum Rule: Always post complete source code & details to reproduce any issue!
Page 8 of 15 FirstFirst ... 6 7 8 9 10 ... LastLast
Results 176 to 200 of 360

Thread: Teensy 3.1 and CAN Bus

  1. #176
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,447
    Looks interesting. Any thoughts about putting a 3 position terminal block on the board, maybe up on the top side?

  2. #177
    Senior Member
    Join Date
    Jan 2014
    Posts
    111
    Quote Originally Posted by Manuel Stahl View Post
    Hi, I've made a shield for CAN bus and power supply. It (should) have the same dimensions as the Audio Adapter.

    Please review and tell me if you're interested.
    Nice.

    Here is one I've made some time ago (on the photo together with the MicroSD shield)

    Click image for larger version. 

Name:	shields.jpg 
Views:	653 
Size:	70.8 KB 
ID:	2874

  3. #178
    I am interested in a CAN shield ... where might I get some of these? One concern with Manuel's is that his termination is 100 ohms, rather than the usual 120 ohms. Also, an isolated solution might be good. But, thanks to both of you for designing some solutions!

  4. #179
    Senior Member
    Join Date
    Jan 2014
    Posts
    111
    Quote Originally Posted by Manuel Stahl View Post
    Hi, I've made a shield for CAN bus and power supply. It (should) have the same dimensions as the Audio Adapter.

    Please review and tell me if you're interested.
    Just a thought - how about using the 3.3V regulator (and 3.3V transciever) to not stress the Teensy's internal regulator?

  5. #180
    Junior Member
    Join Date
    Nov 2014
    Posts
    11
    Wow, so many replies in a short time

    Quote Originally Posted by PaulStoffregen
    Looks interesting. Any thoughts about putting a 3 position terminal block on the board, maybe up on the top side?
    I don't know exactly what you mean. What would be connected there?

    Quote Originally Posted by dpharris
    I am interested in a CAN shield ... where might I get some of these? One concern with Manuel's is that his termination is 100 ohms, rather than the usual 120 ohms. Also, an isolated solution might be good. But, thanks to both of you for designing some solutions!
    The PCB can be ordered directly at 123d.circuits.io as soon as I mark is as "done". The 100 ohms resistor was my fault, will change it.

    Quote Originally Posted by pawelsky View Post
    Just a thought - how about using the 3.3V regulator (and 3.3V transciever) to not stress the Teensy's internal regulator?
    I want to power a USB device from the regulator. That's why I took a "big one". But the same regulator (same footprint) is also available as 3.3V version, so it's just a matter of assembly.

  6. #181
    Senior Member
    Join Date
    Jan 2014
    Posts
    111
    Quote Originally Posted by Manuel Stahl View Post
    I want to power a USB device from the regulator. That's why I took a "big one".
    I see

    Quote Originally Posted by Manuel Stahl View Post
    But the same regulator (same footprint) is also available as 3.3V version, so it's just a matter of assembly.
    Not quite, the connections will be different as well (3V3 pin instead of VIN). And of course the transceiver (3V3 instead of 5V one)

  7. #182
    Senior Member
    Join Date
    Jan 2014
    Posts
    111
    Quote Originally Posted by Manuel Stahl View Post
    The PCB can be ordered directly at 123d.circuits.io as soon as I mark is as "done".
    Did you consider OSH park? They may have better prices.

  8. #183
    Junior Member
    Join Date
    Dec 2014
    Posts
    1
    Great job by all involved. I have been following this thread from its inception. I only just recently got a teensy 3.1 and began bench testing for my CAN based switch panel project. I am able to successfully transmit on a 1Mb/s bus using the Microchip MCP2551. Is it possible to transmit from more than one base address or am I limited to only one and therefore just 8 bytes of data for transmitting? I have experimented with several approaches, and after digging through FlexCAN.h and FlexCAN.ccp, I am unable to reach any definitive conclusion. I am a mechanical engineer and relatively new to programming. Any pointers or input is appreciated. Thanks again to all of you.

  9. #184
    Hi All,

    Finally got my setup working with two teensy's talking via Can (trancievers are a TI *232 on a SOIC8 breakout):

    Click image for larger version. 

Name:	IMG_20141224_125643.jpg 
Views:	306 
Size:	321.2 KB 
ID:	3176

    There is a basic priority system reading messages generated on the bus and displaying them on the lcd.

    I have a few questions about the mask format for the global mask, for example if I wanted to catch all ID's that were in the range 0x220 to 0x240 (32 frames).

    on the MCP2515 there is a filter and a mask so I would set it like so:

    Filter: 0b010 0000 0000
    Mask: 0b111 1000 0000

    Which would return all frames from 0x200 to 0x27F and block all others (I'm sure there is a more efficient mask but I don't have my spreadsheet) is there anyway to achieve this with the current implementation?
    I've been hoping an example in the library might show how the filters are implemented.

    Additionally is there any progress on an ISR vector that will be called on the filling of one of the FIFO buffers? I'm worried that too much traffic would start to overrun the current polling method to filter the packets you actually want. In the intended application the 1MBps bus is running at 70% utilisation.

    Another useful feature would be a function or ISR that returns the current state of the bus, error flags and Rx/Tx Error counts.

    Paul: I have a listen only example which I will add to the library for the next teensydrino release.

  10. #185
    Quote Originally Posted by PaulStoffregen View Post
    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?

    CANListen.ino

    Feedback appreciated.

  11. #186
    Junior Member
    Join Date
    Jan 2015
    Posts
    1
    Nice work guys. I'm waiting for components to arrive so I can start a similar project. Just as Mr.CanBus I want to read enginedata from a Ducati. First goal is to just to be able to read out rear wheel speed and engine revs for calculate gear position. The final purpose is to make a system for logging more data , adding more sensors to measure tyre temperature, brake pressure and damper travel.
    I'm thinking about ordering some of Manuel Stahl's can shield pcb layouts from 123D Circuits. Which Can transceiver should I go for, MCP2551 , MCP2561 or MCP2562?

  12. #187
    Senior Member
    Join Date
    Jun 2014
    Posts
    245
    Anyone tried sending a message to a motorcycle/car with positive results? Possibly example code?

    I've personally had good experience reading using the MCP2551. Only "setback" is the 5V, so I made some 12-20V to 3.3V+5V adapters.
    Last edited by Fyod; 01-14-2015 at 03:52 PM.

  13. #188
    I've still not tried sending, only listening, but there are plenty of treads on other forum with people sending messages into the bus on cars without problems. The issue I forsee with my bike is that it sends messages constantly, e.g. BRAKE_LIGHT = OFF not just a message to turn it ON. I'd imagine if I tried to send a message in I'd cause some sort of conflict/error or at best make it flicker (in the brake light example). The solution would be to physically split the bus and filter out the unwanted originally message, replace with my own and 'pass through' all the other messages. But that would involve major surgery on the loom unless I could get hold of connectors to make up a new section of loom to plug and play. There was a kickstarter for something called "CANBUS Triple" that was built specifically for this purpose.

    Let me know how you get on if you try.

  14. #189
    Junior Member
    Join Date
    Mar 2015
    Location
    Sewickley, PA
    Posts
    11
    I wanted to post to thank everyone who worked on getting the canbus drivers for the teensy3.1 completed. I am working on a project which uses two teensy3.1's working together to implement 4 wheel steering on an industrial platform and was able to use the canbus drivers for tennsy3.1 to teensy3.1 communication. Eventually I want to add a routine to receive canbus data from the microsquirt engine controller to display on the 4d systems LCD I am using for a dash. I could not have gotten this far with out your help.

    Mark

    BTW this thread sure went dead lately.

  15. #190
    Senior Member
    Join Date
    Jun 2014
    Posts
    245
    Can anyone confirm if this would be the correct way to format a message?

    Code:
    void CAN_Send(){
    
      msg.id = 0x631; 
      //msg.header.rtr = 0;
      msg.len = 8; 
      msg.buf[0] = 0x40;
      msg.buf[1] = 0x05;
      msg.buf[2] = 0x30;
      msg.buf[3] = 0xFF; 
      msg.buf[4] = 0x00;
      msg.buf[5] = 0x40;
      msg.buf[6] = 0x00;
      msg.buf[7] = 0x00;
    
    CANbus.write(msg);
    
    delay(1000);
    }
    It checks out fine in the IDE.
    Last edited by Fyod; 04-02-2015 at 04:13 AM.

  16. #191
    Quote Originally Posted by pawelsky View Post
    Nice.

    Here is one I've made some time ago (on the photo together with the MicroSD shield)

    Click image for larger version. 

Name:	shields.jpg 
Views:	653 
Size:	70.8 KB 
ID:	2874
    I'm very interested in both your shields, can they be used toghether wilth the audio shield ?
    Can you sell them populated with components, i suck at soldering smd !
    Thanks.

  17. #192
    Senior Member
    Join Date
    Jan 2014
    Posts
    111
    Quote Originally Posted by riodda View Post
    I'm very interested in both your shields, can they be used toghether wilth the audio shield ?
    Can you sell them populated with components, i suck at soldering smd !
    I do not do them anymore. You can make the All-In-One shiled yourself if you want.
    https://oshpark.com/shared_projects/VeJFD9qA

    No idea if they can be used with Audio shield, never used one.

  18. #193
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,447
    I wonder if Onehorse would be interested in making an appallingly small version?

    If someone wanted to make a sell these, would the "not for commercial use" mean they'd need to start from scratch?

  19. #194
    Senior Member
    Join Date
    Jan 2014
    Posts
    111
    Quote Originally Posted by PaulStoffregen View Post
    If someone wanted to make a sell these, would the "not for commercial use" mean they'd need to start from scratch?
    We can discuss it

  20. #195
    Senior Member onehorse's Avatar
    Join Date
    Apr 2014
    Location
    Danville, California
    Posts
    921
    Looks like pawelsky has a good design, well documented, and anyone can order these from OSH Park to straight-forwardly assemble their own; no really hard soldering.

    When I first saw this I thought it would meet the needs of most CAN bussers so I stopped thinking about a CAN bus controller board.

    Is there an advantage in making this board appallingly smaller? (Of course, everything is better appallingly small!)
    Using smaller components can reduce the board size but the basic circuit seems fine.

    I would find this pretty easy going to solder all this together; but I still have no idea how to use a CAN bus controller nor how to even test such a beast.

    If someone wants to hire me for soldering skills, we can discuss...
    Last edited by onehorse; 04-07-2015 at 11:37 PM.

  21. #196
    Senior Member
    Join Date
    Jun 2014
    Posts
    245
    Quote Originally Posted by Fyod View Post
    Can anyone confirm if this would be the correct way to format a message?

    Code:
    void CAN_Send(){
    
      msg.id = 0x631; 
      //msg.header.rtr = 0;
      msg.len = 8; 
      msg.buf[0] = 0x40;
      msg.buf[1] = 0x05;
      msg.buf[2] = 0x30;
      msg.buf[3] = 0xFF; 
      msg.buf[4] = 0x00;
      msg.buf[5] = 0x40;
      msg.buf[6] = 0x00;
      msg.buf[7] = 0x00;
    
    CANbus.write(msg);
    
    delay(1000);
    }
    It checks out fine in the IDE.
    Just bumping this before I kill something in the car

  22. #197
    Junior Member
    Join Date
    Apr 2015
    Posts
    13
    Fyod

    I am in the same boat. I have tried to send a message on the bus but the "Write" function does not send anything.
    I am using the CANTest example sketch.
    The Write returns 0 every time it is called and I don't see the 0x222 message on my CAN bus.
    The library should return 0 if all TX buffers are full but I don't see any messages so I don't know why it is returning 0.

    Has anyone got a working example of sending a message.
    Sending messages on the CAN bus will not cause an error if you use an ID that is not used on your bus.

    MrCanBus

    What motorcycle are you connecting to.

    If anyone has problems getting the setFilter to work you need to make sure you use a mask when you call the begin()

    Here is my example.

    static CAN_filter_t myMask;
    static CAN_filter_t myFilter;

    myMask.id = 0xFFFF;
    CANbus.begin(myMask);

    myFilter.id = 0x0640;
    CANbus.setFilter(myFilter,0);
    myFilter.id = 0x0641;
    CANbus.setFilter(myFilter,1);
    myFilter.id = 0x0642;
    CANbus.setFilter(myFilter,2);
    CANbus.setFilter(myFilter,3);
    CANbus.setFilter(myFilter,4);
    CANbus.setFilter(myFilter,5);
    CANbus.setFilter(myFilter,6);
    CANbus.setFilter(myFilter,7);

    With this I only get 640,641,642 messages in the FIFO

  23. #198
    Senior Member
    Join Date
    Jun 2014
    Posts
    245
    Did you try the format I quoted?
    If not, maybe the message needs the message bit length, possibly even the header.

    Also, does anyone have a tested code for translating messages? I know it won't be much of a hassle, but possibly someone has tried it.
    Ie. use a filter, myFilter.id = 0x0640;...
    if 00 01 00 00 than Serial.println("640: Lights are on");
    if 00 00 00 00 than Serial.println("640: Lights are off");
    as a pretty bad example, but you get the gist.

  24. #199
    Junior Member
    Join Date
    Apr 2015
    Posts
    13
    The format was.

    msg.len = 8;
    msg.ext = 0;
    msg.timeout = 0;
    msg.id = 0x222;
    CANbus.write(msg);

    The write returns 0, this indicates an error.

  25. #200
    Quote Originally Posted by pawelsky View Post
    I do not do them anymore. You can make the All-In-One shiled yourself if you want.
    https://oshpark.com/shared_projects/VeJFD9qA

    No idea if they can be used with Audio shield, never used one.

    Thanks, i've placed the order at osh park, right now i'm struggling a bit in find the micro sd socket, non similar on RS, do you have a suggestion for a place to buy in small quantities ?
    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •