Dear all,
We have been facing spi communication problem with MCP2515 CAN controller. MCP2515 was connected to SPI1 so we enabled MCP2515 in kernel configuration and made below device tree to probe this driver.
#include <dt-bindings/gpio/tegra186-gpio.h>
/ {
mcp2515_clock: mcp2515_clock {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <16000000>;
};
spi@c260000 {
status = "okay";
spi-max-frequency = <2000000>;
spi-mcp251x_0@0 {
status = "okay";
compatible = "microchip,mcp2515";
reg = <0>; /* spi chip select 0 */
interrupt-parent = <&tegra_main_gpio>;
interrupts = <TEGRA_MAIN_GPIO(I, 4) 0x01>; /* GPIO_PI4 */
clocks = <&mcp2515_clock>;
spi-max-frequency = <2000000>;
};
};
};
After reset manually by power off/on we could read CANSTAT register as 0x80 (reset default value) but CANCTRL value was not correct as reset default value. We did try to slow down spi speed to only 2MHz but it didn’t help.
It was seem we could not send the reset command to MCP2515 as below
/* Wait for oscillator startup timer after power up */
mdelay(MCP251X_OST_DELAY_MS);
priv->spi_tx_buf[0] = INSTRUCTION_RESET;
ret = mcp251x_spi_trans(spi, 1);
if (ret)
return ret;
Any suggestion would be appreciated.
Thanks and Best Regards,
Vu Nguyen