Skip to main content
FW version: Stable

How to get GPIO reading over CAN bus

What do you need to prepare before:

  • The controller is turned ON
  • CANbus works properly
  • The controller CAN address is set to 0
note
  • All the values are in big-endian

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)
If you set 0 here, you will disable sending of this bank.

List if input ID

Bank selector

You can configure up to 4 banks. Each bank can have different sampling rate and diferent IDs.

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

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

Step 2: Receive response

Depend on the selected bank, you will get message with these CAN IDs:

CAN IDBank
0x1500
0x1581
0x1602
0x1683

Structure of the received message is in the table below:

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

If you configure bank for more than 3 IDs, the response multiplex the values.

For the example above, you will get these two messages, with 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]