Skip to main content
FW version: Stable

How to Get GPIO Reading Over CAN Bus

Prerequisites:

  • Device is powered ON
  • CAN bus is functioning properly
  • Device address is set to 0
note
  • All payloads use big-endian byte order

Step 1: Compose the CAN Frame

CAN IDDLC
0x1478
Byte 0Byte 1Byte 2Byte 3Byte 4 - Byte 5Byte 6 - Byte 7
Receiver address
0x0
Bank selector
0x8
Start ID
0x8 (GPIO0)
End ID
0xC (GPIO4)
Sampling period [ms]
0x64 (100ms period)
Delay [ms]
0x64 (100ms)
Setting this to 0 disables bank transmission

List of input IDs

Bank Selector

Up to 4 banks can be configured. Each bank can have different sampling rates and IDs.

Bank selectorDescription
0x8Bank 0
0x9Bank 1
0xABank 2
0xBBank 3
How to Calculate CAN ID

SID is 40, sender address is 7 -> (40 � 3) + 7 = 320 + 7 = 327 (DEC) = 0x147

Step 2: Receive Response

Messages will be received with the following CAN IDs based on the selected bank:

CAN IDBank
0x1500
0x1581
0x1602
0x1683

Structure of received messages:

Byte 0Byte 1Byte 2 - Byte 3Byte 4 - Byte 5Byte 6 - Byte 7
Device signature
Last bit is set if device is in error
Start IDUINT16 value for Start IDUINT16 value for start ID + 1UINT16 value for start ID + 2
note

For configurations with more than 3 IDs, the response values are multiplexed.

For the example above, you will receive these two messages with a 100ms delay between them:

CAN IDDLC
0x1508
Byte 0Byte 1Byte 2 - Byte 3Byte 4 - Byte 5Byte 6 - Byte 7
0xA (SC controller, no error)0x8 (GPIO0)UINT16 GPIO0 value [mV]UINT16 GPIO1 value [mV]UINT16 GPIO2 value [mV]
CAN IDDLC
0x1506
Byte 0Byte 1Byte 2 - Byte 3Byte 4 - Byte 5
0xA (SC controller, no error)0xB (GPIO3)UINT16 GPIO3 value [mV]UINT16 GPIO4 value [mV]