ACCES CAN INTERFACE PROTOCOL
Version 1.1 of 2022-01-25th 2021
Based on CAN232 V3 ASCII Commands, with FD extensions
Original CAN232 PDF at: http://www.can232.com/?page_id=72
[Information on SocketCAN via slcan]
Communication from host system to CAN interface using a USB virtual serial com port. A hardware with multiple CAN interfaces needs to provide one virtual com port per CAN interface. Using the "v" command, a host can determine which CAN port is available on which com port. Since enumeration of the virtual com ports is handled by the host OS, while it is likely we cannot guarantee that the first CAN port is linked to the numerically first virtual com port under all circumstances.
Unless autostart ("Q") was enabled, device starts up with CAN channel closed and waits for host commands.
Uses 7-bit ASCII coding. All numbers are hexadecimal: "0".."9", "A".."F"
· Command char
· Optional: Sub-command
· Optional: Command parameters
· [CR] (13h)
· ACK: [CR] (13h)
· NAK: [BELL] (07h)
· Data response: [Command char][Data][CR]
· [t/T][ID][Data][CR] — 11-bit/29-bit CAN data message
· [r/R][ID][CR] — 11-bit/29-bit CAN remote transmit request message
· zz[CR] indicates that 32-bit microsecond timer restarted
· F[CR] CAN HW Status Flags (same as response to request with same command)
The parameters for all transmit and receive commands are:
· i: CAN message frame ID (3 digits for 11-bit, 8 digits for 29-bit)
· l: 4-bit DLC value "0" to "F"
· d: CAN message frame data, 2 digits per byte
· z: optional, if enabled, 32-bit microsecond timestamp
Using one of the open commands while channel is open re-initializes the CAN interface
· O[CR]: Open channel
· E[CR]: (NEW) Open channel in echo/self-receipt mode
· L[CR]: Open channel in listen-only mode
· C[CR]: Close channel and restore default
· Sn[CR]: CAN and CAN FD bitrate selection
o CAN bitrate, S0 to S8 (bold is default)
Bitrate selection |
Nominal bitrate (kbps) |
S0 |
10 |
S1 |
20 |
S2 |
50 |
S3 |
100 |
S4 |
125 |
S5 |
250 |
S6 |
500 |
S7 |
800 |
S8 |
1000 |
o CAN FD data bitrate and CAN FD mode select, SA to SG, use after S5-S8
Bitrate selection |
Nominal bitrate (kbps) |
Data bitrate (kbps) |
S5 / SA |
250 |
250 |
S6 / SA |
500 |
500 |
S7 / SA |
800 |
800 |
S8 / SA |
1000 |
1000 |
S5-S8 / SB |
250-1000 |
1000 |
S5-S8 / SC |
250-1000 |
2000 |
S5-S8 / SD |
250-1000 |
4000 |
S5-S8 / SE |
250-1000 |
5000 |
S5-S8 / SF |
250-1000 |
8000 |
S5-S8 / SG |
250-1000 |
10000 |
Other combinations are not supported. Data bitrates in red are outside of hardware components's specifications and are not guaranteed to work.
· Zn[CR]: enables/disables (n=0/1) 16-bit millisecond timestamp that is added to each received message at the end. The timer starts at zero 0x0000 and goes up to 0xEA5F before it loops around and gets back to 0x0000. This corresponds to exactly 60,000mS (1 minute).
· zn[CR]: (NEW) enables/disables (n=0/1) 32-bit microsecond timestamp that is added to each received message at the end. Returned with n="z" to signal a 32-bit timestamp reset or overrun if timestamps are enabled.
· tiiildd..[CR] transmit 11-bit CAN data message
· riiil[CR] transmit 11-bit CAN remote transmit request message
· tfiiildd..[CR] transmit 11-bit CAN FD data message
· Tiiiiiiiildd..[CR] transmit 29-bit CAN data message
· Riiiiiiiil[CR] transmit 29-bit CAN remote transmit request message
· Tfiiiiiiiildd..[CR] transmit 29-bit CAN FD data message
·
Qn[CR] enable/disable autostart with current
configuration
(saves configuration to non-volatile memory)
· tiiildd..[CR] received 11-bit CAN data message
· riiil[CR] received 11-bit CAN remote transmit request message
· tfiiildd..[CR] received 11-bit CAN FD data message
· Tiiiiiiiildd..[CR] received 29-bit CAN data message
· Riiiiiiiil[CR] received 29-bit CAN remote transmit request message
· Tfiiiiiiiildd..[CR] received 29-bit CAN FD data message
· zz[CR] indicates that 32-bit microsecond timer restarted
All of these return the command letter, followed by data.
· V[CR]: Read CAN232 version
o return ACE5h to indicate this is not CAN232 but ACCES
· v[CR]: (NEW) Read extended version, data returned:
o 8-bit CAN port number (if multiple available, else 00h)
o 16-bit HW Type (one for each ACCES HW boards)
o 16-bit HW version (major/minor)
o 16-bit SW version (major/minor)
· N[CR]: read serial number
o return ACE5ACE5h to indicate this is not CAN232 but ACCES
· n[CR]: (NEW) read chip serial number
o return internal 128-bit chip ID
·
F[CR] Request CAN232 HW Status Flags (Bits clear on read)
Errors in data flow
o
Bit 0: CAN232_ERR_RXFIFO
Data overrun in CAN receive to host transfer.
o
Bit 1: CAN232_ERR_TXFIFO
Data overrun in receive by host send to CAN transfer.
o
Bit 4: CAN232_ERR_DATA
Error in data stream (unexpected characters).
Errors reported by CAN hardware
o Bit 2: CANN232_ERR_CANERR
o Bit 5: CAN232_ERR_PASSIVE
o
Bit 6: CAN232_ERR_BUSOFF
· f[CR] Request extended HW Status Info
o 8-bit Channel open/close status ("O","E","L","C")
o 8-bit Current nominal bitrate ("0" to "8")
o 8-bit Current data bitrate ("-" for CAN, "A" to "G" for CAN FD)
o 8-bit 16-bit timestamp enabled/32-bit timestamp enabled/disabled ("Z"/"z"/"-")
o 8-bit Autostart enabled/disabled (0/1)
· Un[CR] Set UART bitrate — no effect on virtual com port
o Always returns OK / [CR]
All other commands return [BELL] (NAK/fail).
The "f" in all CAN FD frame is used as follows:
· S: bitrate switch
· N: no bitrate switch
For FD frames the length value is from 0 to F, used same way as the DLC field is encoded in CAN FD frames:
Length DLC value |
Data length (bytes) |
0..8 |
0..8 |
9 |
12 |
10 (0xA) |
16 |
11 (0xB) |
20 |
12 (0xC) |
24 |
13 (0xD) |
32 |
14 (0xE) |
48 |
15 (0xF) |
64 |
32-bit microsecond timestamp: when enabled, each O/E/L command or timer value of all zeros causes the transmission of a zz[CR] sequence to the host, to indicate timer reset/overrun.
If an error is detected, the firmware generates the "F"lags response.
If the FIFO to the host needed flushing (deleted), the firmware inserts a [CR] and a [BELL] signal into the stream as a signal a fresh start to the host.
Because the mPCIe-UCAN2 family uses a superset of the common CAN232 protocol, it is also compatible with the standard Linux CAN interface, SocketCAN. Like any other CAN232 device you can use the can-utils package to configure slcan, which will provide a gateway between SocketCAN and the CAN232 serial-based protocol the hardware uses.
In Linux the mPCIe-UCAN2 will install as two device files,
Run the following
at this point
if needed you can install the
For additional information please refer to