Skip to content

Commit

Permalink
boards: shields: Adding support for the adafruit can picowbell shield
Browse files Browse the repository at this point in the history
Adding support for the adafruit can picowbell shield for the
raspberry pi pico

Signed-off-by: Joseph Yates <joeyatessecond@gmail.com>
  • Loading branch information
joeker64 committed Jun 28, 2023
1 parent bbec614 commit bf94c14
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 1 deletion.
3 changes: 3 additions & 0 deletions boards/shields/mcp2515/Kconfig.shield
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ config SHIELD_DFROBOT_CAN_BUS_V2_0

config SHIELD_KEYESTUDIO_CAN_BUS_KS0411
def_bool $(shields_list_contains,keyestudio_can_bus_ks0411)

config SHIELD_ADAFRUIT_CAN_PICOWBELL
def_bool $(shields_list_contains,adafruit_can_picowbell)
32 changes: 32 additions & 0 deletions boards/shields/mcp2515/adafruit_can_picowbell.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2023 Joseph Yates
*
* SPDX-License-Identifier: Apache-2.0
*/

&spi0{
status = "okay";
cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;

mcp2515_adafruit_can_picowbell: can@0 {
compatible = "microchip,mcp2515";
spi-max-frequency = <1000000>;
int-gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
status = "okay";
reg = <0x0>;
osc-freq = <16000000>;
bus-speed = <125000>;
sjw = <1>;
sample-point = <875>;

can-transceiver {
max-bitrate = <1000000>;
};
};
};

/ {
chosen {
zephyr,canbus = &mcp2515_adafruit_can_picowbell;
};
};
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
131 changes: 130 additions & 1 deletion boards/shields/mcp2515/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,126 @@ For more information about the Keyestudio CAN-BUS shield:
- `MCP2515 Datasheet`_
- `MCP2551 Datasheet`_

Adafruit PiCowbell CAN Bus Shield for Pico
******************************************

Overview
--------

The Adafruit PiCowbell CAN Bus Shield uses the Microchip MCP2515 controller
with an TJA1051/3 transceiver. This shield is built for the raspberry pi pico
and uses the SPI interface. It also contains a qwiic connector to add support
for a sensor.

.. figure:: adafruit_can_picowbell.jpg
:align: center
:alt: ADAFRUIT_CAN_PICOWBELL_SHIELD

Hardware
--------

- MCP2515

- Stand-Alone CAN 2.0B Controller
- Up to 1Mb/s baud rate
- Standard and extended data and remote frames
- 3x Tx Buffers
- 2x Rx Buffers
- 6x 29-bit Filters
- 2x 29-bit Masks
- Interrupt output
- One shot mode
- High speed SPI interface (10 MHz)

- TJA1051

- Fully compatible with the “ISO 11898-2:2016”, "SAE J2284-1" & "SAE J2284-5" standards
- Supports CAN FD
- Fast data rates (up to 5 Mbit/s)

- Connectivity

- Terminal Block - 3-pin 3.5mm (CAN)
- Raspberry Pi Pico compatible (SPI)

+-------+-----------------------+---------------------------+
| Name | Function | Usage |
+=======+=======================+===========================+
| GP0 | None | |
+-------+-----------------------+---------------------------+
| GP1 | None | |
+-------+-----------------------+---------------------------+
| GP2 | None | |
+-------+-----------------------+---------------------------+
| GP3 | None | |
+-------+-----------------------+---------------------------+
| GP4 | None | |
+-------+-----------------------+---------------------------+
| GP5 | None | |
+-------+-----------------------+---------------------------+
| GP6 | None | |
+-------+-----------------------+---------------------------+
| GP7 | None | |
+-------+-----------------------+---------------------------+
| GP8 | None | |
+-------+-----------------------+---------------------------+
| GP9 | None | |
+-------+-----------------------+---------------------------+
| GP10 | None | |
+-------+-----------------------+---------------------------+
| GP11 | None | |
+-------+-----------------------+---------------------------+
| GP12 | None | |
+-------+-----------------------+---------------------------+
| GP13 | None | |
+-------+-----------------------+---------------------------+
| GP14 | None | |
+-------+-----------------------+---------------------------+
| GP15 | None | |
+-------+-----------------------+---------------------------+
| GP16 | SPI-MISO | MCP2515 |
+-------+-----------------------+---------------------------+
| GP17 | None | |
+-------+-----------------------+---------------------------+
| GP18 | SPI-SCK | MCP2515 |
+-------+-----------------------+---------------------------+
| GP19 | SPI-MOSI | MCP2515 |
+-------+-----------------------+---------------------------+
| GP20 | SPI-CS | MCP2515 |
+-------+-----------------------+---------------------------+
| GP21 | GPIO_ACTIVE_LOW | MCP2515 - INT |
+-------+-----------------------+---------------------------+
| GP22 | None | |
+-------+-----------------------+---------------------------+
| GP23 | None | |
+-------+-----------------------+---------------------------+
| GP24 | None | |
+-------+-----------------------+---------------------------+
| GP25 | None | |
+-------+-----------------------+---------------------------+
| GP26 | None | |
+-------+-----------------------+---------------------------+
| GP27 | None | |
+-------+-----------------------+---------------------------+
| GP28 | None | |
+-------+-----------------------+---------------------------+


- Power Supply

- 3.3V ~ 5V

For more information about the Adafruit PiCowbell CAN Bus shield:

- `Adafruit Website`_
- `MCP2515 Datasheet`_
- `TJA1051 Datasheet`_

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

Set ``-DSHIELD=dfrobot_can_bus_v2_0`` or ``-DSHIELD=keyestudio_can_bus_ks0411``
when you invoke ``west build`` or ``cmake`` in your Zephyr application. For
or ``-DSHIELD=adafruit_can_picowbell`` when you invoke ``west build`` or ``cmake`` in your Zephyr application. For
example:

.. zephyr-app-commands::
Expand All @@ -240,6 +355,13 @@ example:
:shield: keyestudio_can_bus_ks0411
:goals: build flash

.. zephyr-app-commands::
:zephyr-app: samples/drivers/can/counter
:tool: all
:board: rpi_pico
:shield: adafruit_can_picowbell
:goals: build

.. _DFRobot Website:
https://www.dfrobot.com/product-1444.html

Expand All @@ -263,3 +385,10 @@ example:

.. _MCP2551 Datasheet:
https://ww1.microchip.com/downloads/en/DeviceDoc/20001667G.pdf

.. _Adafruit Website:
https://www.adafruit.com/product/5728#technical-details

.. _TJA1051 Datasheet:
https://www.nxp.com/docs/en/data-sheet/TJA1051.pdf

0 comments on commit bf94c14

Please sign in to comment.