Hi,
i almost managed it working.
The kernel module recognizes the device, I can set the speed, but I cannot hook it up to a gpio interrupt.
My setting in /boot/script.fex are:
[spi_board0]
modalias="mcp2515"
max_speed_hz=16000000
bus_num=2
chip_select=0
mode=3
full_duplex=0
manual_cs=0
irq_gpio=28
...
[gpio_para]
...
gpio_pin_28=port:PH15<6><default><default><default>
I soldered the mcp2515 INT pin to a20 som evb GPIO3 pin23 which is
LCD1_D15/AT D1 /KP_IN5/SMC_VP P /EINT15/CSI1_D15/PH15
In /proc/interrupts I see
175: 0 0 gpio-sunxi mcp251x
In /sys/kernel/debug/gpio
gpio-28 ( ) in hi
Please explain somebody how can I manage to trigger the interrupt on falling edge?
I am completely confused and lost.
I spent weeks to solve this problem from my holiday.
Thanks in advance!
I finally hardcoded the gpio and the irq into the mcp251x.c kernel module and voilá, perfection. It runs flawlessly on 1 megabit.
Quote from: AzHofi on August 11, 2014, 10:02:27 AM
I finally hardcoded the gpio and the irq into the mcp251x.c kernel module and voilá, perfection. It runs flawlessly on 1 megabit.
Hi AzHofi,
Do you mind to share the code or just the diff of mcp251x.c kernel module?
Thanks
Quote from: cssvb94 on August 11, 2014, 11:44:59 AMDo you mind to share the code or just the diff of mcp251x.c kernel module?
Sure, here is it, simple like a slap:
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index 9d60742..ecde5c1 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -68,6 +68,7 @@
#include <linux/io.h>
+#include <linux/gpio.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netdevice.h>
@@ -937,7 +938,7 @@ static int mcp251x_open(struct net_device *net)
priv->force_quit = 0;
priv->tx_skb = NULL;
priv->tx_len = 0;
-
+ spi->irq = gpio_to_irq(28);
Thanks man ;D
Hi AzHofi,
I am using the same mcp2515, it is using PI14 and SPI from UEXT2 on a A20-OLinuXino-MICRO board.
I changed fex file like this :
[spi_board0]
modalias="mcp2515"
max_speed_hz=16000000
bus_num=2
chip_select=0
mode=3
full_duplex=0
manual_cs=0
irq_gpio=13
[gpio_para]
...
gpio_pin_13 = port:PI14<5><default><default><default>
...
I restarted board and have a look at /proc/interrupts but I cannot see anything from mcp251x :-(
I have recompiled kernel to support MCP2515 but still without success...
thank you for your help
Denis
Dear Denis,
I suggest what I did, hardcode the irq into the mcp251x kernel module and recompilate
the kernel.
Quote from: morind79 on September 12, 2014, 03:17:26 PM
Hi AzHofi,
I am using the same mcp2515, it is using PI14 and SPI from UEXT2 on a A20-OLinuXino-MICRO board.
I changed fex file like this :
...
I restarted board and have a look at /proc/interrupts but I cannot see anything from mcp251x :-(
I have recompiled kernel to support MCP2515 but still without success...