Recent Posts
Programmable CAN Bus to USB, Bluetooth, BLE, WiFi Gateway
Posted by
on
For the longest time, I had resisted the idea of creating my version of a CAN-to-USB gateway, primarily due to the vast competition. A professional CAN/J1939 development requires a professional CAN-to-PC solution to monitor data traffic. I am pleased with the PEAK PCAN-USB device, as shown in the above image. However, not everybody is willing (or able) to spend in the neighborhood of $500...$800 for such a commodity. On the other hand, there are lower-priced alternatives, but they usually shine through poorly written firmware and bizarre PC user interfaces. Furthermore, regardless of the price range, most gateways either do not provide a programming interface or are excessively complex.
Consequently, we at Copperhill Technologies will enter the market with a reasonably priced and easy-to-program series of CAN Bus gateways. And since we are using the ESP32 processor for our development, we will offer not only a USB connection but also Bluetooth, BLE, and Wifi. The initial version will support Classical CAN, but we are currently modifying existing hardware to support CAN FD.
The current hardware is the same as for our SAE J1939-to-USB Gateway (see image to the right). In addition, we are utilizing existing software libraries which helps to shorten the development process.
We use an ASCII-based serial protocol for communication between the gateway and the PC. It loosely resembles the commands and functionality of the LAWICEL CAN232/CANUSB specifications to establish a basic communication format. It uses only a sub-set of the LAWICEL commands but adds new features where necessary (e.g., to support CAN FD features).
Furthermore, the protocol differs from the LAWICEL functionality regarding the command responses. While LAWICEL responds to commands with either CR (ASCII 13 = success) or BELL (ASCII 7 = error), our version responds with the command token (first character of the command line = Success) or 'x' for error, terminated by a CR.
Available ASCII Commands
- All messages between the gateway and the PC end with [CR] (ASCII 13) and are case-sensitive.
- All ASCII commands start with a token byte identifying the function.
- Commands are accepted by repeating the token, while erroneous commands are answered with ‘x’.
Here is a set of available ASCII Commands:
The image below demonstrates a sample to transmit an 11-bit CAN data frame:
The next image (below) shows a test session, where I set the CAN baudrate (S command), opened the CAN port (O command), and sent CAN data frame with an 11-bit message identifier (t command).
Following these commands are several CAN data frames as received from the PEAK PCAN-USB gateway. These are samples of 11-bit and 29-bit messages.
As part of the delivery, we will provide C source code samples for programming under Linux and C# for Windows demonstrating the process. Finally, a Windows monitor, analyzer, and recording software is in the works, but it will take a few more months before it is ready for release.
Last, but not least, please feel free to contact us for further information.
SAE J1939 ECU Simulator and Gateway With USB Port
Our SAE J1939 gateway allows you to monitor, simulate, and record any PGN as defined in the SAE J1939-71 Standard but also including diagnostic messages according to SAE J1939-73. The gateway supports the full SAE J1939 protocol according to J1939/81 Network Management (Address Claiming) and J1939/21 Transport Protocol (TP). It is also supported by an extensive programming interface for Windows and Linux/Ubuntu applications, including full C/C++/C# source code for short time-to-market developments.