Part 1
요약·해설
Board별 CAN transceiver 배선, 21개 명령·code·출력, non-volatile object dictionary와 download 절차를 보존합니다.
EN 50325-4 · CiA 301
10
NMT · SDO · PDO
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
855DDD5D0E419ABE5B456CB4B3B3B31816D4AEB009E1B870C3191CFE5A78F3AC
.. _canopennode-sample:
CANopenNode
###########
Overview
********
This sample application shows how the `CANopenNode`_ CANopen protocol
stack can be used in Zephyr.
CANopen is an internationally standardized (`EN 50325-4`_, `CiA 301`_)
communication protocol and device specification for embedded
systems used in automation. CANopenNode is a 3rd party, open-source
CANopen protocol stack.
Apart from the CANopen protocol stack integration, this sample also
demonstrates the use of non-volatile storage for the CANopen object
dictionary and optionally program download over CANopen.
Requirements
************
* A board with CAN bus and flash support
* Host PC with CAN bus support
Building and Running
********************
First, ensure the optional CANopenNode module is enabled and available:
.. code-block:: console
west config manifest.project-filter +canopennode
west update canopennode
Building and Running for TWR-KE18F
==================================
The :ref:`twr_ke18f` board is equipped with an onboard CAN
transceiver. This board supports CANopen LED indicators (red and green
LEDs). The sample can be built and executed for the TWR-KE18F as
follows:
.. zephyr-app-commands::
:zephyr-app: samples/modules/canopennode
:board: twr_ke18f
:goals: build flash
:compact:
Pressing the button labelled ``SW3`` will increment the button press
counter object at index ``0x2102`` in the object dictionary.
Building and Running for FRDM-K64F
==================================
The :ref:`frdm_k64f` board does not come with an onboard CAN
transceiver. In order to use the CAN bus on the FRDM-K64F board, an
external CAN bus transceiver must be connected to ``PTB18``
(``CAN0_TX``) and ``PTB19`` (``CAN0_RX``). This board supports CANopen
LED indicators (red and green LEDs)
The sample can be built and executed for the FRDM-K64F as follows:
.. zephyr-app-commands::
:zephyr-app: samples/modules/canopennode
:board: frdm_k64f
:goals: build flash
:compact:
Pressing the button labelled ``SW3`` will increment the button press
counter object at index ``0x2102`` in the object dictionary.
Building and Running for STM32F072RB Discovery
==============================================
The :ref:`stm32f072b_disco_board` board does not come with an onboard CAN
transceiver. In order to use the CAN bus on the STM32F072RB Discovery board, an
external CAN bus transceiver must be connected to ``PB8`` (``CAN_RX``) and
``PB9`` (``CAN_TX``). This board supports CANopen LED indicators (red and green
LEDs)
The sample can be built and executed for the STM32F072RB Discovery as follows:
.. zephyr-app-commands::
:zephyr-app: samples/modules/canopennode
:board: stm32f072b_disco
:goals: build flash
:compact:
Pressing the button labelled ``USER`` will increment the button press counter
object at index ``0x2102`` in the object dictionary.
Building and Running for STM32F3 Discovery
==========================================
The :ref:`stm32f3_disco_board` board does not come with an onboard CAN
transceiver. In order to use the CAN bus on the STM32F3 Discovery board, an
external CAN bus transceiver must be connected to ``PD1`` (``CAN_TX``) and
``PD0`` (``CAN_RX``). This board supports CANopen LED indicators (red and green
LEDs)
The sample can be built and executed for the STM32F3 Discovery as follows:
.. zephyr-app-commands::
:zephyr-app: samples/modules/canopennode
:board: stm32f3_disco
:goals: build flash
:compact:
Pressing the button labelled ``USER`` will increment the button press counter
object at index ``0x2102`` in the object dictionary.
Building and Running for other STM32 boards
===========================================
The sample cannot run if the <erase-block-size> of the flash-controller exceeds 0x10000.
Typically nucleo_h743zi with erase-block-size = <DT_SIZE_K(128)>;
Building and Running for boards without storage partition
=========================================================
The sample can be built for boards without a flash storage partition by using a different configuration file:
.. zephyr-app-commands::
:zephyr-app: samples/modules/canopennode
:board: <your_board_name>
:conf: "prj_no_storage.conf"
:goals: build flash
:compact:
Testing CANopen Communication
*****************************
CANopen communication between the host PC and Zephyr can be
established using any CANopen compliant application on the host PC.
The examples here uses `CANopen for Python`_ for communicating between
the host PC and Zephyr. First, install python-canopen along with the
python-can backend as follows:
.. code-block:: console
pip3 install --user canopen python-can
Next, configure python-can to use your CAN adapter through its
configuration file. On GNU/Linux, the configuration looks similar to
this:
.. code-block:: console
cat << EOF > ~/.canrc
[default]
interface = socketcan
channel = can0
bitrate = 125000
EOF
Please refer to the `python-can`_ documentation for further details
and instructions.
Finally, bring up the CAN interface on the test PC. On GNU/Linux, this
can be done as follows:
.. code-block:: console
sudo ip link set can0 type can bitrate 125000 restart-ms 100
sudo ip link set up can0
To better understand the communication taking place in the following
examples, you can monitor the CAN traffic from the host PC. On
GNU/Linux, this can be accomplished using ``candump`` from the
`can-utils`_ package as follows:
.. code-block:: console
candump can0
NMT State Changes
=================
Changing the Network Management (NMT) state of the node can be
accomplished using the following Python code:
.. code-block:: py
import canopen
import os
import time
ZEPHYR_BASE = os.environ['ZEPHYR_BASE']
EDS = os.path.join(ZEPHYR_BASE, 'samples', 'modules', 'canopennode',
'objdict', 'objdict.eds')
NODEID = 10
network = canopen.Network()
network.connect()
node = network.add_node(NODEID, EDS)
# Green indicator LED will flash slowly
node.nmt.state = 'STOPPED'
time.sleep(5)
# Green indicator LED will flash faster
node.nmt.state = 'PRE-OPERATIONAL'
time.sleep(5)
# Green indicator LED will be steady on
node.nmt.state = 'OPERATIONAL'
time.sleep(5)
# Node will reset communication
node.nmt.state = 'RESET COMMUNICATION'
node.nmt.wait_for_heartbeat()
# Node will reset
node.nmt.state = 'RESET'
node.nmt.wait_for_heartbeat()
network.disconnect()
Running the above Python code will update the NMT state of the node
which is reflected on the indicator LEDs (if present).
SDO Upload
==========
Reading a Service Data Object (SDO) at a given index of the CANopen
object dictionary (here index ``0x1008``, the manufacturer device
name) can be accomplished using the following Python code:
.. code-block:: py
import canopen
import os
ZEPHYR_BASE = os.environ['ZEPHYR_BASE']
EDS = os.path.join(ZEPHYR_BASE, 'samples', 'modules', 'canopennode',
'objdict', 'objdict.eds')
NODEID = 10
network = canopen.Network()
network.connect()
node = network.add_node(NODEID, EDS)
name = node.sdo['Manufacturer device name']
print("Device name: '{}'".format(name.raw))
network.disconnect()
Running the above Python code should produce the following output:
.. code-block:: console
Device name: 'Zephyr RTOS/CANopenNode'
SDO Download
============
Writing to a Service Data Object (SDO) at a given index of the CANopen
object dictionary (here index ``0x1017``, the producer heartbeat time)
can be accomplished using the following Python code:
.. code-block:: py
import canopen
import os
ZEPHYR_BASE = os.environ['ZEPHYR_BASE']
EDS = os.path.join(ZEPHYR_BASE, 'samples', 'modules', 'canopennode',
'objdict', 'objdict.eds')
NODEID = 10
network = canopen.Network()
network.connect()
node = network.add_node(NODEID, EDS)
heartbeat = node.sdo['Producer heartbeat time']
reboots = node.sdo['Power-on counter']
# Set heartbeat interval without saving to non-volatile storage
print("Initial heartbeat time: {} ms".format(heartbeat.raw))
print("Power-on counter: {}".format(reboots.raw))
heartbeat.raw = 5000
print("Updated heartbeat time: {} ms".format(heartbeat.raw))
# Reset and read heartbeat interval again
node.nmt.state = 'RESET'
node.nmt.wait_for_heartbeat()
print("heartbeat time after reset: {} ms".format(heartbeat.raw))
print("Power-on counter: {}".format(reboots.raw))
# Set interval and store it to non-volatile storage
heartbeat.raw = 2000
print("Updated heartbeat time: {} ms".format(heartbeat.raw))
node.store()
# Reset and read heartbeat interval again
node.nmt.state = 'RESET'
node.nmt.wait_for_heartbeat()
print("heartbeat time after store and reset: {} ms".format(heartbeat.raw))
print("Power-on counter: {}".format(reboots.raw))
# Restore default values, reset and read again
node.restore()
node.nmt.state = 'RESET'
node.nmt.wait_for_heartbeat()
print("heartbeat time after restore and reset: {} ms".format(heartbeat.raw))
print("Power-on counter: {}".format(reboots.raw))
network.disconnect()
Running the above Python code should produce the following output:
.. code-block:: console
Initial heartbeat time: 1000 ms
Power-on counter: 1
Updated heartbeat time: 5000 ms
heartbeat time after reset: 1000 ms
Power-on counter: 2
Updated heartbeat time: 2000 ms
heartbeat time after store and reset: 2000 ms
Power-on counter: 3
heartbeat time after restore and reset: 1000 ms
Power-on counter: 4
Note that the power-on counter value may be different.
PDO Mapping
===========
Transmit Process Data Object (PDO) mapping for data at a given index
of the CANopen object dictionary (here index ``0x2102``, the button
press counter) can be accomplished using the following Python code:
.. code-block:: py
import canopen
import os
ZEPHYR_BASE = os.environ['ZEPHYR_BASE']
EDS = os.path.join(ZEPHYR_BASE, 'samples', 'modules', 'canopennode',
'objdict', 'objdict.eds')
NODEID = 10
network = canopen.Network()
network.connect()
node = network.add_node(NODEID, EDS)
button = node.sdo['Button press counter']
# Read current TPDO mapping
node.tpdo.read()
# Enter pre-operational state to map TPDO
node.nmt.state = 'PRE-OPERATIONAL'
# Map TPDO 1 to transmit the button press counter on changes
node.tpdo[1].clear()
node.tpdo[1].add_variable('Button press counter')
node.tpdo[1].trans_type = 254
node.tpdo[1].enabled = True
# Save TPDO mapping
node.tpdo.save()
node.nmt.state = 'OPERATIONAL'
# Reset button press counter
button.raw = 0
print("Press the button 10 times")
while True:
node.tpdo[1].wait_for_reception()
print("Button press counter: {}".format(node.tpdo['Button press counter'].phys))
if node.tpdo['Button press counter'].phys >= 10:
break
network.disconnect()
Running the above Python code should produce the following output:
.. code-block:: console
Press the button 10 times
Button press counter: 0
Button press counter: 1
Button press counter: 2
Button press counter: 3
Button press counter: 4
Button press counter: 5
Button press counter: 6
Button press counter: 7
Button press counter: 8
Button press counter: 9
Button press counter: 10
Testing CANopen Program Download
********************************
Building and Running for FRDM-K64F
==================================
The sample can be rebuilt with MCUboot and program download support
for the FRDM-K64F as follows:
#. Build the CANopenNode sample with MCUboot support:
.. zephyr-app-commands::
:tool: west
:app: samples/modules/canopennode
:board: frdm_k64f
:goals: build
:west-args: --sysbuild
:gen-args: -Dcanopennode_CONF_FILE=prj_img_mgmt.conf -DSB_CONFIG_BOOTLOADER_MCUBOOT=y
:compact:
#. Flash the newly built MCUboot and CANopen sample binaries using west:
.. code-block:: console
west flash --skip-rebuild
#. Confirm the newly flashed firmware image using west:
.. code-block:: console
west flash --skip-rebuild --domain canopennode --runner canopen --confirm-only
#. Finally, perform a program download via CANopen:
.. code-block:: console
west flash --skip-rebuild --domain canopennode --runner canopen
Modifying the Object Dictionary
*******************************
The CANopen object dictionary used in this sample application can be
found under :zephyr_file:`samples/modules/canopennode/objdict` in
the Zephyr tree. The object dictionary can be modified using any
object dictionary editor supporting CANopenNode object dictionary code
generation.
A popular choice is the EDS editor from the `libedssharp`_
project. With that, the
:zephyr_file:`samples/modules/canopennode/objdict/objdict.xml`
project file can be opened and modified, and new implementation files
(:zephyr_file:`samples/modules/canopennode/objdict/CO_OD.h` and
:zephyr_file:`samples/modules/canopennode/objdict/CO_OD.c`) can be
generated. The EDS editor can also export an updated Electronic Data
Sheet (EDS) file
(:zephyr_file:`samples/modules/canopennode/objdict/objdict.eds`).
.. _CANopenNode:
https://github.com/CANopenNode/CANopenNode
.. _EN 50325-4:
https://can-cia.org/cia-groups/international-standardization/
.. _CiA 301:
https://can-cia.org/cia-groups/technical-documents/
.. _CANopen for Python:
https://github.com/christiansandberg/canopen
.. _python-can:
https://python-can.readthedocs.io/
.. _can-utils:
https://github.com/linux-can/can-utils
.. _libedssharp:
https://github.com/robincornelius/libedssharp
Part 3
한국어 전문 번역
개요
이 sample application은 CANopenNode CANopen protocol stack을 Zephyr에서 사용하는 방법을 보여줍니다.
CANopen은 automation용 embedded system에 쓰이는 국제 표준 communication protocol이자 device specification입니다. 관련 표준은 EN 50325-4와 CiA 301이며, CANopenNode는 third-party open-source CANopen protocol stack입니다.
CANopen protocol stack 통합 외에도 이 sample은 CANopen object dictionary용 non-volatile storage 사용법과 선택적인 CANopen program download를 보여줍니다.
요구 사항
- CAN bus와 flash를 지원하는 board
- CAN bus를 지원하는 host PC
Build와 실행
먼저 선택 사항인 CANopenNode module을 활성화하고 사용할 수 있게 준비합니다.
west config manifest.project-filter +canopennode
west update canopennode
TWR-KE18F용 Build와 실행
TWR-KE18F board에는 CAN transceiver가 내장되어 있으며 CANopen LED indicator인 red LED와 green LED를 지원합니다. 다음과 같이 build하고 실행합니다.
west build -b twr_ke18f samples/modules/canopennode
west flash
SW3 button을 누르면 object dictionary의 index 0x2102에 있는 button press counter object가 증가합니다.
FRDM-K64F용 Build와 실행
FRDM-K64F board에는 CAN transceiver가 내장되어 있지 않습니다. CAN bus를 사용하려면 external CAN bus transceiver를 PTB18(CAN0_TX)과 PTB19(CAN0_RX)에 연결해야 합니다. 이 board도 red와 green CANopen LED indicator를 지원합니다.
west build -b frdm_k64f samples/modules/canopennode
west flash
SW3 button을 누르면 object dictionary의 index 0x2102에 있는 button press counter가 증가합니다.
STM32F072RB Discovery용 Build와 실행
STM32F072RB Discovery board에는 CAN transceiver가 내장되어 있지 않습니다. External transceiver를 PB8(CAN_RX)과 PB9(CAN_TX)에 연결해야 합니다. 이 board는 red와 green CANopen LED indicator를 지원합니다.
west build -b stm32f072b_disco samples/modules/canopennode
west flash
USER button을 누르면 object dictionary의 index 0x2102에 있는 button press counter가 증가합니다.
STM32F3 Discovery용 Build와 실행
STM32F3 Discovery board에도 CAN transceiver가 내장되어 있지 않습니다. External transceiver를 PD1(CAN_TX)과 PD0(CAN_RX)에 연결해야 합니다. 이 board는 red와 green CANopen LED indicator를 지원합니다.
west build -b stm32f3_disco samples/modules/canopennode
west flash
USER button을 누르면 object dictionary의 index 0x2102에 있는 button press counter가 증가합니다.
다른 STM32 board용 Build와 실행
Flash controller의 erase-block-size가 0x10000을 초과하면 이 sample을 실행할 수 없습니다. 예를 들어 nucleo_h743zi는 보통 erase-block-size = <DT_SIZE_K(128)>입니다.
Storage partition이 없는 board용 Build와 실행
Flash storage partition이 없는 board에서는 다른 configuration file을 사용해 sample을 build할 수 있습니다.
west build -b <your_board_name> samples/modules/canopennode -- -DCONF_FILE="prj_no_storage.conf"
west flash
CANopen communication 시험
Host PC와 Zephyr 사이의 CANopen communication은 host PC의 모든 CANopen-compliant application으로 구성할 수 있습니다. 아래 예제는 CANopen for Python을 사용합니다. 먼저 python-canopen과 python-can backend를 설치합니다.
pip3 install --user canopen python-can
그다음 configuration file에서 사용 중인 CAN adapter를 쓰도록 python-can을 설정합니다. GNU/Linux에서는 다음과 비슷합니다.
cat << EOF > ~/.canrc
[default]
interface = socketcan
channel = can0
bitrate = 125000
EOF
python-can 문서에서 자세한 설명과 지침을 확인할 수 있습니다.
마지막으로 test PC의 CAN interface를 올립니다. GNU/Linux에서는 다음 명령을 사용합니다.
sudo ip link set can0 type can bitrate 125000 restart-ms 100
sudo ip link set up can0
이후 예제의 communication을 더 잘 이해하려면 host PC에서 CAN traffic을 감시할 수 있습니다. GNU/Linux에서는 can-utils package의 candump를 사용합니다.
candump can0
NMT 상태 변경
다음 Python code로 node의 Network Management(NMT) 상태를 변경할 수 있습니다.
import canopen
import os
import time
ZEPHYR_BASE = os.environ['ZEPHYR_BASE']
EDS = os.path.join(ZEPHYR_BASE, 'samples', 'modules', 'canopennode',
'objdict', 'objdict.eds')
NODEID = 10
network = canopen.Network()
network.connect()
node = network.add_node(NODEID, EDS)
# Green indicator LED will flash slowly
node.nmt.state = 'STOPPED'
time.sleep(5)
# Green indicator LED will flash faster
node.nmt.state = 'PRE-OPERATIONAL'
time.sleep(5)
# Green indicator LED will be steady on
node.nmt.state = 'OPERATIONAL'
time.sleep(5)
# Node will reset communication
node.nmt.state = 'RESET COMMUNICATION'
node.nmt.wait_for_heartbeat()
# Node will reset
node.nmt.state = 'RESET'
node.nmt.wait_for_heartbeat()
network.disconnect()
이 code를 실행하면 node의 NMT 상태가 갱신되고, indicator LED가 있는 board에서는 상태가 LED에 반영됩니다. STOPPED에서는 green LED가 천천히 깜박이고, PRE-OPERATIONAL에서는 더 빨리 깜박이며, OPERATIONAL에서는 계속 켜집니다. 이어서 communication reset과 node reset을 수행하고 heartbeat를 기다립니다.
SDO Upload
CANopen object dictionary에서 주어진 index의 Service Data Object(SDO)를 읽을 수 있습니다. 다음 예제는 manufacturer device name인 index 0x1008을 읽습니다.
import canopen
import os
ZEPHYR_BASE = os.environ['ZEPHYR_BASE']
EDS = os.path.join(ZEPHYR_BASE, 'samples', 'modules', 'canopennode',
'objdict', 'objdict.eds')
NODEID = 10
network = canopen.Network()
network.connect()
node = network.add_node(NODEID, EDS)
name = node.sdo['Manufacturer device name']
print("Device name: '{}'".format(name.raw))
network.disconnect()
위 Python code의 출력은 다음과 같습니다.
Device name: 'Zephyr RTOS/CANopenNode'
SDO Download
CANopen object dictionary의 주어진 index에 SDO를 쓸 수도 있습니다. 다음 예제는 producer heartbeat time인 index 0x1017에 값을 씁니다.
import canopen
import os
ZEPHYR_BASE = os.environ['ZEPHYR_BASE']
EDS = os.path.join(ZEPHYR_BASE, 'samples', 'modules', 'canopennode',
'objdict', 'objdict.eds')
NODEID = 10
network = canopen.Network()
network.connect()
node = network.add_node(NODEID, EDS)
heartbeat = node.sdo['Producer heartbeat time']
reboots = node.sdo['Power-on counter']
# Set heartbeat interval without saving to non-volatile storage
print("Initial heartbeat time: {} ms".format(heartbeat.raw))
print("Power-on counter: {}".format(reboots.raw))
heartbeat.raw = 5000
print("Updated heartbeat time: {} ms".format(heartbeat.raw))
# Reset and read heartbeat interval again
node.nmt.state = 'RESET'
node.nmt.wait_for_heartbeat()
print("heartbeat time after reset: {} ms".format(heartbeat.raw))
print("Power-on counter: {}".format(reboots.raw))
# Set interval and store it to non-volatile storage
heartbeat.raw = 2000
print("Updated heartbeat time: {} ms".format(heartbeat.raw))
node.store()
# Reset and read heartbeat interval again
node.nmt.state = 'RESET'
node.nmt.wait_for_heartbeat()
print("heartbeat time after store and reset: {} ms".format(heartbeat.raw))
print("Power-on counter: {}".format(reboots.raw))
# Restore default values, reset and read again
node.restore()
node.nmt.state = 'RESET'
node.nmt.wait_for_heartbeat()
print("heartbeat time after restore and reset: {} ms".format(heartbeat.raw))
print("Power-on counter: {}".format(reboots.raw))
network.disconnect()
Code는 먼저 저장하지 않은 5,000ms 값을 reset 후 확인하고, 2,000ms 값을 non-volatile storage에 저장한 뒤 reset하여 유지되는지 확인합니다. 마지막으로 default를 restore하고 다시 reset합니다.
Initial heartbeat time: 1000 ms
Power-on counter: 1
Updated heartbeat time: 5000 ms
heartbeat time after reset: 1000 ms
Power-on counter: 2
Updated heartbeat time: 2000 ms
heartbeat time after store and reset: 2000 ms
Power-on counter: 3
heartbeat time after restore and reset: 1000 ms
Power-on counter: 4
Power-on counter 값은 실행 환경에 따라 다를 수 있습니다.
PDO Mapping
CANopen object dictionary의 주어진 index에 있는 data를 Transmit Process Data Object(PDO)에 mapping할 수 있습니다. 다음 예제는 index 0x2102의 button press counter를 TPDO 1에 mapping합니다.
import canopen
import os
ZEPHYR_BASE = os.environ['ZEPHYR_BASE']
EDS = os.path.join(ZEPHYR_BASE, 'samples', 'modules', 'canopennode',
'objdict', 'objdict.eds')
NODEID = 10
network = canopen.Network()
network.connect()
node = network.add_node(NODEID, EDS)
button = node.sdo['Button press counter']
# Read current TPDO mapping
node.tpdo.read()
# Enter pre-operational state to map TPDO
node.nmt.state = 'PRE-OPERATIONAL'
# Map TPDO 1 to transmit the button press counter on changes
node.tpdo[1].clear()
node.tpdo[1].add_variable('Button press counter')
node.tpdo[1].trans_type = 254
node.tpdo[1].enabled = True
# Save TPDO mapping
node.tpdo.save()
node.nmt.state = 'OPERATIONAL'
# Reset button press counter
button.raw = 0
print("Press the button 10 times")
while True:
node.tpdo[1].wait_for_reception()
print("Button press counter: {}".format(node.tpdo['Button press counter'].phys))
if node.tpdo['Button press counter'].phys >= 10:
break
network.disconnect()
Code는 현재 TPDO mapping을 읽고 PRE-OPERATIONAL 상태에서 TPDO 1을 다시 구성합니다. 변경 시 button counter를 전송하도록 설정을 저장한 뒤 OPERATIONAL로 전환하고, counter가 10에 도달할 때까지 수신을 기다립니다.
Press the button 10 times
Button press counter: 0
Button press counter: 1
Button press counter: 2
Button press counter: 3
Button press counter: 4
Button press counter: 5
Button press counter: 6
Button press counter: 7
Button press counter: 8
Button press counter: 9
Button press counter: 10
CANopen program download 시험
FRDM-K64F용 Build와 실행
FRDM-K64F에서는 MCUboot와 program download 지원을 포함하도록 sample을 다시 build할 수 있습니다.
MCUboot 지원을 포함해 CANopenNode sample을 build합니다.
west build -b frdm_k64f --sysbuild samples/modules/canopennode -- -Dcanopennode_CONF_FILE=prj_img_mgmt.conf -DSB_CONFIG_BOOTLOADER_MCUBOOT=y새로 build한 MCUboot와 CANopen sample binary를 west로 flash합니다.
west flash --skip-rebuild새로 flash한 firmware image를 west로 confirm합니다.
west flash --skip-rebuild --domain canopennode --runner canopen --confirm-only마지막으로 CANopen을 통해 program download를 수행합니다.
west flash --skip-rebuild --domain canopennode --runner canopen
Object dictionary 수정
이 sample application이 사용하는 CANopen object dictionary는 Zephyr tree의 samples/modules/canopennode/objdict에 있습니다. CANopenNode object dictionary code generation을 지원하는 모든 editor로 수정할 수 있습니다.
libedssharp project의 EDS editor가 널리 쓰이는 선택지입니다. 이 도구로 samples/modules/canopennode/objdict/objdict.xml project file을 열어 수정하고, 새 implementation file인 CO_OD.h와 CO_OD.c를 생성할 수 있습니다. 갱신된 Electronic Data Sheet file objdict.eds도 export할 수 있습니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.