sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget0/translations/zh_CN/networking/can_ucan_protocolmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/zh_TW/networking/can_ucan_protocolmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/it_IT/networking/can_ucan_protocolmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/ja_JP/networking/can_ucan_protocolmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/ko_KR/networking/can_ucan_protocolmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hPortuguese (Brazilian)}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/pt_BR/networking/can_ucan_protocolmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/sp_SP/networking/can_ucan_protocolmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(hThe UCAN Protocolh]hThe UCAN Protocol}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhJ/var/lib/git/docbuild/linux/Documentation/networking/can_ucan_protocol.rsthKubh paragraph)}(hUCAN is the protocol used by the microcontroller-based USB-CAN adapter that is integrated on System-on-Modules from Theobroma Systems and that is also available as a standalone USB stick.h]hUCAN is the protocol used by the microcontroller-based USB-CAN adapter that is integrated on System-on-Modules from Theobroma Systems and that is also available as a standalone USB stick.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hThe UCAN protocol has been designed to be hardware-independent. It is modeled closely after how Linux represents CAN devices internally. All multi-byte integers are encoded as Little Endian.h]hThe UCAN protocol has been designed to be hardware-independent. It is modeled closely after how Linux represents CAN devices internally. All multi-byte integers are encoded as Little Endian.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hXAll structures mentioned in this document are defined in ``drivers/net/can/usb/ucan.c``.h](h9All structures mentioned in this document are defined in }(hhhhhNhNubhliteral)}(h``drivers/net/can/usb/ucan.c``h]hdrivers/net/can/usb/ucan.c}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhubh.}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hhh](h)}(h USB Endpointsh]h USB Endpoints}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh)}(h%UCAN devices use three USB endpoints:h]h%UCAN devices use three USB endpoints:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubhdefinition_list)}(hhh](hdefinition_list_item)}(hNCONTROL endpoint The driver sends device management commands on this endpoint h](hterm)}(hCONTROL endpointh]hCONTROL endpoint}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1j5hhhKhj1ubh definition)}(hhh]h)}(hhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj6ubeh}(h]h ]h"]h$]h&]uh1hhhhKXhj3ubah}(h]h ]h"]h$]h&]uh1jjhjubeh}(h]h ]h"]h$]h&]uh1jehjubah}(h]h ]h"]h$]h&]uh1j`hjubeh}(h]h ]h"]h$]h&]colsKuh1jEhjubah}(h]h ]h"]h$]h&]uh1j@hjhhhhhNubeh}(h]ucan-command-startah ]h"]ucan_command_startah$]h&]uh1hhjthhhhhKNubh)}(hhh](h)}(hUCAN_COMMAND_STOPh]hUCAN_COMMAND_STOP}(hj|hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjyhhhhhK\ubh)}(h*Host2Dev; mandatory*h]jB)}(hjh]hHost2Dev; mandatory}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jAhjubah}(h]h ]h"]h$]h&]uh1hhhhK^hjyhhubh)}(hStop the CAN interfaceh]hStop the CAN interface}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK`hjyhhubj+)}(hhh]j0)}(hPayload Format *empty* h](j6)}(hPayload Formath]hPayload Format}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j5hhhKchjubjF)}(hhh]h)}(h*empty*h]jB)}(hjh]hempty}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jAhjubah}(h]h ]h"]h$]h&]uh1hhhhKchjubah}(h]h ]h"]h$]h&]uh1jEhjubeh}(h]h ]h"]h$]h&]uh1j/hhhKchjubah}(h]h ]h"]h$]h&]uh1j*hjyhhhhhNubeh}(h]ucan-command-stopah ]h"]ucan_command_stopah$]h&]uh1hhjthhhhhK\ubh)}(hhh](h)}(hUCAN_COMMAND_RESETh]hUCAN_COMMAND_RESET}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKfubh)}(h*Host2Dev; mandatory*h]jB)}(hj h]hHost2Dev; mandatory}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jAhj ubah}(h]h ]h"]h$]h&]uh1hhhhKhhjhhubh)}(h3Reset the CAN controller (including error counters)h]h3Reset the CAN controller (including error counters)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKjhjhhubj+)}(hhh]j0)}(hPayload Format *empty* h](j6)}(hPayload Formath]hPayload Format}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1j5hhhKmhj1ubjF)}(hhh]h)}(h*empty*h]jB)}(hjHh]hempty}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1jAhjFubah}(h]h ]h"]h$]h&]uh1hhhhKmhjCubah}(h]h ]h"]h$]h&]uh1jEhj1ubeh}(h]h ]h"]h$]h&]uh1j/hhhKmhj.ubah}(h]h ]h"]h$]h&]uh1j*hjhhhhhNubeh}(h]ucan-command-resetah ]h"]ucan_command_resetah$]h&]uh1hhjthhhhhKfubh)}(hhh](h)}(hUCAN_COMMAND_GETh]hUCAN_COMMAND_GET}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjwhhhhhKpubh)}(h*Host2Dev; mandatory*h]jB)}(hjh]hHost2Dev; mandatory}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jAhjubah}(h]h ]h"]h$]h&]uh1hhhhKrhjwhhubh)}(hGet Information from the Deviceh]hGet Information from the Device}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKthjwhhubh)}(hhh](h)}(h Subcommandsh]h Subcommands}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKwubj+)}(hhh]j0)}(hXUCAN_COMMAND_GET_INFO Request the device information structure ``ucan_ctl_payload_t.device_info``. See the ``device_info`` field for details, and ``uapi/linux/can/netlink.h`` for an explanation of the ``can_bittiming fields``. Payload Format ``ucan_ctl_payload_t.device_info`` h](j6)}(hUCAN_COMMAND_GET_INFOh]hUCAN_COMMAND_GET_INFO}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j5hhhKhjubjF)}(hhh](h)}(hLRequest the device information structure ``ucan_ctl_payload_t.device_info``.h](h)Request the device information structure }(hjhhhNhNubh)}(h"``ucan_ctl_payload_t.device_info``h]hucan_ctl_payload_t.device_info}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKzhjubh)}(hSee the ``device_info`` field for details, and ``uapi/linux/can/netlink.h`` for an explanation of the ``can_bittiming fields``.h](hSee the }(hjhhhNhNubh)}(h``device_info``h]h device_info}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh field for details, and }(hjhhhNhNubh)}(h``uapi/linux/can/netlink.h``h]huapi/linux/can/netlink.h}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh for an explanation of the }(hjhhhNhNubh)}(h``can_bittiming fields``h]hcan_bittiming fields}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK|hjubj+)}(hhh]j0)}(h2Payload Format ``ucan_ctl_payload_t.device_info`` h](j6)}(hPayload Formath]hPayload Format}(hjAhhhNhNubah}(h]h ]h"]h$]h&]uh1j5hhhKhj=ubjF)}(hhh]h)}(h"``ucan_ctl_payload_t.device_info``h]h)}(hjTh]hucan_ctl_payload_t.device_info}(hjVhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjRubah}(h]h ]h"]h$]h&]uh1hhhhKhjOubah}(h]h ]h"]h$]h&]uh1jEhj=ubeh}(h]h ]h"]h$]h&]uh1j/hhhKhj:ubah}(h]h ]h"]h$]h&]uh1j*hjubeh}(h]h ]h"]h$]h&]uh1jEhjubeh}(h]h ]h"]h$]h&]uh1j/hhhKhjubah}(h]h ]h"]h$]h&]uh1j*hjhhhNhNubh)}(h!UCAN_COMMAND_GET_PROTOCOL_VERSIONh]h!UCAN_COMMAND_GET_PROTOCOL_VERSION}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh block_quote)}(hRequest the device protocol version ``ucan_ctl_payload_t.protocol_version``. The current protocol version is 3. Payload Format ``ucan_ctl_payload_t.protocol_version`` h](h)}(hoRequest the device protocol version ``ucan_ctl_payload_t.protocol_version``. The current protocol version is 3.h](h$Request the device protocol version }(hjhhhNhNubh)}(h'``ucan_ctl_payload_t.protocol_version``h]h#ucan_ctl_payload_t.protocol_version}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh$. The current protocol version is 3.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubj+)}(hhh]j0)}(h7Payload Format ``ucan_ctl_payload_t.protocol_version`` h](j6)}(hPayload Formath]hPayload Format}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j5hhhKhjubjF)}(hhh]h)}(h'``ucan_ctl_payload_t.protocol_version``h]h)}(hjh]h#ucan_ctl_payload_t.protocol_version}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jEhjubeh}(h]h ]h"]h$]h&]uh1j/hhhKhjubah}(h]h ]h"]h$]h&]uh1j*hjubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubhnote)}(hIDevices that do not implement this command use the old protocol version 1h]h)}(hIDevices that do not implement this command use the old protocol version 1h]hIDevices that do not implement this command use the old protocol version 1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h] subcommandsah ]h"] subcommandsah$]h&]uh1hhjwhhhhhKwubeh}(h]ucan-command-getah ]h"]ucan_command_getah$]h&]uh1hhjthhhhhKpubh)}(hhh](h)}(hUCAN_COMMAND_SET_BITTIMINGh]hUCAN_COMMAND_SET_BITTIMING}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj2hhhhhKubh)}(h*Host2Dev; mandatory*h]jB)}(hjEh]hHost2Dev; mandatory}(hjGhhhNhNubah}(h]h ]h"]h$]h&]uh1jAhjCubah}(h]h ]h"]h$]h&]uh1hhhhKhj2hhubh)}(hxSetup bittiming by sending the structure ``ucan_ctl_payload_t.cmd_set_bittiming`` (see ``struct bittiming`` for details)h](h)Setup bittiming by sending the structure }(hjZhhhNhNubh)}(h(``ucan_ctl_payload_t.cmd_set_bittiming``h]h$ucan_ctl_payload_t.cmd_set_bittiming}(hjbhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjZubh (see }(hjZhhhNhNubh)}(h``struct bittiming``h]hstruct bittiming}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1hhjZubh for details)}(hjZhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj2hhubj+)}(hhh]j0)}(h9Payload Format ``ucan_ctl_payload_t.cmd_set_bittiming``. h](j6)}(hPayload Formath]hPayload Format}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j5hhhKhjubjF)}(hhh]h)}(h)``ucan_ctl_payload_t.cmd_set_bittiming``.h](h)}(h(``ucan_ctl_payload_t.cmd_set_bittiming``h]h$ucan_ctl_payload_t.cmd_set_bittiming}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jEhjubeh}(h]h ]h"]h$]h&]uh1j/hhhKhjubah}(h]h ]h"]h$]h&]uh1j*hj2hhhhhNubeh}(h]ucan-command-set-bittimingah ]h"]ucan_command_set_bittimingah$]h&]uh1hhjthhhhhKubh)}(hhh](h)}(hUCAN_SLEEP/WAKEh]hUCAN_SLEEP/WAKE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(h*Host2Dev; optional*h]jB)}(hjh]hHost2Dev; optional}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jAhjubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(h@Configure sleep and wake modes. Not yet supported by the driver.h]h@Configure sleep and wake modes. Not yet supported by the driver.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]ucan-sleep-wakeah ]h"]ucan_sleep/wakeah$]h&]uh1hhjthhhhhKubh)}(hhh](h)}(h UCAN_FILTERh]h UCAN_FILTER}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh)}(h*Host2Dev; optional*h]jB)}(hj+ h]hHost2Dev; optional}(hj- hhhNhNubah}(h]h ]h"]h$]h&]uh1jAhj) ubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(h hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh% value against the actual data size).}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubhtarget)}(h.. _can_ucan_in_message_len:h]h}(h]h ]h"]h$]h&]refidcan-ucan-in-message-lenuh1jV hKhj hhhhubh)}(hhh](h)}(h ``len`` fieldh](h)}(h``len``h]hlen}(hjk hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjg ubh field}(hjg hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhjd hhhhhKubh)}(hEach ``ucan_message_in`` must be aligned to a 4-byte boundary (relative to the start of the start of the data buffer). That means that there may be padding bytes between multiple ``ucan_message_in`` values:h](hEach }(hj hhhNhNubh)}(h``ucan_message_in``h]hucan_message_in}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh must be aligned to a 4-byte boundary (relative to the start of the start of the data buffer). That means that there may be padding bytes between multiple }(hj hhhNhNubh)}(h``ucan_message_in``h]hucan_message_in}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh values:}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjd hhubh literal_block)}(hXx+----------------------------+ < 0 | | | struct ucan_message_in | | | +----------------------------+ < len [padding] +----------------------------+ < round_up(len, 4) | | | struct ucan_message_in | | | +----------------------------+ [...]h]hXx+----------------------------+ < 0 | | | struct ucan_message_in | | | +----------------------------+ < len [padding] +----------------------------+ < round_up(len, 4) | | | struct ucan_message_in | | | +----------------------------+ [...]}hj sbah}(h]h ]h"]h$]h&]forcehighlight_args} xml:spacepreservelanguagenoneuh1j hhhKhjd hhubeh}(h]( len-fieldjc eh ]h"]( len fieldcan_ucan_in_message_leneh$]h&]uh1hhj hhhhhKŒexpect_referenced_by_name}j jX sexpect_referenced_by_id}jc jX subh)}(hhh](h)}(h``type`` fieldh](h)}(h``type``h]htype}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh field}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh)}(h5The ``type`` field specifies the type of the message.h](hThe }(hj hhhNhNubh)}(h``type``h]htype}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh) field specifies the type of the message.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hhh](h)}(h UCAN_IN_RXh]h UCAN_IN_RX}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubj+)}(hhh]j0)}(h``subtype`` zero h](j6)}(h ``subtype``h]h)}(hj2 h]hsubtype}(hj4 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj0 ubah}(h]h ]h"]h$]h&]uh1j5hhhKhj, ubjF)}(hhh]h)}(hzeroh]hzero}(hjJ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjG ubah}(h]h ]h"]h$]h&]uh1jEhj, ubeh}(h]h ]h"]h$]h&]uh1j/hhhKhj) ubah}(h]h ]h"]h$]h&]uh1j*hj hhhhhNubh)}(h.Data received from the CAN bus (ID + payload).h]h.Data received from the CAN bus (ID + payload).}(hjj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubeh}(h] ucan-in-rxah ]h"] ucan_in_rxah$]h&]uh1hhj hhhhhKubh)}(hhh](h)}(hUCAN_IN_TX_COMPLETEh]hUCAN_IN_TX_COMPLETE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubj+)}(hhh]j0)}(h``subtype`` zero h](j6)}(h ``subtype``h]h)}(hj h]hsubtype}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubah}(h]h ]h"]h$]h&]uh1j5hhhKhj ubjF)}(hhh]h)}(hzeroh]hzero}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jEhj ubeh}(h]h ]h"]h$]h&]uh1j/hhhKhj ubah}(h]h ]h"]h$]h&]uh1j*hj hhhhhNubh)}(heThe CAN device has sent a message to the CAN bus. It answers with a list of tuples .h]heThe CAN device has sent a message to the CAN bus. It answers with a list of tuples .}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hThe echo-id identifies the frame from (echos the id from a previous UCAN_OUT_TX message). The flag indicates the result of the transmission. Whereas a set Bit 0 indicates success. All other bits are reserved and set to zero.h]hThe echo-id identifies the frame from (echos the id from a previous UCAN_OUT_TX message). The flag indicates the result of the transmission. Whereas a set Bit 0 indicates success. All other bits are reserved and set to zero.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubeh}(h]ucan-in-tx-completeah ]h"]ucan_in_tx_completeah$]h&]uh1hhj hhhhhKubeh}(h] type-fieldah ]h"]h$] type fieldah&]uh1hhj hhhhhK، referencedKubh)}(hhh](h)}(h Flow Controlh]h Flow Control}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh)}(hXWhen receiving CAN messages there is no flow control on the USB buffer. The driver has to handle inbound message quickly enough to avoid drops. I case the device buffer overflow the condition is reported by sending corresponding error frames (see :ref:`can_ucan_error_handling`)h](hWhen receiving CAN messages there is no flow control on the USB buffer. The driver has to handle inbound message quickly enough to avoid drops. I case the device buffer overflow the condition is reported by sending corresponding error frames (see }(hjhhhNhNubh)}(h:ref:`can_ucan_error_handling`h]hinline)}(hjh]hcan_ucan_error_handling}(hjhhhNhNubah}(h]h ](xrefstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocnetworking/can_ucan_protocol refdomainj)reftyperef refexplicitrefwarn reftargetcan_ucan_error_handlinguh1hhhhKhjubh)}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubeh}(h] flow-controlah ]h"]h$] flow controlah&]uh1hhj hhhhhKj Kubeh}(h]in-message-formatah ]h"]in message formatah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hOUT Message Formath]hOUT Message Format}(hjZhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjWhhhhhKubh)}(hXA data packet on the USB OUT endpoint contains one or more ``struct ucan_message_out`` values. If multiple messages are batched into one data packet, the device uses the ``len`` field to jump to the next ucan_message_out value. Each ucan_message_out must be aligned to 4 bytes (relative to the start of the data buffer). The mechanism is same as described in :ref:`can_ucan_in_message_len`.h](h;A data packet on the USB OUT endpoint contains one or more }(hjhhhhNhNubh)}(h``struct ucan_message_out``h]hstruct ucan_message_out}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhubhT values. If multiple messages are batched into one data packet, the device uses the }(hjhhhhNhNubh)}(h``len``h]hlen}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhubh field to jump to the next ucan_message_out value. Each ucan_message_out must be aligned to 4 bytes (relative to the start of the data buffer). The mechanism is same as described in }(hjhhhhNhNubh)}(h:ref:`can_ucan_in_message_len`h]j)}(hjh]hcan_ucan_in_message_len}(hjhhhNhNubah}(h]h ](j(stdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj5 refdomainjreftyperef refexplicitrefwarnj;can_ucan_in_message_lenuh1hhhhKhjhubh.}(hjhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjWhhubj )}(hXx+----------------------------+ < 0 | | | struct ucan_message_out | | | +----------------------------+ < len [padding] +----------------------------+ < round_up(len, 4) | | | struct ucan_message_out | | | +----------------------------+ [...]h]hXx+----------------------------+ < 0 | | | struct ucan_message_out | | | +----------------------------+ < len [padding] +----------------------------+ < round_up(len, 4) | | | struct ucan_message_out | | | +----------------------------+ [...]}hjsbah}(h]h ]h"]h$]h&]forcehighlight_args}j j j j uh1j hhhMhjWhhubh)}(hhh](h)}(h``type`` fieldh](h)}(h``type``h]htype}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh field}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hsIn protocol version 3 only ``UCAN_OUT_TX`` is defined, others are used only by legacy devices (protocol version 1).h](hIn protocol version 3 only }(hjhhhNhNubh)}(h``UCAN_OUT_TX``h]h UCAN_OUT_TX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhI is defined, others are used only by legacy devices (protocol version 1).}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hhh](h)}(h UCAN_OUT_TXh]h UCAN_OUT_TX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubj+)}(hhh]j0)}(hF``subtype`` echo id to be replied within a CAN_IN_TX_COMPLETE message h](j6)}(h ``subtype``h]h)}(hj(h]hsubtype}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj&ubah}(h]h ]h"]h$]h&]uh1j5hhhMhj"ubjF)}(hhh]h)}(h9echo id to be replied within a CAN_IN_TX_COMPLETE messageh]h9echo id to be replied within a CAN_IN_TX_COMPLETE message}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj=ubah}(h]h ]h"]h$]h&]uh1jEhj"ubeh}(h]h ]h"]h$]h&]uh1j/hhhMhjubah}(h]h ]h"]h$]h&]uh1j*hjhhhhhNubh)}(h4Transmit a CAN frame. (parameters: ``id``, ``data``)h](h#Transmit a CAN frame. (parameters: }(hj`hhhNhNubh)}(h``id``h]hid}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj`ubh, }(hj`hhhNhNubh)}(h``data``h]hdata}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj`ubh)}(hj`hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hjhhubeh}(h] ucan-out-txah ]h"] ucan_out_txah$]h&]uh1hhjhhhhhMubeh}(h]id1ah ]h"]h$]j ah&]uh1hhjWhhhhhMj Kubh)}(hhh](h)}(h Flow Controlh]h Flow Control}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM#ubh)}(hWhen the device outbound buffers are full it starts sending *NAKs* on the *OUT* pipe until more buffers are available. The driver stops the queue when a certain threshold of out packets are incomplete.h](hhjubah}(h]h ]h"]h$]h&]uh1jhj`hhhhhNubj)}(h0During Bus OFF no frames are sent by the device.h]h)}(hjh]h0During Bus OFF no frames are sent by the device.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM@hjubah}(h]h ]h"]h$]h&]uh1jhj`hhhhhNubj)}(hnDuring Bus OFF transmission requests from the host are completed immediately with the success bit left unset. h]h)}(hmDuring Bus OFF transmission requests from the host are completed immediately with the success bit left unset.h]hmDuring Bus OFF transmission requests from the host are completed immediately with the success bit left unset.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMAhjubah}(h]h ]h"]h$]h&]uh1jhj`hhhhhNubeh}(h]h ]h"]h$]h&]j-uh1jhhhM;hjOhhubeh}(h]bus-offah ]h"]bus offah$]h&]uh1hhjhhhhhM9ubeh}(h](can-error-handlingjeh ]h"](can error handlingcan_ucan_error_handlingeh$]h&]uh1hhhhhhhhM,j }j$jsj }jjsubh)}(hhh](h)}(hExample Conversationh]hExample Conversation}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj)hhhhhMEubhenumerated_list)}(hhh](j)}(hDevice is connected to USBh]h)}(hjAh]hDevice is connected to USB}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMGhj?ubah}(h]h ]h"]h$]h&]uh1jhj<hhhhhNubj)}(h3Host sends command ``UCAN_COMMAND_RESET``, subcmd 0h]h)}(hjXh](hHost sends command }(hjZhhhNhNubh)}(h``UCAN_COMMAND_RESET``h]hUCAN_COMMAND_RESET}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhjZubh , subcmd 0}(hjZhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMHhjVubah}(h]h ]h"]h$]h&]uh1jhj<hhhhhNubj)}(hIHost sends command ``UCAN_COMMAND_GET``, subcmd ``UCAN_COMMAND_GET_INFO``h]h)}(hjh](hHost sends command }(hjhhhNhNubh)}(h``UCAN_COMMAND_GET``h]hUCAN_COMMAND_GET}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh , subcmd }(hjhhhNhNubh)}(h``UCAN_COMMAND_GET_INFO``h]hUCAN_COMMAND_GET_INFO}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhMIhjubah}(h]h ]h"]h$]h&]uh1jhj<hhhhhNubj)}(h$Device sends ``UCAN_IN_DEVICE_INFO``h]h)}(hjh](h Device sends }(hjhhhNhNubh)}(h``UCAN_IN_DEVICE_INFO``h]hUCAN_IN_DEVICE_INFO}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhMJhjubah}(h]h ]h"]h$]h&]uh1jhj<hhhhhNubj)}(h-Host sends command ``UCAN_OUT_SET_BITTIMING``h]h)}(hjh](hHost sends command }(hjhhhNhNubh)}(h``UCAN_OUT_SET_BITTIMING``h]hUCAN_OUT_SET_BITTIMING}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhMKhjubah}(h]h ]h"]h$]h&]uh1jhj<hhhhhNubj)}(hSHost sends command ``UCAN_COMMAND_START``, subcmd 0, mode ``UCAN_MODE_BERR_REPORT``h]h)}(hjh](hHost sends command }(hjhhhNhNubh)}(h``UCAN_COMMAND_START``h]hUCAN_COMMAND_START}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh, subcmd 0, mode }(hjhhhNhNubh)}(h``UCAN_MODE_BERR_REPORT``h]hUCAN_MODE_BERR_REPORT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhMLhjubah}(h]h ]h"]h$]h&]uh1jhj<hhhhhNubeh}(h]h ]h"]h$]h&]enumtypearabicprefixhsuffix)uh1j:hj)hhhhhMGubeh}(h]example-conversationah ]h"]example conversationah$]h&]uh1hhhhhhhhMEubeh}(h]the-ucan-protocolah ]h"]the ucan protocolah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksjjfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjterror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourcehʌ _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}(jc ]jX aj]jaunameids}(jOjLjjj j jjjjjqjnjijfj[ jX jvjsjjjtjqj/j,j'j$jjj j jS jP j j jTjQj jc j j type fieldNj} jz j j flow controlNjjjjj$jj#j jjjGjDu nametypes}(jOjj jjjqjij[ jvjjtj/j'jj jS j jTj j jj} j jjjj$j#jjGuh}(jLhjj j jjj/jjjnjjfj,jX jtjsjjjyjqjj,jwj$jjj2j jjP j j j^ jQj jc jd j jd j j jz j j j jIj jjWjjjjjjjjj jjjOjDj)u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}jKsRparse_messages](hsystem_message)}(hhh]h)}(h-Duplicate implicit target name: "type field".h]h1Duplicate implicit target name: “type field”.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]jalevelKtypeINFOsourcehʌlineMuh1jhjhhhhhMubj)}(hhh]h)}(h/Duplicate implicit target name: "flow control".h]h3Duplicate implicit target name: “flow control”.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]jalevelKtypejsourcehʌlineM#uh1jhjhhhhhM#ubetransform_messages](j)}(hhh]h)}(hhh]h=Hyperlink target "can-ucan-in-message-len" is not referenced.}hjsbah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypejsourcehʌlineKuh1jubj)}(hhh]h)}(hhh]h=Hyperlink target "can-ucan-error-handling" is not referenced.}hj2sbah}(h]h ]h"]h$]h&]uh1hhj/ubah}(h]h ]h"]h$]h&]levelKtypejsourcehʌlineM)uh1jube transformerN include_log] decorationNhhub.