kentindell / canhack

The Yes We CAN project of Canis Labs
MIT License
325 stars 61 forks source link

Change SPI pins #27

Open acedogblast opened 2 months ago

acedogblast commented 2 months ago

Hello I have a custom rp2040 based board using MCP251863. I was able to build Micro-python along with the added CAN related code from this repo (except the MIN_PROTOCOL support due to a build error). I have not been able to find out where the GP# pins are defined to interface with the MCP251863. On my board it uses GP pins 8 through 11 which is part of the second SPI bus of the rp2040. Where can I set the SPI pins? Thank you.

kentindell commented 2 months ago

The CAN drivers are in another repository: https://github.com/kentindell/canis-can-sdk

The SPI pins are set in the header file: https://github.com/kentindell/canis-can-sdk/blob/main/mcp25xxfd/rp2/mcp25xxfd-rp2.h

You can modify this file to add extra board support. If you want, you can create some macro fu that when allows arbitrary board definition headers to be pulled in, then I will accept a pull request for this so that you don't need to maintain a fork of the repo.

acedogblast commented 2 months ago

Thanks for the info. I am not very familiar with working with C Macros and change is very simple so I don't think I can submit such patch. Just wondering is the SPI_IRQ macro corresponds to ~INT (pin 19 of SSOP)? The MCP251863 also has ~INT0 and ~INT1 are they used in the driver?