-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add support for the Canis Labs CANPico shield for the Raspberry Pi Pico #97653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ThreeEights
wants to merge
2
commits into
zephyrproject-rtos:main
Choose a base branch
from
ThreeEights:can-pico-shield
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+221
−0
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright (c) 2025 Steve Boylan | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config SHIELD_CANIS_CANPICO | ||
def_bool $(shields_list_contains,canis_canpico) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (c) 2025 Steve Boylan | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
&pico_spi { | ||
status = "okay"; | ||
cs-gpios = <&pico_header 6 GPIO_ACTIVE_LOW>; | ||
pinctrl-0 = <&spi1_canpico>; | ||
pinctrl-names = "default"; | ||
|
||
mcp251xfd_canis_canpico: can@0 { | ||
compatible = "microchip,mcp251xfd"; | ||
spi-max-frequency = <1000000>; | ||
int-gpios = <&pico_header 5 GPIO_ACTIVE_LOW>; | ||
status = "okay"; | ||
reg = <0x0>; | ||
osc-freq = <16000000>; | ||
|
||
can-transceiver { | ||
max-bitrate = <1000000>; | ||
}; | ||
}; | ||
}; | ||
|
||
&pinctrl { | ||
spi1_canpico: spi1_canpico { | ||
group1 { | ||
pinmux = <SPI1_SCK_P10>, <SPI1_TX_P11>; | ||
}; | ||
|
||
group2 { | ||
pinmux = <SPI1_RX_P8>; | ||
input-enable; | ||
}; | ||
}; | ||
}; | ||
|
||
/ { | ||
chosen { | ||
zephyr,canbus = &mcp251xfd_canis_canpico; | ||
}; | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
.. _canis_canpico: | ||
|
||
Canis Labs CANPico Shield | ||
######################### | ||
|
||
Overview | ||
******** | ||
|
||
The Canis Labs CANPico shield supports the Microchip MCP2517FD or MCP2518FD | ||
stand-alone CAN controller and Microchip MCP2562FD high-speed CAN FD | ||
transceiver. The CANPico is a carrier board in a ‘sock’ format for a | ||
Raspberry Pi Pico family. | ||
|
||
.. figure:: canis_canpico.webp | ||
:align: center | ||
:alt: Canis_Labs_CANPico_SHIELD | ||
|
||
Hardware | ||
******** | ||
|
||
- MCP2517/2518FD | ||
|
||
- External CAN FD Controller with Serial Peripheral Interface (SPI) | ||
- Arbitration Bit Rate up to 1 Mbps | ||
- Data Bit Rate up to 8 Mbps | ||
- CAN FD Controller modes: CAN 2.0B Mode or Mixed CAN 2.0B and CAN FD Mode | ||
- Conforms to ISO 11898-1:2015 | ||
|
||
- MCP2562FD | ||
|
||
- Optimized for CAN FD (Flexible Data rate) at 2, 5 and 8 Mbps Operation | ||
- Maximum Propagation Delay: 120 ns | ||
- Implements ISO-11898-2 and ISO-11898-5 Standard Physical Layer Requirements | ||
- Very Low Standby Current (5 µA, typical) | ||
- VIO Supply Pin to Interface Directly to CAN Controllers and Microcontrollers with 1.8V to 5.5V I/O | ||
|
||
- Connectivity | ||
|
||
- Jumper header to enable a 120W CAN bus termination resistor | ||
- Jumper header to enable the CAN TX line to the transceiver | ||
- Screw terminal connector to CAN bus | ||
- CAN controller interrupt and Start-of-Frame inputs to GPIO pins | ||
- Direct access via GPIO pins to the CAN transceiver Tx and Rx pins | ||
- Test instrument header (for an oscilloscope or logic analyzer) | ||
|
||
+-------+-----------------------+---------------------------+ | ||
| Name | Function | Usage | | ||
+=======+=======================+===========================+ | ||
| GP0 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP1 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP2 | TRIG | Programmable trigger | | ||
+-------+-----------------------+---------------------------+ | ||
| GP3 | STBY | Transceiver standby | | ||
+-------+-----------------------+---------------------------+ | ||
| GP4 | SOF | Clock/SOF | | ||
+-------+-----------------------+---------------------------+ | ||
| GP5 | IRQ | Transceiver interrupt | | ||
+-------+-----------------------+---------------------------+ | ||
| GP6 | None | SPI CS | | ||
+-------+-----------------------+---------------------------+ | ||
| GP7 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP8 | SPI1_Rx | SPI Rx | | ||
+-------+-----------------------+---------------------------+ | ||
| GP9 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP10 | SPI1_SCK | SPI clock | | ||
+-------+-----------------------+---------------------------+ | ||
| GP11 | SPI1_Tx | SPI Tx | | ||
+-------+-----------------------+---------------------------+ | ||
| GP12 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP13 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP14 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP15 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP16 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP17 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP18 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP19 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP20 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP21 | Rx | CAN Rx data | | ||
+-------+-----------------------+---------------------------+ | ||
| GP22 | Tx | CAN Tx data | | ||
+-------+-----------------------+---------------------------+ | ||
| GP23 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP24 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP25 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP26 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP27 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
| GP28 | None | | | ||
+-------+-----------------------+---------------------------+ | ||
|
||
- Test header | ||
|
||
- TRIG: Programmable trigger output | ||
- Tx: Logic-level CAN Tx data | ||
- Rx: Logic-level CAN Rx data | ||
- H: Raw CAN-Hi signal | ||
- L: Raw CAN-Low signal | ||
|
||
- Power Supply | ||
|
||
- 3.3V ~ 5V | ||
|
||
- Components | ||
|
||
- Tx Enable jumper | ||
- 120 ohm terminator jumper | ||
|
||
For more information about the Canis Labs CANPico shield: | ||
|
||
- `Canis Labs Website`_ | ||
- `CANPico CAN Bus Shield`_ | ||
- `MCP2517FD Datasheet`_ | ||
- `MCP2518FD Datasheet`_ | ||
- `MCP2562FD Datasheet`_ | ||
|
||
Programming | ||
*********** | ||
|
||
Set ``--shield canis-canpico`` when you invoke ``west build`` or ``cmake`` | ||
in your Zephyr application. For example: | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/drivers/can/counter | ||
:tool: all | ||
:board: rpi_pico | ||
:shield: canpico | ||
:goals: build flash | ||
|
||
.. _Canis Labs Website: | ||
https://canislabs.com/ | ||
|
||
.. _CANPico CAN Bus Shield: | ||
https://canislabs.com/canpico/ | ||
|
||
.. _MCP2517FD: | ||
https://www.microchip.com/en-us/product/MCP2518FD | ||
|
||
.. _MCP2517FD Datasheet: | ||
https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/DataSheets/MCP2517FD-External-CAN-FD-Controller-with-SPI-Interface-20005688B.pdf | ||
|
||
.. _MCP2518FD: | ||
https://www.microchip.com/en-us/product/MCP2518FD | ||
|
||
.. _MCP2518FD Datasheet: | ||
https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/DataSheets/External-CAN-FD-Controller-with-SPI-Interface-DS20006027B.pdf | ||
|
||
.. _MCP2562FD Datasheet: | ||
https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/DataSheets/20005284A.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
shields: | ||
- name: canis_canpico | ||
full_name: Canis Labs CANPico | ||
vendor: canis | ||
supported_features: | ||
- can |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That change is not consistent with other shields. A selection:
Do you insist on this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ThreeEights
If i need to fight or insist for every request change I think you can agree that this will quickly become exhausting.
Most shields (and boards for that matter) do not have vendor in their name. When they do, it's typically because that's the official / most prominent product name one would find on vendor website, or e.g. in the top results in their favourite search engine.
See e.g. https://www.adafruit.com/product/4161?srsltid=AfmBOooXOsEAM1UFkhs34iq4Nq9wEXZHGZqhDfg3-VhPQAMyL8Xm6Pwm, https://www.sparkfun.com/sparkfun-micromod-asset-tracker-carrier-board.html. Sometiemes it's also to help disambiguate synonyms.
In the case of CANPico, I think you can safely get rid of it but I certainly don't want to spend another 10 minutes justifying my choice or "insisting" for you to agree to apply it :|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW I also took the liberty to make that comment because I knew you were coming back to this PR anyway. Not sure I understand the rationale of not applying the change while you were there fixing the image file name but oh well :|
Thanks for the PR anyway, this is really cool to see so many new shields added in this release :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kartben - Please have pity on us poor mortals who don't live and breathe Zephyr. I'm not trying to create problems or extra work for anyone here. Try to understand how frustrating this week has been for me: First was the problem with the image. After I corrected it, I was asked to replace it. Alas, I'd not heard of the webp format; asking around our team, two people had heard of it but not used it. Now I've learned that it's the cat's pajamas, the bee's knees, and seems to be the preferred format for Zephyr in the future.
Then came the request to reorganize the files to focus only on the CANPico. I had originally followed the time-honored practice of copying the existing structure for the mcp2815 shields, assuming it would be nice to accommodate other products based on the newer chips. But, of course, pointing that out did not change the opinions of the reviewers.
Now this latest request, which appears to me to be incorrect. I failed to follow your explanation in this case; the two specific examples you mention seem to contradict your explanation:
I don't want to waste any more of your time, but please let me know if the current full_name might possibly be acceptable, or can you enlighten me further so my future pull requests will meet the high standards expected for contributions to Zephyr?
And thank you for investing so much effort on this one little piece of this grand edifice!
Steve