0% found this document useful (0 votes)
18 views

Can SDK Cheatsheet

The document outlines an API for working with Controller Area Network (CAN) buses in C, including functions for initializing CAN controllers, filtering CAN IDs, transmitting and receiving CAN frames, and handling errors and events on the bus. It details how to configure bit rates and filters, make and send CAN frames, receive incoming frames and error events, and access timestamps and other metadata about transmissions and receptions. The API provides low-level access for building applications that interface with vehicles and industrial equipment using the CAN bus standard.

Uploaded by

cctv.back
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Can SDK Cheatsheet

The document outlines an API for working with Controller Area Network (CAN) buses in C, including functions for initializing CAN controllers, filtering CAN IDs, transmitting and receiving CAN frames, and handling errors and events on the bus. It details how to configure bit rates and filters, make and send CAN frames, receive incoming frames and error events, and access timestamps and other metadata about transmissions and receptions. The API provides low-level access for building applications that interface with vehicles and industrial equipment using the CAN bus standard.

Uploaded by

cctv.back
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

canislabs.

com
Controller Area Network SDK API for C kentindell.github.io

CAN controller CAN ID filters CAN errors


Starting Bit rates Filters Making Receiving
can_setup_controller( controller, CAN_BITRATE_500K_75 CAN_NO_FILTERS can_make_id_filter(filter, canid) can_event_is_error(event)
bitrate, CAN_BITRATE_250K_75
CAN_BITRATE_125K_75 Options can_make_id_filter_all() can_event_get_error(event)
all_filters, can_make_id_filter_masked( filter,
CAN_BITRATE_1M_75 CAN_OPTION_REJECT_REMOTE Reading
mode, CAN_BITRATE_500K_50 CAN_OPTION_HARD_RESET ide,
options) CAN_BITRATE_250K_50 CAN_OPTION_RECV_ERRORS can_error_is_crc(error)
arbitration_id_match,
can_controller_get_options(controller) CAN_BITRATE_125K_50 CAN_OPTION_OPEN_DRAIN can_error_is_stuff(error)
CAN_BITRATE_1M_50 CAN_OPTION_RECORD_TX_EVENTS
arbitration_id_mask)
CAN_BITRATE_2M_50 CAN_OPTION_REJECT_OVERFLOW
can_error_is_form(error)
Status Reading can_error_is_ack(error)
CAN_BITRATE_4M_90
can_get_status(controller) CAN_BITRATE_2_5M_75 Modes can_id_filter_is_all(filter) can_error_is_bit1(error)
can_status_is_bus_off(status) CAN_BITRATE_2M_80 can_error_is_bit0(error)
CAN_MODE_NORMAL can_id_filter_is_extended(filter)
CAN_BITRATE_500K_875
can_status_is_error_passive(status) CAN_MODE_LISTEN_ONLY
CAN_BITRATE_250K_875 can_id_filter_get_mask(filter)
can_status_is_error_warn(status) CAN_BITRATE_125K_875
CAN_MODE_ACK_ONLY
CAN_MODE_OFFLINE can_id_filter_get_match(filter) Receive overflow
can_status_get_tec(status) CAN_BITRATE_1M_875
CAN_BITRATE_CUSTOM Stopping can_rx_overflow_get_frame_cnt
can_status_get_rec(status)
can_rx_overflow_get_error_cnt
can_status_request_recover(controller) can_stop_controller(controller)
can_get_time(controller)

Queues
CAN frames
Making
Highest priority
can_make_frame(frame, frame in queue is can_recv_tx_event()
ide,
can_send_frame(frame) sent on CAN
arbitration_id,
dlc, fifo = false Frame
data, Priority queue transmitted event
remote)
FIFO queue
can_send_frame(frame)
can_frame_set_uref(frame, ref) fifo = true
can_make_frame_from_bytes(frame, src)
Sending FIFO queue
can_send_frame(controller, frame, fifo) (Up to 32 frames) (Up to 32 events)
can_is_space(controller, n_frames, fifo)
can_get_send_space(controller) Overflow event
Receiving can_recv() (Up to 32 frames)
can_event_is_frame(event) FIFO queue
Frame
can_event_get_frame(event)
received
Reading
can_frame_is_extended(frame)
Error frame
received
can_frame_get_arbitration_id(frame) (Up to 128 events)
can_frame_is_remote(frame)
Overflow event
can_frame_get_data(frame)
can_frame_get_data_len(frame)
can_frame_get_dlc(frame) Receive events Transmit events ISR call-backs
can_frame_get_id_filter(frame)
can_frame_get_uref(frame) Getting Getting Receive
can_frame_get_data_words(frame) can_recv(controller, event) can_recv_tx_event(controller, event) can_isr_callback_frame_rx(frame,
can_recv_as_bytes(controller, dest, n_bytes) can_recv_tx_event_as_bytes(controller, timestamp)
can_recv_pending(controller) dest, n_bytes) can_isr_callback_error_rx(error,
CAN IDs can_recv_tx_events_pending(controller) timestamp)
Reading
Making can_event_get_timestamp(event) Reading Transmit
can_make_id(extended, can_event_is_frame(event) can_tx_event_get_timestamp(event) can_isr_callback_uref
arbitration_id) can_event_is_error(event) can_tx_event_is_frame(event) can_isr_callback_frame_tx(uref,
can_event_is_overflow(event) can_tx_event_get_uref(event) timestamp)
Reading
can_event_get_frame(event) can_tx_event_is_overflow(event)
can_id_is_extended(canid) can_event_get_error(event) can_tx_event_get_overflow_cnt(event)
can_id_get_arbitration_id(canid) can_event_get_overflow(event) v230306-1

You might also like