1. Device purpose
This device is a CAN/CAN FD interface based on:
- Nucleo-G474RE
- CAN-FD HAT by Embedded Garage
The firmware provides three active protocol modes over USART2:
- CLI, a text service console
- SLCAN, an interface compatible with Lawicel/SLCAN class applications
- GVRET, a binary protocol compatible with SavvyCAN GVRET interface class tools
The firmware supports three FDCAN controllers:
- CAN1
- CAN2
- CAN3
2. Startup behavior
- After a successful start, the application initializes Flash, licenses, system LEDs, inputs, UART, CAN, router, and trigger modules.
- The default active protocol after boot is CLI.
- All three CAN buses are initialized during startup.
- Default rates are 100000 bps for the nominal phase and 1000000 bps for the CAN FD data phase.
Note:
- CAN configuration (speeds, enable/disable, listen-only, filters), routing (forwarding), relay triggers, and input triggers are saved automatically to Flash on every change, provided the Store Config license is active.
- Without the Store Config license, configuration changes apply at runtime but are not retained after reboot.
- License data is written with the
liccommand and does not require the Store Config license. - The active protocol (CLI/SLCAN/GVRET) is saved to Flash on every change.
3. Host interface
Communication with the host uses USART2.
Baudrate depends on the active protocol:
- CLI: 115200 bps
- SLCAN: 115200 bps
- GVRET: 1000000 bps
Other UART settings:
- 8 data bits
- no parity
- 1 stop bit
- no flow control
The UART layer uses DMA and buffering:
- DMA RX: 256 bytes
- RX buffer: 2048 bytes
- TX buffer: 2048 bytes
- CLI command buffer: 256 characters
- SLCAN command buffer: 64 characters
4. Hardware elements
4.1 12V inputs
Four digital 12V inputs are available:
- I1
- I2
- I3
- I4
The inputs are active high and use 50 ms software debounce.
4.2 Buttons
Six buttons are available:
- SW1
- SW2
- SW3
- SW4
- SW5
- SW6
Buttons are active low and use 50 ms debounce.
In the current application version, only this one is used directly:
- SW1: switch active protocol
SW3-SW6 can be used by the inp_trig function as button trigger sources.
4.3 Relay outputs
Four relay outputs are available:
- Q1
- Q2
- Q3
- Q4
In the current firmware version, Q1-Q4 do not indicate CLI/SLCAN/GVRET mode. They are intended for relay trigger functionality if configured by a CLI command and enabled by the corresponding license.
4.4 System LEDs
The board has system LEDs:
- RDY
- BUSY
RDY LED meaning:
- startup: 1000 ms ON / 200 ms OFF pattern
- normal operation: steady ON
- warning: 500 ms ON / 500 ms OFF
- critical error: 100 ms ON / 100 ms OFF
BUSY LED meaning:
- driven by a pattern corresponding to the current protocol. According to the number of pulses:
- 1: CLI control (console)
- 2: SLCAN/LAWICEL protocol
- 3: GVRET protocol
Additionally, each CAN bus has separate RX and TX LEDs driven by frame activity.
5. CAN buses
Firmware supports:
- Classic CAN
- CAN FD
- CAN FD with BRS
- standard 11-bit and extended 29-bit identifiers
- DATA and RTR frames
Default startup rates for CAN1, CAN2 and CAN3:
- nominal bitrate: 100000 bps
- CAN FD data bitrate: 1000000 bps
Available nominal bitrates:
- 1000
- 2000
- 5000
- 10000
- 20000
- 50000
- 100000
- 125000
- 250000
- 500000
- 1000000
Available CAN FD data bitrates:
- 1000000
- 2000000
- 4000000
- 5000000
- 8000000
CAN buffers and queues:
- RX queue: 16 frames per interface
- TX queue: 16 frames per interface
- standard filters: 28 entries
- extended filters: 8 entries
By default, frame forwarding to the console is enabled for CAN1 only. Forwarding from the active protocol to CAN1 is enabled by default. CAN-to-CAN forwarding is disabled by default.
6. Operating modes
6.1 CLI
CLI is active after startup. The user communicates through a serial terminal and enters text commands terminated with Enter.
Commands available in CLI:
help [command]– list commands or details for a selected commandcan_tx <bus> <id_hex> <S|E> <D|R> <C|F|B> <len> [data_hex]– send a CAN or CAN FD framecan_status– forwarding matrix table (source vs target)can_en <bus> <E|D>– enable or disable a buscan_silent <bus> <E|D>– enable or disable listen-onlycan_fwd_set <source_bus> <target_bus> <0|1>– CAN-to-CAN, CAN-to-active-protocol, or protocol-to-CAN routing;0in bus field means protocol;source_bus = 0andtarget_bus = 0simultaneously is not allowedcan_speed <bus> <bitrate>– set nominal bitratecan_fd_speed <bus> <bitrate>– set CAN FD data phase bitratecan_filter <bus> <idx> <M|R|D> <id1_hex> <id2_hex> <S|E> <R|N|A>– configure CAN filtercan_filters_get <bus>– read filter listrly_trig <relay> <bus> <S|C|T|P> <id_hex> <S|E> <len> <D|R> <C|F|B> <mask_hex> <value_hex> [duration_ms]– configure relay control based on CAN framerly_trig_get <relay>– read relay trigger configurationinp_trig <input> <R|F|H> <interval_ms> <bus> <id_hex> <S|E> <D|R> <C|F|B> <len> [data_hex]– send CAN frame on input eventinp_trig_dis <input> [R|F|H]– disable input triggerinp_trig_get– read input trigger configurationlic <idx> <hash64>– write license hash to Flashlic_get– device UID, license slot contents, and active feature statusdefault_config– restore default configuration in Flash memoryreboot– reboot the device
Abbreviations in CLI:
SandEmean standard or extended identifierDandRmean DATA or RTRC,F,Bmean Classic CAN, CAN FD, and CAN FD with BRS- in
can_filter:M= mask,R= range,D= dual, and actions areR= reject,N= none,A= accept - in
rly_trig:S= set,C= clear,T= toggle,P= pulse - in
inp_trig:R= rising,F= falling,H= hold
CLI command examples:
helphelp can_txcan_tx 1 1F0 S D C 8 1122334455667788can_tx 3 123 S D B 12 00112233445566778899AABBcan_speed 1 500000can_fd_speed 1 2000000can_en 2 Dcan_silent 2 Ecan_fwd_set 1 2 1can_fwd_set 2 0 1can_fwd_set 0 1 1can_filter 1 0 M 123 7FF S Alic_get
CLI limitations in current code:
can_filterrequires an active Extended CAN filters licenserly_trig*functions require an active CAN relay trigger licenseinp_trig*functions require an active CAN button trigger license- writing configuration to Flash on every change requires an active Store Config license
6.2 SLCAN
SLCAN is the second active router protocol. Protocol is switched with SW1.
SLCAN is connected only to:
- CAN1
Supported SLCAN parser commands:
O– open CAN1C– close CAN1Sx– set nominal bitrate for CAN1Yx– set CAN FD data phase bitrate for CAN1V– get firmware version string (Vxx.yy)t,T– transmit classic DATA framesr,R– transmit classic RTR framesd,D– transmit CAN FD without BRSb,B– transmit CAN FD with BRS
SLCAN bitrate mapping:
S0= 10000S1= 20000S2= 50000S3= 100000S4= 125000S5= 250000S6= 500000S8= 1000000
SLCAN CAN FD data bitrate mapping:
Y1= 1000000Y2= 2000000Y4= 4000000Y5= 5000000Y8= 8000000
Example SLCAN frames and commands:
O– open CAN1 for operation in SLCAN modeC– close CAN1S6– set CAN1 nominal speed to 500000 bpsY2– set CAN FD data phase speed to 2000000 bpst12381122334455667788– standard Classic CAN DATA frame with ID0x123, length 8 bytes, and data11 22 33 44 55 66 77 88T1ABCDEFF411223344– extended Classic CAN DATA frame with ID0x1ABCDEFF, length 4 bytes, and data11 22 33 44r3210– standard RTR frame with ID0x321and length 0R1ABCDEFF8– extended RTR frame with ID0x1ABCDEFFand length 8d123CAA55AA55AA55AA55AA55– standard CAN FD frame without BRS, ID0x123, DLCCmeaning 24 data bytes; after DLC, 48 hex characters are requiredD1ABCDEFF9AABBCCDDEEFF001122334455– extended CAN FD frame without BRS, ID0x1ABCDEFF, DLC9meaning 12 data bytesb1239AABBCCDDEEFF001122334455– standard CAN FD frame with BRS, ID0x123, DLC9meaning 12 data bytesB1ABCDEFFA00112233445566778899AABBCCDDEEFF– extended CAN FD frame with BRS, ID0x1ABCDEFF, DLCAmeaning 16 data bytes
Transmit frame format description:
tandrmean standard 11-bit IDTandRmean extended 29-bit IDdandDmean CAN FD without BRSbandBmean CAN FD with BRS- after ID there is a single DLC character in hex format
- for Classic CAN frames, DLC
0-8equals the number of data bytes - for FD frames, parser DLC mapping follows CAN FD standard:
9=12,A=16,B=20,C=24,D=32,E=48,F=64bytes - RTR frames do not include a data field after DLC
- all commands must end with CR or LF
SLCAN limitations in this version:
- only CAN1 is handled by the SLCAN parser (protocol limitation)
- only non-FD frames up to 8 bytes are reported to the host
- commands
F,M,m,N,sare recognized by the parser but do not provide full end-user functionality - outgoing host frames include a timestamp in ms sent modulo
0xFFFF
6.3 GVRET
GVRET is the third active router protocol. Protocol is switched with SW1.
GVRET uses binary frames with SOF byte 0xF1.
Supported GVRET commands handled by the parser:
0x00– CAN frame from host to device0x05– set CAN1/CAN2 configuration (enable, listen-only, nominal bitrate)0x06– get CAN1/CAN2 status0x07– get device info (includes firmware version)0x09– communication validation0x0C– get bus count0x0D– get extended bus info (CAN3)0x0E– set extended bus config (CAN3)0x01– time synchronization
GVRET behavior in current firmware:
- reported bus count is 3 (CAN1, CAN2, CAN3)
- incoming CAN traffic is reported to GVRET for all three CAN buses
- both Classic CAN and CAN FD frames are sent to the host
- host-to-device transmit parser currently handles
0x00CAN frame command;0x14CAN FD host transmit is not handled
7. Licenses
The license system uses the MCU UID and stores 32-byte SHA-256 hashes in user Flash.
Licensed features:
- Extended CAN filters
- CAN relay trigger
- CAN button trigger
- Store config (automatic saving of configuration to non-volatile memory on every change)
8. Trigger features
8.1 Relay trigger
Each Q1-Q4 relay can react to a matching CAN frame.
Available modes:
- ON/OFF
- TOGGLE
- PULSE with duration in milliseconds
Matching includes:
- bus number
- CAN identifier
- standard or extended ID type
- RTR or DATA
- Classic CAN or CAN FD
- BRS
- data length
- data mask and value
8.2 Input trigger
Inputs and buttons can send a configured CAN frame on event:
- rising (button press / applying 12V signal)
- falling (button release / signal release)
- hold with periodic interval – sent while the button is held or while 12V is present on one of the
Ixinputs
Input mapping for inp_trig command:
I1toI4B3toB6for SW3-SW6 buttons
Input mapping for inp_trig_dis command:
I1toI4B3toB6for SW3-SW6 buttons
9. Quick start
- Connect Nucleo-G474RE and CAN-FD HAT.
- Drag the
.hexfile to the virtual USB drive. - Open terminal at 115200 8N1.
- After startup, run
help. - Check interface status with
can_status. - If needed, set speeds using
can_speedandcan_fd_speed. - Send a test frame with
can_tx. - To switch to SLCAN, press SW1 and use Lawicel-compatible commands on CAN1.
- To switch to GVRET, press SW1 again and connect host software at 1000000 bps (8N1), for example SavvyCAN in GVRET mode.
10. Diagnostics
- No UART communication:
- check active protocol and required baudrate (CLI/SLCAN: 115200, GVRET: 1000000)
- check USART2 connection
- check whether host sends CR or LF line endings
- No CAN frames:
- check 120 Ohm termination
- check bitrate match on both bus sides
- check
can_status - check whether bus is in
can_silentmode - check whether interface was disabled with
can_en <bus> D
- No relay trigger or input trigger reaction:
- check
lic_get - confirm required license is active
- check ID, frame type, length, and masked data match
- check
- Incomplete SLCAN support:
- expected in this version due to CAN1-only support and missing full implementation of
F,M,m,N,s
- expected in this version due to CAN1-only support and missing full implementation of

