正点原子rk3588S驱动MCP2515【SPI转CAN模块】
·
主要是连线与修改设备树,有需要的可以点赞,有空会更新。
设备树如下:
// int 引脚连接到了gpio3 c1
&spi0 {
status = "okay";
pinctrl-0 = <&spi0m3_pins>;
cs-gpios = <&gpio3 RK_PD4 1>;
/* MCP2515 CAN 控制器 */
mcp2515@0 {
compatible = "microchip,mcp2515";
reg = <0>; /* SPI0 CS0 */
spi-max-frequency = <10000000>;
// spi-max-frequency = <10000000>; /* 改为 1 MHz */
interrupt-parent = <&gpio3>;
interrupts = <RK_PC1 IRQ_TYPE_EDGE_FALLING>;
clocks = <&clk8m>;
pinctrl-names = "default";
pinctrl-0 = <&mcp2515_int_grp>;
status = "okay";
};
clk8m: clk8 {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <8000000>; //8m
};
};
/* MCP2515 中断管脚 */
&pinctrl {
mcp2515_int: mcp2515-int {
mcp2515_int_grp: mcp2515_int_grp {
rockchip,pins = <3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
};
连线就是spi的接线方式。int引脚是中断引脚,我接到了40pin的GPIO3_C1
更多推荐
所有评论(0)