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
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • 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
RoadTests & Reviews
  • Products
  • More
RoadTests & Reviews
Blog Microchip CAN Analyzer Road Test - part 3: Analyzer as Test Tool
  • Blog
  • RoadTest Forum
  • Documents
  • RoadTests
  • Reviews
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
RoadTests & Reviews requires membership for participation - click to join
  • RoadTest
  • microchip
  • analyzer
  • automotive
  • can
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Related
Recommended

Microchip CAN Analyzer Road Test - part 3: Analyzer as Test Tool

Jan Cumps
Jan Cumps
28 Oct 2017

I'm reviewing the Microchip CAN Analyzer for a Road Test.

It'll be used in a CAN Bus that I'm designing. This blog shows that it is useful in a firmware design cycle.

image

 

The Analyzer as a Development Helper

 

In a previous CAN blog I wrote about configuring a Hercules microcontroller's CAN module. My setup is using interrupts to react on traffic and capture only relevant data.

image

The trigger should only fire when a message with ID == 1 appears on the CAN bus. Any other ID should be ignored. The CAN module should not interrupt the ARM controller.

An ideal scenario for the CAN Analyzer. I can use it to send a payload and choose an idea. It allows to generate messages to be captured and also ones to be ignored.

 

Here's the service routine:

 

#pragma WEAK(canMessageNotification)
void canMessageNotification(canBASE_t *node, uint32 messageBox)  
{
/*  enter user code between the USER CODE BEGIN and USER CODE END. */
/* USER CODE BEGIN (15) */
    if((node==canREG1)&& (messageBox == canMESSAGE_BOX1)) // transmit box
    {
      tx_done=1; /* confirm transfer request */
    }

    if((node==canREG1)&& (messageBox == canMESSAGE_BOX2)) // receive box
    {
     while(!canIsRxMessageArrived(canREG1, canMESSAGE_BOX2));
     canGetData(canREG1, canMESSAGE_BOX2, rx_ptr); /* copy to RAM */
     rx_ptr +=8;
    }
/* USER CODE END */
}

 

These lines of code are of interest here:

 

    if((node==canREG1)&& (messageBox == canMESSAGE_BOX2)) // receive box
    {
     while(!canIsRxMessageArrived(canREG1, canMESSAGE_BOX2));
     canGetData(canREG1, canMESSAGE_BOX2, rx_ptr); /* copy to RAM */
     rx_ptr +=8;
    }

 

canREG1 is there because we're working with CAN module 1 of the microcontroller (it has 2 of them).

canMESSAGE_BOX2 is the message box of that CAN module that we've configured as an inbound box,  listening to ID 1 only.

Test Scenarios

 

I've tested the following cases:

  • trigger should not fire if ID is different than 1 (because I haven't defined a trigger for any other ID in the controller configuration).
  • trigger should fire if ID is 1.
  • if triggered, the following condition should evaluate TRUE:

 

if((node==canREG1)&& (messageBox == canMESSAGE_BOX2)) // receive box

 

  • the payload should be copied to the controller's memory by the service routine
  • send multiple messages.

 

All of the cases passed. Here's the result of a breakpoint firing after the first arrival of a message with ID == 1.

image

 

In the CAN Analyzer GUI, I set the ID to 1, the size to 8 bytes, and no repeats.

You can see that the Hercules stopped at the service routine's breakpoint, and copied the payload to the RAM:

 

     canGetData(canREG1, canMESSAGE_BOX2, rx_ptr); /* copy to RAM */

 

I'm showing the content of the first 8 bytes of that RAM buffer in the upper right of the capture. You can see that the values 1 -> 8 that I sent via the Microchip CAN analyzer are now in the RAM buffer.

In the past I have been testing these scenarios by programming another CAN enabled microcontroller.

The Analyzer makes this easier.

 

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
  • Sign in to reply

Top Comments

  • Jan Cumps
    Jan Cumps over 5 years ago +2
    Overall the tool performs fine. What I'm struggling with is that some functionality is described on the product page or in the manual, but doesn't seem to be implemented: filter messages in the GUI. It…
  • Jan Cumps
    Jan Cumps over 5 years ago

    Overall the tool performs fine. What I'm struggling with is that some functionality is described on the product page or in the manual, but doesn't seem to be implemented:

     

    • filter messages in the GUI. It's listed as a feature on the product page (Intuitive PC User Interface for functions such as configuration, trace, transmit, filter, log etc), but I can't find it. Microchip forum posts from  2010- 2012 seem to come to the same conclusion.
    • the triggers don't seem to work for me. They are mentioned as a function in the user manual (The tool can also be set up to send out a pulse upon reception of certain CAN messages, which is useful during development or debugging issues with an oscilloscope) but nothing in the GUI that I can find, and there's no signal on the trigger lines when I probe 'm with a scope.

     

    I've asked e14 on the Road Test page if a Microchip representative can comment. This will influence my score for the device.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

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 © 2023 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