CAN FD
These commands are available three ways — in the FREE-WILi GUI app, in a serial terminal, and on the device itself. See Connecting it to a computer for how to reach them.
Stream CAN(FD)
Enables or disables streaming of received CAN/CAN-FD frames and bus errors from the selected channel to the host.
Example
o 0 1 # enable streaming on channel 0
o 1 0 # disable streaming on channel 1
Notes
- Each channel streams independently; toggling one channel does not affect the other.
- If only
channelparses successfully butenableddoes not, streaming on that channel is forced off as a safety fallback. - All frames will be received unless a receive filter is configured (see
Setup Filter) so the controller actually accepts the frames you want to observe. - FreeWili2 only has one CAN channel (channel 2 is reserved for future orcas)
How to use it — press o. At the prompt, enter: Channel and enable state.
What you enter — channel, enabled.
Transmit CAN(FD)
Transmits a single CAN 2.0 or CAN-FD frame on the selected channel. The frame is queued to the controller's transmit FIFO and sent as soon as the bus permits.
Valid payload lengths (DLC)
- Classic CAN (
canFd = 0):0–8bytes. - CAN-FD (
canFd = 1):0–8,12,16,20,24,32,48, or64bytes.
Any other byte count is rejected and the command reports Invalid.
Examples
# Classic CAN, standard ID 0x123, 4 data bytes
w 0 0x123 0 0 DE AD BE EF
# Classic CAN, extended ID 0x1ABCDEF, no data (remote/empty frame)
w 0 0x01ABCDEF 0 1
# CAN-FD, standard ID 0x200, 16-byte payload
w 0 0x200 1 0 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
Notes
- The frame is queued to the transmit FIFO; if the FIFO is full or the bus is unavailable the frame may be delayed.
- Make sure the controller's bit timing (and FD data-phase timing) is configured before transmitting — see the Neptune/Orca setup commands.
- For periodic / repeated transmission use
Transmit CAN(FD) Periodicinstead.
How to use it — press w. At the prompt, enter: Channel ArbID (hex) isCANFD isXtd Bytes (hex).
What you enter — channel, arb_id, can_fd, xtd_id, data_in.
Transmit CAN(FD) Periodic
Configures one of the controller's periodic-transmit slots. Each slot holds a CAN/CAN-FD frame that is re-sent automatically at a fixed interval (or as fast as the bus permits) until it is disabled.
Valid payload lengths (DLC)
- Classic CAN (
canFd = 0):0–8bytes. - CAN-FD (
canFd = 1):0–8,12,16,20,24,32,48, or64bytes.
Any other byte count is rejected and the command reports Invalid.
Short form (toggle only)
If only the first arguments parse — index, enable, and channel — the previously configured frame in that slot is simply enabled or disabled without being re-loaded:
p <index> <enable> <period_ignored> <channel>
In practice, to just turn a configured slot off, the simplest form is:
p 0 0 0 0 # disable slot 0 on channel 0
Examples
# Slot 0 on channel 0: send classic standard-ID 0x123 with 4 data bytes every 10 ms
p 0 1 10000 0 0x123 0 0 DE AD BE EF
# Slot 1 on channel 0: send CAN-FD standard-ID 0x200, 16-byte payload, as fast as possible
p 1 1 0 0 0x200 1 0 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
# Slot 2 on channel 0: extended-ID 0x1ABCDEF, no data, every 1 s
p 2 1 1000000 0 0x01ABCDEF 0 1
# Disable slot 0 on channel 0
p 0 0 0 0
Notes
- Frames are queued to the transmit FIFO; if the FIFO is full or the bus is unavailable the frame is delayed until room becomes available.
period = 0("as fast as possible") fills any free TX FIFO slots every service tick and can saturate the bus — use with care.- Make sure the controller's bit timing (and FD data-phase timing) is configured before transmitting — see the Neptune/Orca setup commands.
- Periodic slots are independent per channel; slot
0on channel0is unrelated to slot0on channel1. - To send a single, one-shot frame instead of a periodic stream, use
Transmit CAN(FD).
How to use it — press p. At the prompt, enter: index enable period (us) Channel (0-1) ArbID (hex) isCANFD isXtd Bytes (hex).
What you enter — index, enable, period, channel, arb_id, can_fd, xtd_id, data_in.
Setup Filter
Configures one of the CAN controller's hardware receive filters. Frames that do not match an enabled filter are dropped before reaching the stream / FIFO. If there are no filters configure Stream CAN(FD) shows all messages.
Examples
# Enable filter 0 on channel 0, standard ID, accept only ID 0x123
f 0 0 1 0 0x7FF 0x123
# Accept any standard ID 0x100–0x10F (mask off low 4 bits)
f 0 1 1 0 0x7F0 0x100
# Same as above, but only frames whose first data byte is 0xA5
f 0 1 1 0 0x7F0 0x100 0xFF 0xA5 0x00 0x00
# Disable filter 2 on channel 0 (only the first three args are needed)
f 0 2 0
Notes
- Omitting
mask/acceptis only valid whenenableis0; otherwise parsing fails and the command reportsInvalid. - If the byte-filter arguments are omitted, all four byte mask/accept values are cleared to
0(i.e., no byte filtering). - Byte filtering applies to standard IDs only; do not rely on
maskb0/maskb1whenxtdId = 1. - Filters are re-applied to the controller immediately (
setupFilters(false)) after a successful update. - if no filters are configured all frames will be received.
How to use it — press f. At the prompt, enter: channel (0-1), index (0-32), enable, isXTD, mskID, ID, [(optional) mskb0, b0, mskb1, b1].
What you enter — channel, index, enable, xtd_id, mask, accept, maskb0, accept_b0, maskb1, accept_b1.
Read CAN Register(s)
Reads one or more consecutive 32-bit Special Function Registers (SFRs) from the selected CAN controller and returns them to the host as name/value pairs.
Example
# Read 4 words starting at SFR address 0x000 on channel 0
r 0 0x000 4
Notes
- The command operates directly on the CAN controller's SFR space — be careful when reading registers that have read-side-effects (e.g. interrupt/error status clears).
- Use
Set CAN Register(s) to write a register, and the Neptune/Orca setup commands for normal bit-timing and configuration changes. - Returns
Invalidifchannelis out of range or any argument fails to parse. - FreeWili GUI decodes these values for helpful debugging
How to use it — press r. At the prompt, enter: channel (0-1) address (hex) wordcount.
What you enter — channel, start_address, word_count.
Set CAN Register
Writes a single 32-bit (or 8-bit) Special Function Register (SFR) on the selected CAN controller. This is a direct register write — bypassing the normal setup commands — and should be used only when you know exactly what the controller expects.
Examples
# Write the 32-bit value 0x00000004 to SFR 0x000 on channel 0
s 0 0x000 4 0x00000004
# Write the single byte 0xA5 to SFR 0x010 on channel 0
s 0 0x010 1 0xA5
Notes
- This is a raw register write — be careful with registers that have write-side-effects (mode changes, FIFO control, interrupt clears, etc.).
- For normal bit-timing and configuration changes, prefer the Neptune/Orca setup commands instead of writing SFRs directly.
- Use
Read CAN Register(s)(r) to verify the value after writing. - Returns
Invalidifchannelis out of range or any argument fails to parse.
How to use it — press s. At the prompt, enter: channel (0-1) address (hex) bytesize (1,4) word (hex).
What you enter — channel, start_address, byte_count, word_to_write.
See also: CAN (FD) panel — the on-screen panel for this.