Skip to content

Commit

Permalink
shields: Add CAN-FD mcp2518fd shield
Browse files Browse the repository at this point in the history
Adds click shield for the Microchip MCP2518FD CAN-FD controller.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
  • Loading branch information
talih0 committed Jul 3, 2023
1 parent acf9e4f commit 7c9420a
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 0 deletions.
2 changes: 2 additions & 0 deletions boards/shields/mcp2518fd_click/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config MCP2518FD_CLICK
def_bool $(shields_list_contains,mcp2518fd_click)
41 changes: 41 additions & 0 deletions boards/shields/mcp2518fd_click/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.. _mcp2518fd_click_shield:

Microchip MCP2518FD Click shield (CAN FD)
#########################################

Overview
--------

MCP2518FD Click shield has a MCP2518FD CAN FD controler via an SPI

Check warning on line 9 in boards/shields/mcp2518fd_click/doc/index.rst

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

TYPO_SPELLING

boards/shields/mcp2518fd_click/doc/index.rst:9 'controler' may be misspelled - perhaps 'controller'?
interface and a high-speed ATA6563 CAN transceiver.

More information about the shield can be found at
`MCP2518FD click`_.

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

The shield uses a mikroBUS interface. The target board must define
a mikrobus_spi node label (see :ref:`shields` for more details).

Programming
***********

Set ``-DSHIELD=mcp2518fd_click`` when you invoke ``west build``.
In the example below, the target board does not have a mikroBUS
interface. Instead it uses :ref:`arduino_uno_click` shield map the
Arduino UNO R3 headers to a mikroBUS interface.

.. zephyr-app-commands::
:zephyr-app: samples/drivers/can/counter
:board: xmc47_relax_kit
:shield: "arduino_uno_click mcp2518fd_click"
:goals: build flash

References
**********

.. target-notes::

.. _MCP2518FD click:
https://www.mikroe.com/mcp2518fd-click
28 changes: 28 additions & 0 deletions boards/shields/mcp2518fd_click/mcp2518fd_click.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
&mikrobus_spi {
cs-gpios = <&mikrobus_header 2 GPIO_ACTIVE_LOW>;
mcp2518fd: canfd@0 {
compatible = "microchip,mcp25xxfd";
status = "okay";

spi-max-frequency = <18000000>;
int-gpios = <&mikrobus_header 7 GPIO_ACTIVE_LOW>;
reg = <0x0>;
osc-freq = <40000000>;
bus-speed = <500000>;
bus-speed-data = <2000000>;
prop-seg = <0>;
phase-seg1 = <15>;
phase-seg2 = <4>;
sjw = <4>;
prop-seg-data = <0>;
phase-seg1-data = <7>;
phase-seg2-data = <2>;
sjw-data = <2>;
};
};

/ {
chosen {
zephyr,canbus = &mcp2518fd;
};
};
9 changes: 9 additions & 0 deletions samples/drivers/can/counter/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ provides the MCP2515 CAN controller:
:shield: dfrobot_can_bus_v2_0
:goals: build flash

For the xmc47_relax_kit board combined with the Arduino UNO Click shield and a
MCP2518FD click shield inserted into the first mikroBUS socket:

.. zephyr-app-commands::
:zephyr-app: samples/drivers/can/counter
:board: xmc47_relax_kit
:shield: arduino_uno_click mcp2518fd_click
:goals: build flash

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

Expand Down
1 change: 1 addition & 0 deletions samples/drivers/can/counter/boards/xmc47_relax_kit.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mikrobus_header: &mikrobus_header_1 {};

0 comments on commit 7c9420a

Please sign in to comment.