Bonjour a tous!!


j'ai acheter pour mon Raspberry ces composants :


Can spi click

Et

Pi click shield

Ce qui me donne ceci:

Nom : IMG_20140830_141214.jpg
Affichages : 106
Taille : 136,5 Ko


j'ai suivi cette procédure pour tenter de recompiler le noyau en ajoutant les option du CAN (en cross-compile avec Ubuntu):

http://elinux.org/RPi_CANBus

Dans cette procédure, une étape consiste a ajouter (et retirer) du code dans un fichier de configuration:

Code:
diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
index 838e0f2..10026ec 100644
--- a/arch/arm/mach-bcm2708/bcm2708.c
+++ b/arch/arm/mach-bcm2708/bcm2708.c
@@ -54,6 +54,12 @@
 #include <mach/vcio.h>
 #include <mach/system.h>
 
+#include <linux/can/platform/mcp251x.h>
+#include <linux/gpio.h>
+#include <linux/irq.h>
+
+#define MCP2515_CAN_INT_GPIO_PIN 25
+
 #include <linux/delay.h>
 
 #include "bcm2708.h"
@@ -586,11 +592,21 @@ static struct platform_device bcm2708_spi_device = {
 	.resource = bcm2708_spi_resources,
 };
 
+static struct mcp251x_platform_data mcp251x_info = {
+   .oscillator_frequency   = 20000000,
+   .board_specific_setup   = NULL,
+   .irq_flags              = IRQF_TRIGGER_FALLING|IRQF_ONESHOT,
+   .power_enable           = NULL,
+   .transceiver_enable     = NULL,
+};
+
 #ifdef CONFIG_SPI
 static struct spi_board_info bcm2708_spi_devices[] = {
 	{
-		.modalias = "spidev",
-		.max_speed_hz = 500000,
+		.modalias = "mcp2515",
+		.max_speed_hz = 10000000,
+		.platform_data = &mcp251x_info,
+		/* .irq = unknown , defined later thru bcm2708_mcp251x_init */
 		.bus_num = 0,
 		.chip_select = 0,
 		.mode = SPI_MODE_0,
@@ -602,6 +618,13 @@ static struct spi_board_info bcm2708_spi_devices[] = {
 		.mode = SPI_MODE_0,
 	}
 };
+
+static void __init bcm2708_mcp251x_init(void) {
+   bcm2708_spi_devices[0].irq = gpio_to_irq(MCP2515_CAN_INT_GPIO_PIN);
+   printk(KERN_INFO " BCM2708 mcp251x_init:  got IRQ %d for MCP2515\n", bcm2708_spi_devices[0].irq);
+   return;
+};
+
 #endif
 
 static struct resource bcm2708_bsc0_resources[] = {
@@ -749,6 +772,7 @@ void __init bcm2708_init(void)
 	system_serial_low = serial;
 
 #ifdef CONFIG_SPI
+	bcm2708_mcp251x_init();
 	spi_register_board_info(bcm2708_spi_devices,
 			ARRAY_SIZE(bcm2708_spi_devices));
 #endif
J'ai pris l'initiative de remplacer dans ce bout de code la definition :

Code:
+#define MCP2515_CAN_INT_GPIO_PIN 25
par

Code:
+#define MCP2515_CAN_INT_GPIO_PIN 11
(Puisque ma pin d'interruption est la 11, non?)

Et aussi

Code:
+   .oscillator_frequency   = 20000000,
par

Code:
+   .oscillator_frequency   = 10000000,
(Quartz de 10Mhz sur le CAN spi click)


Seulement, je ne parviens pas a compiler le noyau jusqu'au bout, il se passe toujours une erreur durant celle ci. Je ne suis pas certain de comprendre cette procédure a 100% et j'ai l'impression de me tromper quelque part...

Etant novice sous Linux, je voudrais savoir si il existe une autre méthode pour faire fonctionner cet ensemble ou alors mieux, que l'ont m'explique clairement celle ci....

Cordialement