mpCAN-USB

USB to Can adapter





















Description:

mpCAN-USB is a low cost small footprint USB to CAN adapter that allows connection to any CAN network, it can be flashed multiple firmwares to support different applications and platforms.

All applications are available in this link.

Features and Specifications:

  • Available API for LabView, C#, VB.Net, Delphi, Python (See Documentation)

  • Supports BUSMaster using SocketCAN Firmware (VSCOM)

  • Supports CAN2.0A/B, data rate up to1 Mbit/sec.

  • Jumper to activate/deactivate 120R Termination.

  • Jumper to enter bootloader mode.

  • Compatible with SocketCAN.

  • Supports candleLight gsusb.

  • Compatible with CAN Analyzer.

Flash new Firmware:

  1. Download mpFlasher Tool. Link

  2. Set the 1.27mm DFU jumper

  3. Plug in the USB cable, both LEDs should start blinking

  4. Once in DFU mode, the device will appear as "USB Serial Device"

  5. If you have multiple USB Serial devices connected make sure to choose the right one

  6. Click the "Three Dots" button to select the firmware file

  7. Then Click flash button.

1- SocketCAN Firmware (VSCOM API):

SocketCAN is similar CANtact firmware below, but support some extra features like BUSMaster compatiblity and availability of APIs in different languages such as LabView, C#, VB.Net, Delphi, Python and more.

Programming Examples

BUSMaster

You need to download the right version of BUSMaster provided in the Link above. Here is how to setup the hardware. Remember to set both Acceptance Code and Mask to '00000000'.


  1. Select VSCom CAN-API by clicking on 'Driver Selection -> VSCom CAN-API"

  2. Then Click on 'Channel Configuration -> Advanced'

  3. Click on 'Search for Devices on COM-Ports', the device should appear in the drop downlist or fill the right COM port number

  4. Check the 'Hardware Timestamps' check box.

  5. Choose the Baudrate.

  6. Most importantly set both Acceptance Code and Mask to '00000000'.

  7. Click 'OK', then Click the Connect button on the top left corner.


2- CANtact Firmware:

CANtact firmware is compatible with slcan-interface and can be used with socketcan and slcand with Linux. Under Windows it can be directly driven by the serial interface.

Drivers: On windows mpCAN-USB will appear as a comport (COMxx) in the devices manager. Under Linux and Mac as a USB CDC device, /dev/ttyUSBX for linux and /dev/cu.usbmodemXXXX on MacOS

Windows and Mac application:

CANtact App can be used to monitor and send packets on CAN bus. No drivers are needed just choose the right serial port and set the baud rate and it's all set.

Linux:

In Linux CAN interface can be brought up using slcand.

Example:

sudo slcand -o -c -s0 /dev/ttyUSB0 can0

sudo ifconfig can0 up

sudo ifconfig can0 txqueuelen 1000

cansend can0 123#11223344 # Send a CAN frame ID:0x123 payload:0x11223344

candump can0 # Receive CAN packets on CAN0

Python-CAN:

import can


bus = can.interface.Bus(bustype='slcan', channel='COM70', bitrate=500000) #Windows

#bus = can.interface.Bus(bustype='slcan', channel='/dev/ttyACM0', bitrate=500000) #Linux

msg = can.Message(arbitration_id=0x112233,

data=[1, 2, 3, 4, 5, 6, 7, 8],

is_extended_id=True)

try:

bus.send(msg)

print("Message sent")

except can.CanError:

print("Message NOT sent")

for msg in bus:

print(msg) ## Print received messages

3- candleLight Firmware:

candleLight firmware generally has a better performance than slcan. Under Windows and Ubuntu it can be used with MicroBus or Cangaroo APP.

Linux:

candleLight is natively supported under linux using gs_usb driver. Just plug it in and using this command:

ip link set can0 up type can bitrate 500000

candleLight Python:

For development you can install candle-driver

cangaroo app: source

4- CAN-Analyzer

CAN-Analyzer firmware is based on slcan firmware, it also uses CDC serial interface. This firmware was ported for the sole purpose of interfacing with realdash.