Phasor Systems Lab

Table of Contents

Working with CANStudio

Designed PCB Layout

Accessing the GUI

To access the web editor, make sure either the docker or python build is running. Afterwards open up a webbrowser and type the following into the url bar: localhost:5000.

The User Interface (UI)

This is the user interface for canstudio:

You will be able to view, record, generate can messages, upload a dbc, plot specific signals on the canbus, as well as transmit specific messages from the dbc utilizing this user interface. The UI is designed to be as minimal as possible while allowing for lots of functionality to be easily accomplished.

The Interface Device Configuration Panel

At this time make sure the device is plugged in and has gone through its initial boot-up sequence (Green LED (1s), Red LED (1s) and then completely off).

Located on the left - upper side of the UI is the device configuration panel. This panel will allow you to search for CANExplorer Devices to connect to. Note: This inteface only works for CANExplorer devices. They are designed to be as efficient and feature packed as possible.

Discovering Devices

Hit the ‘Refresh Ports’ button to reload all detected CANExplorer devices.

Selecting a CAN Bus Speed

Click on the drop-down for the bus speed and select the appropriate bus speed for your canbus network.

The supported speeds are as follows:

  1. 10kbps
  2. 20kbps
  3. 50kbps
  4. 100kbps
  5. 125kpbs
  6. 250kbps
  7. 500kbps
  8. 1000kbps

Going onto the BUS

Once the device is detected and a desired bus speed is selected. Simply select “BUS ON” to have the device attempt to go onto the bus. If there are no errors, the “BUS ON” text should turn red and the label should read “BUS OFF”. If there are any errors they will be displayed in the console window (The small panel in the center - bottom).

Applying a MASK / CODE

The CANExplorer Device supports masking / filtering the canbus to ignore messages that don’t fit a specific pattern.

The MASK values are typically interpreted as a bit pattern that must match (if the specific bit in the numerical value is a 1) the CODE in order to be accepted. If it does not, then it will be discarded. To remove the stipulation, makae sure the numerical bit in the MASK is set to 0.

Mask: The mask acts as a bitwise selector, indicating which bits of the CAN ID should be considered for filtering.

  • If a mask bit is set to 1, the corresponding ID bit is used for comparison.

  • If a mask bit is set to 0, the corresponding ID bit is ignored during filtering.

Filter: The filter contains the expected values for the bits specified by the mask.

  • A CAN message is accepted if the relevant bits of its ID match the values in the filter.

  • If there’s a mismatch, the message is discarded.

Logging RAW Messages

CANStudio logs all outputs as hex by default. A single line in the log output will look as shown below:

(time) DIR ID#PAYLOAD

Time is a timestamp in seconds. DIR is a direction (Either Rx or Tx) PAYLOAD is a series of nibbles that implicitly detail the length of the message (DLC).

In order to start a log, a valid log name will need to be provided. Examples: log_file.txt The ‘Enable Logging’ checkbox will also need to be ticked. Afterwards, press the ‘Update Logging’ button to submit the changes.

Note: An empty file will be created immediately after enabling logging with a valid file name.

Adding Formatters

Using formatter’s can bus messages can either be tagged, decoded, or arranged in a specific way to make them easier to understand. Right now, CANStudio supports plain text (always on by default) and DBC parsing / message generation.

To load in a dbc to be utilized, Under the “Formatter List” menu in the left panel, click the folder icon. Select where the DBC file is located and hit okay. There should be a log entry that details if the procedure was successful or not. Once loaded, the signals should appear inside the “Signal Selection” portion of the plot tab.

To decode the incoming messages according to the DBC, make sure “USE” is selected. This will also enable a “DBC Message Builder” that will be discussed later.

Plotting Signals

Once DBC is loaded, all the signals inside that DBC are loaded and can be selected for plotting in real-time. Simply navigate to the “Signal Selection” tab in the plot panel (left side), and make sure the signals that are needed are ticked under the “Plot” column. Once completed, the waveform will be drawn in the plot area (First Tab).

To explore the options available for manipulating plots, simply right click inside the plot area.

Notable mentions:

  • Auto-Fit: To prevent an axis from auto-fitting, you can uncheck this option. Note: This is per axis (Time (s) or Magnitude)

  • Legend: The placement of the legend can be moved to view waveforms better.

Note: The “CLEAR DATA” option will erase all plot data. Note: This is called everytime the bus goes online.

Clearing The Center Panel

The Center panel contains a place to see the decoded signals as well as any errors / status updates from the program. To clear the current data in the list, press the “CLEAR” button.

Accessing the Settings Menu

Locate the center panel of the GUI (Graphical User Interface). Press the “SETTINGS” icon.

The two options for settings are “Fixed Positions” and “Hexadecimal”.

Selecting “Fixed Positions” will display a unique CAN Message per line. If new messages are detected they will overwrite the values in place. If “Fixed Positions” is not ticked, then the GUI will list up to 500 messages at a time in sequential order.

Selecting “Hexadecimal” will enable a global flag for all inputs to be capable of taking and formatting hexadecimal input. If “Hexadecimal” is not selected, all values will be in decimal input and formatting.

Message History Menu

Once a CAN message is sent through the interface, its recorded into the history to easily send it again. To do so, simply double click the “ID” of the message you would like to resend.

This list will hold up to 500 previously sent messages.

Note: The ‘Clear History List’ will remove all messages listed in the history list.

Error Status / CAN Transmission Panel

The Error Status Register gives specific details why an error is occuring on the device regarding the Reception and Transmission of CAN messages.

Error Warning Flag:

  • This bit is set by hardware when the warning limit has been reached (Receive Error Counter or Transmit Error Counter >= 96).

Error Passive Flag:

  • This bit is set by hardware when the Error passive limit has been reached (Receive Error Counter or Transmit Error Counter > 127).

Bus Off Flag:

  • This bit is set by hardware when it enters the bus-off state. The bus-off state is entered on TEC overflow, greater than 255.

Last Error Flag:

  • This field is set by hardware and holds a code which indicates the error condition of the last error detected on the CAN bus. If a message has been transferred (reception or transmission) without error, this field is cleared to 0.

Note: Hover over the input field to have the value decoded in a tooltip.

  • Transmit Error Counter: Least significant byte of the 9-bit transmit error counter. The implementing part of the fault confinement mechanism of the CAN protocol.

  • Recieve Error Counter:

The implementing part of the fault confinement mechanism of the CAN protocol. In case of an error during reception, this counter is incremented by 1 or by 8 depending on the error condition as defined by the CAN standard. After every successful reception the counter is decremented by 1 or reset to 120 if its value was higher than 128. When the counter value exceeds 127, the CAN controller enters the error passive state.

Transmitting Single CAN Messages

To send a CAN Message, the following fields must be set:

CAN Identifier, DLC, and the specific bytes that are desired to be transmitted.

The bytes can be random by hitting the randomize button.

Otherise, after those are set, simply hit “Send” to transmit a message.

Timed Transmission

By selecting the “Timed Transmission Builder” button a new window will be opened where the detailed of a timed transmission message will be requested.

To send a Timed Transmission CAN Message, the following fields must be set:

CAN Identifier, DLC, the period (10 to 65535 milliseconds) and the specific bytes that are desired to be transmitted.

Make sure the “Enable Timed Transmission” button is checked.

Pressing the “Update” button will update the timed transmission to match your newly desired settings.

About

The about button displays the creator of the application as well as the version information.

Download Software

CANStudio can be downloaded here.