zephyr/samples/drivers/can/babbling
Henrik Brix Andersen 55d0ffa874 drivers: can: remove CAN_HAS_CANFD Kconfig helper
Remove the CAN_HAS_CANFD Kconfig helper symbol in order to allow enabling
CAN-FD support in the API regardless of driver support.

Change default to CAN-FD support being disabled and have samples and tests
that require CAN-FD support turn it on. This aligns the default
configuration across CAN controller drivers regardless of their
capabilities.

The rationale behind this is that we are starting to see MCUs with multiple
CAN controllers, some CAN-FD compatible, some not (e.g. NXP i.MX RT1060 and
FPGAs). Automatically enabling CAN-FD support based on the presence of a
CAN-FD capable CAN controller leads to different application default
settings based on the CAN controller(s) in use.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-25 15:00:39 +00:00
..
src samples: drivers: can: babbling: set CAN-FD mode if requested 2022-10-25 16:32:10 +02:00
CMakeLists.txt samples: drivers: can: add babbling node sample 2022-09-06 09:56:57 +02:00
Kconfig drivers: can: remove CAN_HAS_CANFD Kconfig helper 2023-01-25 15:00:39 +00:00
prj.conf samples: drivers: can: add babbling node sample 2022-09-06 09:56:57 +02:00
README.rst samples: drivers: can: add babbling node sample 2022-09-06 09:56:57 +02:00
sample.yaml samples: drivers: can: add babbling node sample 2022-09-06 09:56:57 +02:00

.. _can-babbling-sample:

Controller Area Network (CAN) Babbling Node
###########################################

Overview
********

In a Controller Area Network a babbling node is a node continuously (and usually erroneously)
transmitting CAN frames with identical - often high - priority. This constant babbling blocks CAN
bus access for any CAN frame with lower priority as these frames will loose the bus arbitration.

This sample application simulates a babbling CAN node. The properties of the CAN frames sent are
configurable via :ref:`Kconfig <kconfig>`. The frames carry no data as only the arbitration part of
the CAN frame is of interest.

Being able to simulate a babbling CAN node is useful when examining the behavior of other nodes on
the same CAN bus when they constantly loose bus arbitration.

The source code for this sample application can be found at:
:zephyr_file:`samples/drivers/can/babbling`.

Requirements
************

This sample requires a board with a CAN controller. The CAN controller must be configured using the
``zephyr,canbus`` :ref:`devicetree <dt-guide>` chosen node property.

The sample supports an optional button for stopping the babbling. If present, the button must be
configured using the ``sw0`` :ref:`devicetree <dt-guide>` alias, usually in the :ref:`BOARD.dts file
<devicetree-in-out-files>`.

Building and Running
********************

Example building for :ref:`twr_ke18f`:

.. zephyr-app-commands::
   :zephyr-app: samples/drivers/can/babbling
   :board: twr_ke18f
   :goals: build flash

Sample output
=============

.. code-block:: console

   *** Booting Zephyr OS build zephyr-v3.1.0-4606-g8c1efa8b96bb  ***
   babbling on can@40024000 with standard (11-bit) CAN ID 0x010, RTR 0, CAN-FD 0
   abort by pressing User SW3 button