How to Use the SH-C30L USB-to-CAN Adapter with Arduino UNO and MCP2515

2026年8月18日3 次浏览来源:Dev.to阅读原文

Controller Area Network (CAN) is one of those technologies that quietly powers a huge number of embedded systems.

It is commonly found in cars, EVs, industrial controllers, robotics, and other distributed systems where multiple devices need to exchange data reliably over a shared bus.

For development and debugging, it is useful to connect that CAN network to a computer.

The problem is that a standard computer communicates through USB, while CAN uses a dedicated differential bus.

A USB-to-CAN interface solves this problem by translating between the two.

In this project, we will explore the DSD TECH SH-C30L USB-to-CAN adapter, learn how its different firmware modes work, connect it to a PC, and then use an Arduino UNO with an MCP2515 CAN module to create a simple bidirectional CAN communication setup.

The goal is not just to make the hardware work, but also to understand what happens between the Arduino, CAN bus, USB adapter, and computer.

SH-C30L USB-to-CAN Adapter Overview The SH-C30L is a compact USB-to-CAN interface designed to connect a computer directly to a CAN network.

It is based on an STM32F072C8T6 microcontroller, which contains an integrated CAN controller.

This allows the adapter to handle CAN protocol processing without requiring a separate external CAN controller.

The microcontroller communicates with the computer through USB, while a dedicated CAN transceiver handles the physical CAN interface.

The transceiver converts the controller's logic-level signals into the differential CAN_H and CAN_L signals used on a CAN network.

One of the interesting aspects of the SH-C30L is its firmware flexibility.

The adapter can work with Candlelight firmware, which allows it to operate with Linux SocketCAN and compatible CAN applications, or with SLCAN firmware, where it behaves more like a serial CAN interface.

This makes the same hardware useful with different operating systems and software environments.

The adapter supports both CAN 2.0A and CAN 2.0B frames, with CAN speeds of up to 1 Mbps.

It also includes a switchable 120Ω termination resistor and a boot switch for entering firmware-update mode.

For a small development setup, these features make the SH-C30L a useful alternative to more expensive professional CAN interfaces.

Why Do We Need a Driver?

When you plug a USB-to-CAN adapter into a computer, the operating system needs to know how to communicate with the device.

On modern Windows systems, the SH-C30L can generally be detected using the operating system's built-in USB support, depending on the firmware installed.

Linux provides even stronger native CAN support through SocketCAN.

If the adapter appears as an unknown USB device, a driver may need to be installed manually.

Therefore, the first troubleshooting step should always be checking Device Manager on Windows or the relevant USB/CAN interfaces on Linux.

Software You Can Use The software required depends on the firmware and operating system.

On Linux, SocketCAN is particularly useful.

The package provides utilities such as: for monitoring CAN traffic for transmitting CAN frames for observing changing CAN data for checking bus utilization On Windows, Cangaroo provides a graphical interface for monitoring and transmitting CAN messages.

It can also work with DBC files for decoding signals.

For custom applications, Python is another useful option.

The library provides an interface for sending and receiving CAN messages from Python programs.

Using the SH-C30L with Linux and SocketCAN Linux is particularly convenient for CAN development because CAN support is integrated into the operating system through SocketCAN.

When the SH-C30L is running Candlelight firmware, it can appear as a native CAN interface such as .

With SLCAN firmware, the setup is slightly different because the adapter is exposed through a serial interface and tools such as can be used to create a CAN network interface.

Using the SH-C30L with Python Python is useful when CAN communication needs to become part of a larger application.

Instead of manually watching frames in a CAN analyzer, you can write a program that records messages, checks specific CAN IDs, generates test traffic, or communicates with another application.

The connection method depends on the firmware.

A Candlelight-based setup can use a SocketCAN interface such as , while an SLCAN configuration may use a serial port.

Windows Testing with Cangaroo Windows users can use Cangaroo to verify that the SH-C30L is communicating correctly.

Start by connecting the adapter to the PC and opening Device Manager.

With the factory Candlelight firmware, the adapter may appear as a CANable/-type device.

Next, launch Cangaroo and open its measurement setup.

If the adapter is detected correctly, the available CAN interface should appear in the interface list.

Select the detected interface and configure the CAN bitrate to match the network.

For example, if the CAN network operates at 500 kbps, the software must also be configured for 500 kbps.

Once the interface is active and another CAN node is transmitting, frames should begin appearing in the monitoring window.

This is a simple way to verify the adapter before connecting it to a more complicated embedded system.

MCP2515 CAN Module Overview The Arduino UNO is a popular development board, but it does not include a native CAN controller.

To add CAN functionality, an external CAN controller and transceiver are required.

The commonly available MCP2515 CAN module solves this problem by combining an MCP2515 CAN controller with a CAN transceiver, often a TJA1050 on typical modules.

MCP2515 CAN Controller The MCP2515 handles the CAN protocol itself.

It communicates with the Arduino through the SPI bus and takes care of CAN frame transmission and reception.

It supports standard 11-bit identifiers as well as extended 29-bit identifiers and provides hardware filtering and masking features.

These functions are useful when a CAN network contains many different message IDs but the Arduino only needs to process a small subset.

The MCP2515 also has an interrupt output.

When a relevant CAN event occurs, the INT pin can notify the Arduino so that the microcontroller does not have to continuously poll the controller.

TJA1050 CAN Transceiver The MCP2515 cannot directly drive the CAN_H and CAN_L lines.

The TJA1050 transceiver handles this physical-layer conversion.

It converts the digital CAN signals from the MCP2515 into the differential signals used on the CAN bus and converts incoming CAN bus signals back into logic-level signals for the controller.

In simple terms: MCP2515 = CAN protocol controller TJA1050 = CAN physical-layer transceiver Together, they provide the Arduino with a practical CAN interface. 120Ω Termination CAN networks normally require termination resistors at both physical ends of the bus.

Many MCP2515 modules include a 120Ω resistor that can be enabled or disabled with a jumper.

Whether you should enable it depends on where the module is located in the CAN network.

If the MCP2515 is one end of the bus, its termination can be enabled.

If it is a middle node, the termination should normally be disabled.

The SH-C30L also has a switchable 120Ω termination resistor, which makes it convenient to create a correctly terminated two-node test network.

Crystal Oscillator The MCP2515 requires a clock reference for CAN timing.

Common breakout boards use either an 8 MHz or 16 MHz oscillator.

This is important when configuring the Arduino library.

The oscillator frequency defined in the software must match the actual MCP2515 module.

Using the wrong oscillator setting can result in CAN initialization or communication problems even when the wiring is correct.

Interfacing Arduino UNO with MCP2515 The MCP2515 communicates with the Arduino UNO using SPI.

For a typical UNO setup, connect: MCP2515 Arduino UNO VCC 5V GND GND CS D10 MOSI D11 MISO D12 SCK D13 INT Optional interrupt pin The CS pin can be changed in software, but the SPI data pins are nor

分享
Baike.dev

baike.dev helps you discover great languages, frameworks, databases, DevOps and cloud-native tools.

Quick links

About

Contribute

Found a great developer tool? Share it with the community.

Submit a tool
© 2026 baike.dev Developer EncyclopediaUpdated daily · Discover great developer tools