-
-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Copyright © 2020-2024 Uwe Vogt, UV Software, Berlin ([email protected]) \
Rusoku Technologies is an innovative engineering team based in Lithuania, Europe. They offer CAN adapter at a reasonable price. Drivers and utilities for Windows and Linux are available as open-source. A macOS user-space driver for TouCAN USB interfaces from Rusoku is provided by UV Software.
The macOS driver for TouCAN USB Interfaces from Rusoku is based on MacCAN-Core which is an abstraction (or rather a wrapper) of Apple´s IOUsbKit to create USB user-space drivers for CAN interfaces from various vendors under macOS.
The GitHub repository contains the source code for the MacCAN-TouCAN driver and several alternatives to build dynamic libraries for macOS, either as a C++ class library (libTouCAN), or as a CAN API V3 wrapper library (libUVCANTOU), as well as some example programs and my beloved CAN utilities can_moni
and can_test
.
The MacCAN-TouCAN driver comes with an CAN API V3 compatible API.
CAN API V3 is a wrapper specification by UV Software to have a uniform CAN Interface API for various CAN interfaces from different vendors running under multiple operating systems. See header file CANAPI.h
for the CAN API V3 wrapper specification.
Feature | Supported | Remarks |
---|---|---|
CAN 2.0 | ✔️ | Classical CAN |
CAN FD | ❌ | Flexible Data-rate CAN |
Bit-rate, CAN 2.0 | ✔️ | high speed: up to 1 Mbps |
Bit-rate, CAN FD | ❌ | nominal: up to 1 Mbps data phase: up to 8 Mbps |
11-bit identifier (STD) | ✔️ | CAN 2.0 |
29-bit identifier (XTD) | ✔️ | CAN 2.0 |
Remote frames (RTR) | ✔️ | CAN 2.0 |
Error frames (ERR) | ✔️ | CAN 2.0 |
Error indicator (ESI) | ❌ | CAN FD only |
Bit-rate switching (BRS) | ❌ | CAN FD only |
Listen-only mode (MON) | ✔️ | CAN 2.0 |
Identifier filtering | ✔️ | CAN 2.0, Std. and Xtd. IDs |
Operation modes: | ||
- Monitor mode enable/disable (MON) | ✔️ | disabled by default |
- Error frames enable/disable (ERR) | ✔️ | disabled by default |
- Remote frames disable/enable (NRTR) | ❌ | not supported |
- Extended frames disable/enable (NXTD) | ❌ | not supported |
- Shared access enable/disable (SHRD) | ❌ | not supported |
- Non-ISO CAN FD enable/disable (NISO) | ❌ | not supported |
- Bit-rate switching enable/disable (BRSE) | ❌ | not supported |
- CAN FD operation enable/disable (FDOE) | ❌ | not supported |
Bit-rate settings: | ||
- Pre-defined bit-timing indexes | ✔️ | acc. CiA CANopen specification |
- BTR register values | ✔️ | register fields: - freq (clock frequency in [Hz])- brp (bit-rate prescaler)- tseg1 (time segment 1)- tseg2 (time segment 2)- sjw (synchronization jump width)- sam (number of samples) |
Message reception: | ||
- Message queue (FIFO) | ✔️ | up to 64K CAN messages |
- Polling | ✔️ | return immediately |
- Timed out | ✔️ | wait up to 65'534 milliseconds |
- Blocking read | ✔️ | wait infinitely |
Message transmission: | ||
- Acknowledged write | ❌ | not supported |
- Buffered write | ✔️ | buffer size depends on the hardware |
Software Development Kit: | ||
- VSCP CANAL API | ❌ | not available |
- CAN API V3 | ✔️ | C API and C++ API by UV Software |
- Dynamic library | ✔️ |
libUVCANTOU.dylib , libTouCAN.dylib
|
- Static library | ✔️ |
libUVCANTOU.a , libTouCAN.a
|
- Source code | ✔️ | BDS-2-Clause or GPL-3.0-or-later |
- Apple silicon | ✔️ | and Intel architecture |
- Swift wrapper | ✔️ | Swift 5.5 (including SPM) |
- Python wrapper | ✔️ | Python 3.8 |
- Windows wrapper | ✔️ | not available |
- Utilities | ✔️ | CLI utilities can_moni and can_test
|
- Examples | ✔️ | C, C++, Swift, Python |
Property | Datatype | since | Description |
---|---|---|---|
CANPROP_GET_SPEC | uint16_t | v0.1 | Version of the wrapper specification |
CANPROP_GET_VERSION | uint16_t | v0.1 | Version number of the library |
CANPROP_GET_PATCH_NO | uint8_t | v0.1 | Patch number of the library |
CANPROP_GET_BUILD_NO | uint32_t | v0.1 | Build number of the library |
CANPROP_GET_LIBRARY_ID | int32_t | v0.1 | Library id of the library |
CANPROP_GET_LIBRARY_VENDOR | char[256] | v0.1 | Vendor name of the library |
CANPROP_GET_LIBRARY_DLLNAME | char[256] | v0.1 | File name of the library DLL |
CANPROP_GET_DEVICE_CHANNEL | int32_t | v0.1 | Device type of the CAN interface |
CANPROP_GET_DEVICE_NAME | char[256] | v0.1 | Device name of the CAN interface |
CANPROP_GET_DEVICE_VENDOR | char[256] | v0.1 | Vendor name of the CAN interface |
CANPROP_GET_DEVICE_DLLNAME | char[256] | v0.2 | File name of the CAN interface DLL |
CANPROP_GET_DEVICE_PARAM | char[256] | (n/a) | Device parameter of the CAN interface |
CANPROP_GET_OP_CAPABILITY | uint8_t | v0.1 | Supported operation modes of the CAN controller |
CANPROP_GET_OP_MODE | uint8_t | v0.1 | Active operation mode of the CAN controller |
CANPROP_GET_BITRATE | can_bitrate_t | v0.1 | Active bit-rate of the CAN controller |
CANPROP_GET_SPEED | can_speed_t | v0.1 | Active bus speed of the CAN controller |
CANPROP_GET_STATUS | uint8_t | v0.1 | Current status register of the CAN controller |
CANPROP_GET_BUSLOAD | uint8_t | v0.1 | Current bus load of the CAN controller(in [1/100]) |
CANPROP_GET_NUM_CHANNELS | uint8_t | (n/a) | Numbers of CAN channels on the CAN interface |
CANPROP_GET_CAN_CHANNEL | uint8_t | (n/a) | Active CAN channel on the CAN interface |
CANPROP_GET_CAN_CLOCKS | int32_t[64] | (n/a) | Supported CAN clocks (in [Hz]) |
CANPROP_GET_TX_COUNTER | uint64_t | v0.1 | Total number of sent messages |
CANPROP_GET_RX_COUNTER | uint64_t | v0.1 | Total number of received messages |
CANPROP_GET_ERR_COUNTER | uint64_t | v0.1 | Total number of received error frames |
CANPROP_GET_RCV_QUEUE_SIZE | uint32_t | (n/a) | Maximum number of message the receive queue can hold |
CANPROP_GET_RCV_QUEUE_HIGH | uint32_t | (n/a) | Maximum number of message the receive queue has hold |
CANPROP_GET_RCV_QUEUE_OVFL | uint64_t | (n/a) | Overflow counter of the receive queue |
CANPROP_GET_FILTER_11BIT | uint64_t | v0.3 | Acceptance filter code and mask for 11-bit identifier |
CANPROP_GET_FILTER_29BIT | uint64_t | v0.3 | Acceptance filter code and mask for 29-bit identifier |
CANPROP_SET_FILTER_11BIT | uint64_t | v0.3 | Set value for acceptance filter code and mask for 11-bit identifier |
CANPROP_SET_FILTER_29BIT | uint64_t | v0.3 | Set value for acceptance filter code and mask for 29-bit identifier |
CANPROP_SET_FILTER_RESET | NULL |
v0.3 | Reset acceptance filter code and mask to default values |
CANPROP_SET_FIRST_CHANNEL | NULL |
v0.2.2 | Set index to the first entry in the interface list |
CANPROP_SET_NEXT_CHANNEL | NULL |
v0.2.2 | Set index to the next entry in the interface list |
CANPROP_GET_CHANNEL_NO | int32_t | v0.2.2 | Get channel no. at actual index in the interface list |
CANPROP_GET_CHANNEL_NAME | char[256] | v0.2.2 | Get channel name at actual index in the interface list |
CANPROP_GET_CHANNEL_DLLNAME | char[256] | v0.2.2 | Get file name of the DLL at actual index in the interface list |
CANPROP_GET_CHANNEL_VENDOR_ID | int32_t | v0.2.2 | Get library id at actual index in the interface list |
CANPROP_GET_CHANNEL_VENDOR_NAME | char[256] | v0.2.2 | Get vendor name at actual index in the interface list |
CANPROP_GET_VENDOR_PROP | void* | v0.1 | Get a vendor-specific property value |
CANPROP_SET_VENDOR_PROP | void* | v0.1 | Set a vendor-specific property value |
Only the following devices from Rusoku Technologies are supported:
- TouCAN USB (Model F4FS1)
For technical specifications, prices and delivery terms see Rusoku´s website.
For a list of known bugs and caveats see tab Issues in the GitHub repo.
A generic documentation of the CAN API V3 application programming interface can be found here.
Except where otherwise noted, this work is dual-licensed under the terms of the BSD 2-Clause "Simplified" License and under the terms of the GNU General Public License v3.0 (or any later version). You can choose between one of them if you use these portions of this work in whole or in part.
SPDX-License-Identifier: BSD-2-Clause OR GPL-3.0-or-later
Mac and macOS are trademarks of Apple Inc., registered in the U.S. and other countries.
Windows is a registered trademark of Microsoft Corporation in the United States and/or other countries.
Linux is a registered trademark of Linus Torvalds.
All other company, product and service names mentioned herein may be trademarks, registered trademarks, or service marks of their respective owners.
If you connect your CAN device to a real CAN network when using this library, you might damage your application.
E-Mail: mailto://[email protected]
Internet: https://www.mac-can.net