element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Arduino
  • Products
  • More
Arduino
Blog Arduino MKR CAN Shield Review - part 1: Log BUS Traffic
  • Blog
  • Forum
  • Documents
  • Events
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Arduino requires membership for participation - click to join
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 18 Jun 2019 5:46 PM Date Created
  • Views 885 views
  • Likes 9 likes
  • Comments 3 comments
  • arduino_mkr
  • mkr_shields
  • microchip
  • can_bus_analyzer
  • can_bus
  • automotive
  • hercules
  • arduino
  • can
Related
Recommended

Arduino MKR CAN Shield Review - part 1: Log BUS Traffic

Jan Cumps
Jan Cumps
18 Jun 2019

I'm trying out CAN communication with the Arduino MKR CAN Shield.

 

I have a CAN bus test setup in the lab, with two DIY CAN drivers.

If all is OK, I should be able to write firmware and plug the Arduino CAN shield onto that BUS.

It can then snoop the data - and in a second step, send packets.

 

 

Introducing Arduino's MKR CAN Shield

 

The Arduino MKR series is rather interesting. A number of small-sized controller boards and a set of useful shields that match that size.

The CAN shield that I review here uses a popular CAN controller, the Microchip MCP2515Microchip MCP2515, and as CAN driver the NXP TJA1049T/3NXP TJA1049T/3.

image source (note: the actual screw terminals on the board I have are different): arduino.cc

 

Highlights:

  • bus termination resistors that can be switched in or out.
  • an on-board buck converter that allows you to power the Shield and an Arduino MKR 1xxx controller from external 7 to 24 V dc.
  • Allows for interrupt driven message receive and hardware filtering for relevant data.
  • A choice of supporting libraries and example sketches.

 

Wiring the CAN Shield in a CAN Bus

 

The CAN bus is an easy bus to add devices to. In my case,

I have an existing 3V3 CAN bus existing of

  • two CAN breakout boards using a TI CAN driver and a Hercules automotive microcontroller for the logic.
    They are currently programmed to send random data upon a button push and listen to specific packets.
  • a Microchip CAN Bus AnalyzerMicrochip CAN Bus Analyzer.
    Versatile, can listen, send, show protocol errors and log.

 

My two breakout boards are set up as termination points of the bus. They have termination resistors to properly close the bus at the two sides.

The analyser is plugged somewhere in between these two. The analyser's termination resistors are disabled, because it's not at the end of the bus.

Similarly, when wiring in the CAN shield somewhere on the bus, the switch that configures the on-board resistors has to be switched off.

So, the 4 things to do when adding the MKR CAN Shield to your bus are:

  • connect HI to Bus HI
  • connect LO to Bus LO
  • connect GND to Bus GND
  • set the switch to the right.

 

First Test: Snoop CAN messages

 

We can get started straight away. That's the magic of the Arduino world. There's always an example that gets you running.

In the case of shields with a Microchip MCP2515, there are a few options. Several good libraries have been published.

I made a choise based on the example I need more than on what library I prefer. I went for Sandeep Misty's CAN lib. Its CANReceiver example has all I need.

You install the lib by searching for MCP2515 in the Arduino library manager.

Once installed, open the CANReciever example.

Load it to your Arduino MKR (I'm assuming you have an Arduino MKR controller at this point ) , run it and open the serial monitor

All traffic on the bus will apear in the serial monitor.

 

What have you achieved?

  • Added the Arduino MKR CAN shield as a node to a CAN bus
  • Have a working device that can see what's happening on the CAN bus. Pushing data on the bus is just a little step away.

 

I think that's exciting.

 

 

Road Test Blog
part 1: First trials
part 2: Inject CAN Messages
part 3: Analyzer as Test Tool
part 4: Analyze the Physical layer of CAN Bus
Related Blog
part 1: tryout
part 2: Communication between 2 Devices
part 3a: Design a Bus Driver PCB
part 3b: Design a Bus Driver PCB - Schematics and Custom Components
part 3c: Design a Bus Driver PCB - Layout
part 3d: Design a Bus Driver PCB - Test
Arduino MKR CAN Shield Review - part 1: Log BUS Traffic
Arduino MKR CAN Shield Review - part 2: Interrupt and Filter
Anonymous

Top Comments

  • Jan Cumps
    Jan Cumps over 2 years ago +3

    The example here is useful to stream everything published on a bus.

    When you're implementing a real can device, it's worth checking out the library API for the filter function.

    This functionality…

  • gam3t3ch
    gam3t3ch over 2 years ago +2

    Great stuff thanks for sharing!

  • Jan Cumps
    Jan Cumps over 2 years ago +1

    I've been testing Sandeep Mistry's CAN library further. It supports interrupts with CAN receive, and hardware filtering.

    The interrupt functionality works nicely. You can make the Arduino sleep…

Parents
  • gam3t3ch
    gam3t3ch over 2 years ago

    Great stuff thanks for sharing!

    • Cancel
    • Up +2 Down
    • Reply
    • More
    • Cancel
Comment
  • gam3t3ch
    gam3t3ch over 2 years ago

    Great stuff thanks for sharing!

    • Cancel
    • Up +2 Down
    • Reply
    • More
    • Cancel
Children
No Data
Element14

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2022 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube