MCP2515 module usage with iMX6 and Aster

Dear Support,

I’m trying to use an SPI connected MCP2515 arduino module with Colibri iMX6DL V1.1A and Aster V1.1B.
The module (http://henrysbench.capnfatz.com/henrys-bench/arduino-projects-tips-and-more/arduino-can-bus-module-pin-outs-and-schematics/) uses MCP2515 controller and TJA1050 transceiver.

The module was connected to the SPI bus exposed on Aster’s X18 connector and was powered from X15 GND/V_IOREF. Although it was recognised by the linux (Angstrom, latest) for the first try I did not have any success with the module to send or receive CAN messages. Then, by investigating the schematics of the Colibri Eval board I found that you use 16MHz crystal for the MCP2515.
Changing the crystal from 8MHz to 16MHz on the module and changing the JP2 to provide 5V to the V_IOREF, from where the module is also powered, and to set up proper level shifting, it is possible now to send out one can message to the bus (after proper can interface init). This message properly arrives to the other node, however no other message could be sent out from the board and no message could be captured at all.

Interestingly, based on the ifconfig output the can0 RX and TX counters are not changing.

The only difference in my setup with Aster compared to the eval board’s solution (excluding the transceiver, which is not relevant from the issue perspective) is that I cannot connect the module to the CAN_INT signal as this line is not exposed on the Aster.

Could you please let me know that based on your driver support to the SPI connected MCP2515, how an external module should be connected to the Aster board and what other configuration would be necessary to properly operate it?

Thank you in advance

hi @akabai

Could you provide the Software version ( uname -a ) of your module?
How did you connect the mcp2515 to the Aster Board? Could you provide a schematic diagram?
According to the MCP251x Driver Documentation ( Documentation/devicetree/bindings/net/can/microchip,mcp251x.txt ) the IRQ Pin is needed. If this is not populated on Aster Board, then you can take a different pin and define this correctly in the Device tree?

Best regards, Jaski

Hi,

uname -a:
Linux colibri-imx6 4.1.44-2.7.4+gb1555bf #1 SMP Wed Oct 4 22:20:42 UTC 2017 armv7l GNU/Linux

Connection:
Module SCK → Aster X18.6 UNO_SPI_SCK
Module SI → Aster X18.4 UNO_SPI_MOSI
Module SO → Aster X18.5 UNO_SPI_MISO
Module CS → Aster X18.3 UNO_SPI_CS
Module GND → Aster X15.6 GND
Module VCC → Aster X15.2 VCC_IOREF

JP2 → IOREF

Does it look like ok?
What would be the recommendation for an alternate IRQ pin?

Thanks for the Information. The connections seem to be OK. For IRQ you can take a PIN which is on the Aster Carrier Board and which is not used for your Project.

hello @jaski.tx,

I’ve checked the eval board’s device tree, where the given HW is configured:
http://git.toradex.com/cgit/linux-toradex.git/tree/arch/arm/boot/dts/imx6dl-colibri-cam-eval-v3.dts?h=Colibri-iMX6_LXDE-Image_2.8b5.156-20181228#n108
The idea would be to use this configuration in the Aster’s device tree, however I didn’t manage to correlate the eval board’s working config to the schematic and I’m a bit confused on the details which should be used in the Aster’s config in order to map the IRQ e.g. to the UNO_GPIO8 / SODIMM_67.

Could you please help me further investigating this issue and figuring out the right config?

SODIMM67 can be muxed to GPIO1_IO01 or GPIO2_IO17 and not GPIO8. You can find this Information in the Datasheet or pin configuration ( ./arch/arm/boot/dts/imx6dl-pinfunc.h ).

Let me answer my own question, it seems the DTS was correct, we had another configuration problem, which is resolved now. For future reference, this is the working configuration:

Module -	Aster board
INT -	X17.5 (GPIO)
SCK	-	X18.6 (SPI_CLK)
SI	-	X18.4 (SPI_MOSI)
SO	-	X18.5 (SPI_MISO)
CS	-	X18.3 (SPI_CS)
GND	-	X15.6 (GND)
VCC	-	X15.2 (IOREF)

With the following diff for imx6dl-colibri-aster.dts:


83a84,96
> / {
> 	clocks {
> 		/* fixed crystal dedicated to mcp251x */
> 		clk16m: clk@1 {
> 			compatible = "fixed-clock";
> 			reg=<1>;
> 			#clock-cells = <0>;
> 			clock-frequency = <16000000>;
> 			clock-output-names = "clk16m";
> 		};
> 	};
> };
> 
93a107,116
>         mcp258x0: mcp258x@1 {
>                 compatible = "microchip,mcp2515";
>                 reg = <0>;
>                 clocks = <&clk16m>;
>                 interrupt-parent = <&gpio2>;
>                 interrupts = <3 0x2>;
>                 spi-max-frequency = <10000000>;
>                 status = "okay";
>         };
> 
97a121
> 		status = "disabled";
148c171
< 		&pinctrl_weim_gpio_5 &pinctrl_weim_gpio_6
---
> 		&pinctrl_weim_gpio_5
151d173
< 		&pinctrl_gpio_2
171a217,224
> &can1 {
> 	status = "disabled";
> };
> 
> &can2 {
> 	status = "disabled";
> };
> 

Hi @jaski.tx,

I’m working together with @akabai, we tried to map IRQ to several pins which have an available SODIMM connection on the Aster board. We used the attached DTS (configured for GPIO2_IO03 → Aster X17.5), but it seems that it is still not working. Could you please help us identify what could be the problem?

Thanks in advance!

Perfect that it works. Thanks for your Input.