Part 1
요약·해설
Standard·extended identifier, loopback와 두 hardware build 절차를 보존합니다.
Standard · Extended
Message · Work queues
LED · Console
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
79C65144CD97A44885C92A4178BA073AB215F2A7BDEB5C4C824F7905C500FFFF
.. zephyr:code-sample:: can-counter
:name: Controller Area Network (CAN) counter
:relevant-api: can_interface
Send and receive CAN messages.
Overview
********
This sample demonstrates how to use the Controller Area Network (CAN) API.
Messages with standard and extended identifiers are sent over the bus.
Messages are received using message-queues and work-queues.
Reception is indicated by blinking the LED (if present) and output of
received counter values to the console.
Building and Running
********************
In loopback mode, the board receives its own messages. This could be used for
standalone testing.
The LED output pin is defined in the board's devicetree.
The sample can be built and executed for boards with a SoC that have an
integrated CAN controller or for boards with a SoC that has been augmented
with a stand alone CAN controller.
Integrated CAN controller
=========================
For the NXP TWR-KE18F board:
.. zephyr-app-commands::
:zephyr-app: samples/drivers/can/counter
:board: twr_ke18f
:goals: build flash
Stand alone CAN controller
==========================
For the nrf52dk/nrf52832 board combined with the DFRobot CAN bus V2.0 shield that
provides the MCP2515 CAN controller:
.. zephyr-app-commands::
:zephyr-app: samples/drivers/can/counter
:board: nrf52dk/nrf52832
:shield: dfrobot_can_bus_v2_0
:goals: build flash
Sample output
=============
.. code-block:: console
Change LED filter ID: 0
Finished init.
Counter filter id: 4
uart:~$ Counter received: 0
Counter received: 1
Counter received: 2
Counter received: 3
.. note:: The values shown above might differ.
Part 3
한국어 전문 번역
개요
이 sample은 Controller Area Network(CAN) API의 사용법을 보여줍니다. Standard identifier와 extended identifier를 사용하는 message를 bus로 전송합니다. Message 수신에는 message queue와 work queue를 사용합니다. 수신하면 LED가 있는 경우 LED가 깜박이고, 받은 counter 값을 console에 출력합니다.
Build와 실행
Loopback mode에서는 board가 자신이 보낸 message를 다시 받습니다. 이 mode는 standalone 시험에 사용할 수 있습니다.
LED output pin은 board의 devicetree에 정의됩니다.
이 sample은 SoC에 CAN controller가 통합된 board에서도, 별도의 standalone CAN controller를 추가한 SoC board에서도 build하고 실행할 수 있습니다.
통합 CAN controller
NXP TWR-KE18F board에서는 다음 명령을 사용합니다.
# From the root of the zephyr repository
west build -b twr_ke18f samples/drivers/can/counter
west flash
Standalone CAN controller
MCP2515 CAN controller를 제공하는 DFRobot CAN bus V2.0 shield를 nrf52dk/nrf52832 board와 결합한 경우 다음 명령을 사용합니다.
# From the root of the zephyr repository
west build -b nrf52dk/nrf52832 --shield dfrobot_can_bus_v2_0 samples/drivers/can/counter
west flash
Sample 출력
Change LED filter ID: 0
Finished init.
Counter filter id: 4
uart:~$ Counter received: 0
Counter received: 1
Counter received: 2
Counter received: 3
참고: 위에 표시된 값은 달라질 수 있습니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.