Re: mcp251xfd on RPi 5.4 downstream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Oct 31, 2020 at 10:57 PM Drew Fustini <drew@xxxxxxxxxxxxxxx> wrote:
>
> On Sat, Oct 31, 2020 at 4:35 PM Patrick Menschel <menschel.p@xxxxxxxxx> wrote:
> >
> > > I believe Waveshare did choose other interrupt pins.
> > > Marc used 24 25 which I also chose for a pHat I'm currently making
> > > schematics for.
> > >
> > > Try these lines in /boot/config.txt
> > >
> > > dtoverlay=mcp251xfd-spi0-0,interrupt=25
> > > dtoverlay=mcp251xfd-spi1-0,interrupt=16
> > >
> > > The waveshare overlay is strange in one point. It uses Pin 26 (instead
> > > of 18) for Chip selection but that is no chip select pin. This can work
> > > if the pin is output and luckily pulls the CE line in the right direction.
> > >
> > > https://gist.github.com/pdp7/784d0ba8b9648d20ab055747ec945225#file-2xmcp2517fd-overlay-dts-L40
> > >
> > > https://pinout.xyz/pinout/pin37_gpio26#
> > >
> > > Maybe this has something to do with Nvidia Jetson Platform.
> > >
> > > --
> > > Patrick
> > >
> >
> > Apparently Pin 26 is CE1 for SPI5, only available on Pi 4.
> >
> > https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README#L2674
> >
> > --
> > Patrick
>
> Thank you!  That appears to have solved the problem:
>
> #dtoverlay=2xMCP2517FD
> pi@raspberrypi:~$ dmesg | grep -Ei can\|spi
> [    5.916785] DEBUG spi.c spi_setup(): ENTER
> [    5.917056] DEBUG spi.c spi_setup(): ENTER
> [    5.960326] DEBUG spi.c spi_setup(): ENTER
> [    6.897919] CAN device driver interface
> [    6.904530] mcp251xfd spi0.0: DEBUG mcp251xfd mcp251xfd_probe():
> devm_clk_get()
> [    6.904574] mcp251xfd spi0.0: DEBUG mcp251xfd mcp251xfd_probe(): feq=40000000
> [    6.904641] DEBUG spi.c spi_setup(): ENTER
> [    6.904658] spi_master spi0: will run message pump with realtime priority
> [    6.912009] mcp251xfd spi0.0 can0: MCP2517FD rev0.0 (-RX_INT
> +MAB_NO_WARN +CRC_REG +CRC_RX +CRC_TX +ECC -HD c:40.00MHz m:20.00MHz
> r:17.00MHz e:0.00MHz) successfully initialized.
> [    6.912613] mcp251xfd spi1.0: DEBUG mcp251xfd mcp251xfd_probe():
> devm_clk_get()
> [    6.912646] mcp251xfd spi1.0: DEBUG mcp251xfd mcp251xfd_probe(): feq=40000000
> [    6.912701] DEBUG spi.c spi_setup(): ENTER
> [    6.912719] spi_master spi1: will run message pump with realtime priority
> [    6.920067] mcp251xfd spi1.0 can1: MCP2517FD rev0.0 (-RX_INT
> +MAB_NO_WARN +CRC_REG +CRC_RX +CRC_TX +ECC -HD c:40.00MHz m:20.00MHz
> r:17.00MHz e:0.00MHz) successfully initialized.

The Waveshare CANFD hat has interrupt pin of CAN1, the second
MCP2517FD, wired up to pin 36 on the Pi connector.

I changed this in mcp251xfd-spi1-0-overlay.dts:
-                               interrupts = <24 IRQ_TYPE_LEVEL_LOW>;
+                               interrupts = <16 IRQ_TYPE_LEVEL_LOW>;

And can1 is now working too:

pi@raspberrypi:~$ dmesg | grep -Ei can\|spi
[   14.663345] CAN device driver interface
[   14.669552] spi_master spi0: will run message pump with realtime priority
[   14.677102] mcp251xfd spi0.0 can0: MCP2517FD rev0.0 (-RX_INT
+MAB_NO_WARN +CRC_REG +CRC_RX +CRC_TX +ECC -HD c:40.00MHz m:20.00MHz
r:17.00MHz e:0.00MHz) successfully initialized.
[   14.677833] spi_master spi1: will run message pump with realtime priority
[   14.682667] mcp251xfd spi1.0 can1: MCP2517FD rev0.0 (-RX_INT
+MAB_NO_WARN +CRC_REG +CRC_RX +CRC_TX +ECC -HD c:40.00MHz m:20.00MHz
r:17.00MHz e:0.00MHz) successfully initialized.
[   75.254659] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
[   77.942514] IPv6: ADDRCONF(NETDEV_CHANGE): can1: link becomes ready

thanks,
drew



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux