Re: mcp25xxfd driver testing

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

 



Hey,

I did struggle with a variscite imx8+MCP25xxfd system.

On wo, 23 sep 2020 16:55:13 +0200, Matthias Weißer wrote:
> Hi
> 
> I currently try to get a MCP2518FD to work on our custom iMX6ULL based
> hardware. I use the driver currently in linux-can-next backported to
> our v5.4 kernel
> 
> DT:
>     can0: can@0 {
>         compatible = "microchip,mcp25xxfd";
>         reg = <0>;
>         clocks = <&can3_osc>;
>         spi-max-frequency = <85000000>;
I did not experience issues by using the real 20MHz upper limit here.
>         interrupts-extended = <&gpio1 18 IRQ_TYPE_LEVEL_LOW>;
>         status = "okay";
>     };
> 
>  # dmesg | grep mcp
> [    3.706085] mcp25xxfd spi1.0 can0: MCP2518FD rev0.0 (-RX_INT
> -MAB_NO_WARN +CRC_REG +CRC_RX +CRC_TX +ECC -HD c:20.00MHz m:8.50MHz
> r:8.50MHz e:0.00MHz) successfully initialized.

off-topic:
Variscite deploys a 20HHz oscillator, which brings the max spi frequency
down to +/- 8.5MHz.
After discussion with Thomas Kopp, I learned that microchip uses a 40MHz
oscillator, to arrive (close to) 20MHz spi freq.
Would you not use a 40MHz oscillator too?

> 
> I then up the CAN interface
> # ip link set can0 up type can bitrate 125000 sample-point 0.75
> dbitrate 500000 dsample-point 0.8 fd on

I see. On 125k, the 20MHz crystal is sufficient.

> 
> I am then able to send CAN frames using
> # cansend can0 123#42
> and CAN-FD frames using
> # cansend can0 123##042
> 
> These frames are successfully received on a connected PC using an PCAN-USB FD
> 
> Trying to send a CAN-FD frame with baud rate switch fails
> # cansend can0 123##142
> [  190.921477] mcp25xxfd spi1.0 can0: bus-off
> 
> Also receiving of any CAN frame doesn't work
> # candump any,0:0,#FFFFFFFF
> [  259.937612] spi_master spi1: I/O Error in DMA RX
> [  259.943743] mcp25xxfd spi1.0: SPI transfer failed: -110
> [  259.949644] spi_master spi1: failed to transfer one message from queue
> [  259.956566] mcp25xxfd spi1.0 can0: IRQ handler
> mcp25xxfd_handle_rxif() returned -110.
> [  259.964547] mcp25xxfd spi1.0 can0: IRQ handler returned -110
> (intf=0x3f1a0002).

There is something bizarre with the DMA implementation of imx.
The variscite device-tree's come with dma disabled in their SPI nodes,
using

	&ecspi1 {
		status = "okay";
		/delete-property/ dmas;
		/delete-property/ dma-names;
	};

Since I was struggling to consume 1Mbit, I tried to enable DMA again,
and ran into the same SPI tranfer failed. Disabling DMA fixes this.

This is a workaround.
and it works for me.

Kind regards,

> 
> My first thought was that the interrupts of the controller are not
> recognized by the iMX but /proc/interrupts shows that there are some
> of them
>  78:         10  gpio-mxc  18 Level     spi1.0
> 
> Any hints are greatly appreciated
> 
> 
> Regards
> 
> Matthias



[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