Lines Matching +full:code +full:- +full:format
1 .. zephyr:code-sample:: canopennode
11 CANopen is an internationally standardized (`EN 50325-4`_, `CiA 301`_)
13 systems used in automation. CANopenNode is a 3rd party, open-source
17 demonstrates the use of non-volatile storage for the CANopen object
31 .. code-block:: console
33 west config manifest.project-filter +canopennode
36 Building and Running for TWR-KE18F
40 LEDs). The sample can be built and executed for the TWR-KE18F as
43 .. zephyr-app-commands::
44 :zephyr-app: samples/modules/canopennode
52 Building and Running for FRDM-K64F
55 transceiver. In order to use the CAN bus on the FRDM-K64F board, an
60 The sample can be built and executed for the FRDM-K64F as follows:
62 .. zephyr-app-commands::
63 :zephyr-app: samples/modules/canopennode
81 .. zephyr-app-commands::
82 :zephyr-app: samples/modules/canopennode
100 .. zephyr-app-commands::
101 :zephyr-app: samples/modules/canopennode
111 The sample cannot run if the <erase-block-size> of the flash-controller exceeds 0x10000.
112 Typically nucleo_h743zi with erase-block-size = <DT_SIZE_K(128)>;
119 .. zephyr-app-commands::
120 :zephyr-app: samples/modules/canopennode
131 the host PC and Zephyr. First, install python-canopen along with the
132 python-can backend as follows:
134 .. code-block:: console
136 pip3 install --user canopen python-can
138 Next, configure python-can to use your CAN adapter through its
142 .. code-block:: console
151 Please refer to the `python-can`_ documentation for further details
157 .. code-block:: console
159 sudo ip link set can0 type can bitrate 125000 restart-ms 100
165 `can-utils`_ package as follows:
167 .. code-block:: console
174 accomplished using the following Python code:
176 .. code-block:: py
199 node.nmt.state = 'PRE-OPERATIONAL'
216 Running the above Python code will update the NMT state of the node
223 name) can be accomplished using the following Python code:
225 .. code-block:: py
243 print("Device name: '{}'".format(name.raw))
247 Running the above Python code should produce the following output:
249 .. code-block:: console
257 can be accomplished using the following Python code:
259 .. code-block:: py
276 reboots = node.sdo['Power-on counter']
278 # Set heartbeat interval without saving to non-volatile storage
279 print("Initial heartbeat time: {} ms".format(heartbeat.raw))
280 print("Power-on counter: {}".format(reboots.raw))
282 print("Updated heartbeat time: {} ms".format(heartbeat.raw))
287 print("heartbeat time after reset: {} ms".format(heartbeat.raw))
288 print("Power-on counter: {}".format(reboots.raw))
290 # Set interval and store it to non-volatile storage
292 print("Updated heartbeat time: {} ms".format(heartbeat.raw))
298 print("heartbeat time after store and reset: {} ms".format(heartbeat.raw))
299 print("Power-on counter: {}".format(reboots.raw))
305 print("heartbeat time after restore and reset: {} ms".format(heartbeat.raw))
306 print("Power-on counter: {}".format(reboots.raw))
310 Running the above Python code should produce the following output:
312 .. code-block:: console
315 Power-on counter: 1
318 Power-on counter: 2
321 Power-on counter: 3
323 Power-on counter: 4
325 Note that the power-on counter value may be different.
331 press counter) can be accomplished using the following Python code:
333 .. code-block:: py
354 # Enter pre-operational state to map TPDO
355 node.nmt.state = 'PRE-OPERATIONAL'
373 print("Button press counter: {}".format(node.tpdo['Button press counter'].phys))
379 Running the above Python code should produce the following output:
381 .. code-block:: console
399 Building and Running for FRDM-K64F
402 for the FRDM-K64F as follows:
406 .. zephyr-app-commands::
408 :zephyr-app: samples/modules/canopennode
411 :west-args: --sysbuild
412 :gen-args: -Dcanopennode_CONF_FILE=prj_img_mgmt.conf -DSB_CONFIG_BOOTLOADER_MCUBOOT=y
417 .. code-block:: console
419 west flash --skip-rebuild
423 .. code-block:: console
425 west flash --skip-rebuild --domain canopennode --runner canopen --confirm-only
429 .. code-block:: console
431 west flash --skip-rebuild --domain canopennode --runner canopen
438 object dictionary editor supporting CANopenNode object dictionary code
454 .. _EN 50325-4:
455 https://can-cia.org/cia-groups/international-standardization/
458 https://can-cia.org/cia-groups/technical-documents/
463 .. _python-can:
464 https://python-can.readthedocs.io/
466 .. _can-utils:
467 https://github.com/linux-can/can-utils