Jump to content

Fran A100

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Fran A100

  1. Hi Guys! This is my fist post on this forum. I have been spending a lot of time these days to make the MCP2515 CAN Controller on the RISCV computer, but I am not able to make it work even if everything seems to be on place. It is obvious that I am not understanding something correclty and that is why is not working. I am using the MangoPi Mqpro that has the SPI port on the 40 pin connector. Right now is not possible to add overlays on mangopi with the arbiam, but I managed to upload my custom overlays using the grub and Ubuntu, that part is not relevant for the topic. Let's assume for the topic that I am able to upload overlays and they are correctly applied on device tree. ### Connections The SPI interface is defined as follows, extracted from /sys/kernel/debug/pinctrl/2000000.pinctrl/pinmux-pins: pin 106 (PD10): device 4026000.spi function spi1 group PD10 pin 107 (PD11): device 4026000.spi function spi1 group PD11 pin 108 (PD12): device 4026000.spi function spi1 group PD12 pin 109 (PD13): device 4026000.spi function spi1 group PD13 pin 110 (PD14): device 4026000.spi function spi1 group PD14 pin 111 (PD15): device 4026000.spi function spi1 group PD15 pin 112 (PD16): device 2000c00.pwm function pwm group PD16 pin 113 (PD17): device spi1.0 function irq group PD17 Basically is connected to the SPI interface of the MCP2515, and the interrupt is connected to PD17. SPI_INT PD17 SPI_SCK PD11 SPI_SI PD12 SPI_SO PD13 SPI_CS PD10 The overlay that I am applying is the next one: /dts-v1/; /plugin/; / { compatible = "allwinner,d1-nezha\0allwinner,sun20i-d1"; fragment@0 { target-path = "/clocks"; __overlay__ { #address-cells = <1>; #size-cells = <1>; /* External crystal oscillator on the board */ can0_osc_fixed: can0_osc_fixed { compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <8000000>; phandle = <0x81>; }; }; }; fragment@1 { target = <&pinctrl>; // pinctrl@2000000 __overlay__ { can0_pin_irq: can0_pin_irq { pins = "PD17"; function = "irq"; phandle = <0x85>; }; }; }; fragment@2 { target = <&spi>; //spi@4026000 __overlay__ { #address-cells = <1>; #size-cells = <0>; status = "okay"; mcp2515 { reg = <0>; // SPI 1 compatible = "microchip,mcp2515"; pinctrl-names = "default"; pinctrl-0 = <0x85>; spi-max-frequency = <10000000>; interrupt-parent = <0x22>; // pinctrl@2000000 interrupts = <0 113 2>; // IRQ LINE, try with <0 65 2> clocks = <0x81>; status = "okay"; }; }; }; }; However when I boot up I look to the interrupts and there is nothing related to the irq line for the CAN/spi, output of /proc/interrupts: CPU0 2: 79503 sun20i-intc 75 Edge timer@2050000 3: 0 sun20i-intc 109 Edge 5500000.hdmi, dw-hdmi-cec 4: 0 sun20i-intc 25 Edge mv64xxx_i2c 5: 0 RISC-V INTC 5 Edge riscv-timer 6: 14 sun20i-intc 68 Edge sun8i-ce-ns 7: 0 sun20i-intc 47 Edge ohci_hcd:usb3 74: 0 sun20i-intc 31 Edge sun6i-spi 78: 5926 sun20i-intc 74 Edge ths 79: 0 sun20i-intc 50 Edge ohci_hcd:usb4 80: 0 sun20i-intc 46 Edge ehci_hcd:usb1 81: 1336 sun20i-intc 18 Edge ttyS1 82: 189890 sun20i-intc 57 Edge sunxi-mmc 83: 0 sun20i-intc 82 Edge 1c0e000.video-codec 84: 0 sun20i-intc 80 Edge 2010000.iommu 85: 0 sun20i-intc 107 Edge 5470000.lcd-controller 88: 0 sun20i-intc 49 Edge ehci_hcd:usb2 89: 0 sun20i-intc 160 Edge 7090000.rtc 90: 2 sun20i-intc 27 Edge mv64xxx_i2c 98: 0 sun20i-intc 45 Edge musb-hdrc.2.auto 101: 8630 sun20i-intc 56 Edge sunxi-mmc 109: 0 sun20i-intc 66 Edge 3002000.dma-controller 111: 4 sun20i-intc 32 Edge sun6i-spi 112: 0 sun20i-intc 77 Edge sun4i-a10-lradc-keys 113: 0 sun20i-intc 106 Edge 5461000.lcd-controller 114: 7 sun20i-intc 167 Edge sunxi-ir 119: 0 sun20i-intc 36 Edge 2008000.led-controller 204: 1 sunxi_pio_edge 84 Edge usb0-vbus-det 205: 1 sunxi_pio_edge 85 Edge usb0-id-det 254: 1 sunxi_pio_edge 134 Edge 4020000.mmc cd IPI0: 0 Rescheduling interrupts IPI1: 0 Function call interrupts IPI2: 0 CPU stop interrupts IPI3: 0 IRQ work interrupts IPI4: 0 Timer broadcast interrupts Some outputs from the Kernel: [ 52.133406] CAN device driver interface [ 52.918270] mcp251x spi1.0 can0: MCP2515 successfully initialized. [ 1163.417322] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready [ 1182.919088] can: controller area network core [ 1182.919249] NET: Registered PF_CAN protocol family [ 1183.000429] can: raw protocol And after booting I run the next: $ sudo ip link set can0 up type can bitrate 500000 $ sudo ifconfig can0 up $ sudo cansend can0 5A1#00.01.02.03.04 This configuration is not working because when I try to connect, I am not receiving anything. I suppose that I am not configuring correctly the interrupt line of the IRQ of SPI. My knowledge on this is very narrow, and I am not able to understand what is failing. All the feedback is totally welcome. I can give more documentation if my explanation is not complete enought. Thanks!
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines