Hello all,
in the last two weeks I tried to set up a can with MCP2515 on my board , so far I have been partly successfull. BTW, vcan is running. I did everything like initialy, don't have a glue what I did wrong before.
Right now I am a confused about different things, I am quite sure not everything will sound usually for you either.
I am using 2012-10-28-wheezy-raspbian, kernel 3.2.27, bcm2708 patch as posted above by me but without oneshot (Gerd's Patch, modified for newer Raspbian version). I installed some more can modules during kernel build, shouldn't effect anything. I do have two versions for the hardware, both are attached. During troubleshooting I modified version 2, to make sure there is an automated full reset during powering. I put an resistor at the reset pin (10k) as well as a capacity (100nF) to reset and ground, like shown in the data sheet.
Following for version 2 HW:
I tried several times to set up a can, I always got following:
kernel buffer (searched for mcp only, directly after booting, no modules loaded)
- Code: Select all
[ 0.075801] BCM2708 mcp251x_init: got IRQ 195 for MCP2515
[ 11.464291] mcp251x spi0.0: MCP251x didn't enter in conf mode after reset
[ 11.481056] mcp251x spi0.0: CANSTAT 0x00 CANCTRL 0x00
[ 11.481084] mcp251x spi0.0: Probe failed
[ 11.494615] mcp251x spi0.0: probe failed
Today I tried to get the CAN running with a beamer on RCA video insted of using HDMI output. And it seemed like something was working. Unfortunatelly I am not able to reproduce it (do not have this equipment at home), but I got following without connecting any screen at all:
- Code: Select all
[ 0.075745] BCM2708 mcp251x_init: got IRQ 195 for MCP2515
[ 5.008309] bcm2708_spi bcm2708_spi.0: SPI Controller at 0x20204000 (irq 80)
[ 7.054187] mcp251x spi0.0: CANSTAT 0x06 CANCTRL 0x01
[ 7.054211] mcp251x spi0.0: Probe failed
[ 7.060858] mcp251x spi0.0: probe failed
[ 100.920990] can: controller area network core (rev 20090105 abi 8)
[ 107.083085] can: raw protocol (rev 20090105)
[ 109.584950] can: broadcast manager protocol (rev 20090105 t)
CANCTRL (st2) is not same every time. I saw in the driver for mcp (mcp251x) how st1 and st2 is defined as well as why the first "Probe failed" is shown. Below the part of the driver:
- Code: Select all
// Inserted by me: In line 626 to 645
static int mcp251x_hw_probe(struct spi_device *spi)
{
int st1, st2;
mcp251x_hw_reset(spi);
/*
* Please note that these are "magic values" based on after
* reset defaults taken from data sheet which allows us to see
* if we really have a chip on the bus (we avoid common all
* zeroes or all ones situations)
*/
st1 = mcp251x_read_reg(spi, CANSTAT) & 0xEE;
st2 = mcp251x_read_reg(spi, CANCTRL) & 0x17;
dev_dbg(&spi->dev, "CANSTAT 0x%02x CANCTRL 0x%02x\n", st1, st2);
/* Check for power up default values */
return (st1 == 0x80 && st2 == 0x07) ? 1 : 0;
}
// Inserted by me: In line 1019 to 1022
if (!mcp251x_hw_probe(spi)) {
dev_info(&spi->dev, "Probe failed\n");
goto error_probe;
}
// Inserted by me: In line 1028 to 1032
ret = register_candev(net);
if (!ret) {
dev_info(&spi->dev, "probed\n");
return ret;
}
So, my question is: Why is the HDMI reflecting on the reset state of the mcp? First I thought it is caused by the runtime for initialisation of the HDMI output, but I do not think so. Fact: The reset is called later (around 3s) in case there is an HDMI monitor plugged in. Did anybody modify something in the dirver itself? Was thinking about extending the waiting time (mdelay(10), line 614), but I do not think that is the way to go.
And no the weird part: HW version1. I tried this one longer ago, never worked (hence I build version 2). Today I thought I give it a shot because the screen thing. By accident I mixed up plus and ground of the adapter board and damaged it. For sure the transceiver is killed, do not know more about the damage so far. Afterward I tried it anyway, and it worked. I really do not get it, also with a HDMI screen pluged in. And in case I DO NOT POWER this board (no 3V3 or ground connected) I get the same messages as if it would be powered (no failures in kernel buffer, correct st1 and st2, etc.), and I am able to set up can0. Afterward I tried again the other board (V2) or without anything conncted, still get the message "MCP251x didn't enter in conf mode after reset".
Board version1, not powered and powered:
kernel buffer (mcp,spi,can):
- Code: Select all
[ 0.075819] BCM2708 mcp251x_init: got IRQ 195 for MCP2515
[ 9.745031] bcm2708_spi bcm2708_spi.0: SPI Controller at 0x20204000 (irq 80)
[ 11.854439] CAN device driver interface
[ 11.905886] mcp251x spi0.0: CANSTAT 0x80 CANCTRL 0x07
[ 11.907823] mcp251x spi0.0: probed
[ 27.616026] mcp251x spi0.0: bit-timing not yet defined
[ 27.616058] mcp251x spi0.0: unable to set initial baudrate!
[ 27.616436] mcp251x spi0.0: bit-timing not yet defined
[ 27.616460] mcp251x spi0.0: unable to set initial baudrate!
[ 27.616506] mcp251x spi0.0: bit-timing not yet defined
[ 27.616521] mcp251x spi0.0: unable to set initial baudrate!
[ 27.616566] mcp251x spi0.0: bit-timing not yet defined
[ 27.616582] mcp251x spi0.0: unable to set initial baudrate!
[ 27.616623] mcp251x spi0.0: bit-timing not yet defined
[ 27.616638] mcp251x spi0.0: unable to set initial baudrate!
[ 28.718680] mcp251x spi0.0: bit-timing not yet defined
[ 28.718712] mcp251x spi0.0: unable to set initial baudrate!
[ 29.719939] mcp251x spi0.0: bit-timing not yet defined
[ 29.719971] mcp251x spi0.0: unable to set initial baudrate!
[ 30.721197] mcp251x spi0.0: bit-timing not yet defined
[ 30.721223] mcp251x spi0.0: unable to set initial baudrate!
[ 31.722415] mcp251x spi0.0: bit-timing not yet defined
[ 31.722447] mcp251x spi0.0: unable to set initial baudrate!
[ 32.723646] mcp251x spi0.0: bit-timing not yet defined
[ 32.723678] mcp251x spi0.0: unable to set initial baudrate!
[ 33.724898] mcp251x spi0.0: bit-timing not yet defined
[ 33.724931] mcp251x spi0.0: unable to set initial baudrate!
[ 34.726123] mcp251x spi0.0: bit-timing not yet defined
[ 34.726154] mcp251x spi0.0: unable to set initial baudrate!
[ 35.727346] mcp251x spi0.0: bit-timing not yet defined
[ 35.727377] mcp251x spi0.0: unable to set initial baudrate!
[ 36.728570] mcp251x spi0.0: bit-timing not yet defined
[ 36.728605] mcp251x spi0.0: unable to set initial baudrate!
[ 37.729792] mcp251x spi0.0: bit-timing not yet defined
[ 37.729822] mcp251x spi0.0: unable to set initial baudrate!
[ 38.731044] mcp251x spi0.0: bit-timing not yet defined
[ 38.731078] mcp251x spi0.0: unable to set initial baudrate!
[ 39.732353] mcp251x spi0.0: bit-timing not yet defined
[ 39.732381] mcp251x spi0.0: unable to set initial baudrate!
[ 40.733601] mcp251x spi0.0: bit-timing not yet defined
[ 40.733631] mcp251x spi0.0: unable to set initial baudrate!
[ 41.734859] mcp251x spi0.0: bit-timing not yet defined
[ 41.734889] mcp251x spi0.0: unable to set initial baudrate!
[ 42.736078] mcp251x spi0.0: bit-timing not yet defined
[ 42.736109] mcp251x spi0.0: unable to set initial baudrate!
[ 43.737294] mcp251x spi0.0: bit-timing not yet defined
[ 43.737321] mcp251x spi0.0: unable to set initial baudrate!
[ 44.738501] mcp251x spi0.0: bit-timing not yet defined
[ 44.738530] mcp251x spi0.0: unable to set initial baudrate!
[ 45.739708] mcp251x spi0.0: bit-timing not yet defined
[ 45.739735] mcp251x spi0.0: unable to set initial baudrate!
[ 46.740912] mcp251x spi0.0: bit-timing not yet defined
[ 46.740940] mcp251x spi0.0: unable to set initial baudrate!
[ 47.742123] mcp251x spi0.0: bit-timing not yet defined
[ 47.742157] mcp251x spi0.0: unable to set initial baudrate!
[ 48.743417] mcp251x spi0.0: bit-timing not yet defined
[ 48.743448] mcp251x spi0.0: unable to set initial baudrate!
[ 49.744643] mcp251x spi0.0: bit-timing not yet defined
[ 49.744675] mcp251x spi0.0: unable to set initial baudrate!
[ 50.745894] mcp251x spi0.0: bit-timing not yet defined
[ 50.745927] mcp251x spi0.0: unable to set initial baudrate!
[ 51.747106] mcp251x spi0.0: bit-timing not yet defined
[ 51.747137] mcp251x spi0.0: unable to set initial baudrate!
[ 52.748316] mcp251x spi0.0: bit-timing not yet defined
[ 52.748347] mcp251x spi0.0: unable to set initial baudrate!
[ 53.749538] mcp251x spi0.0: bit-timing not yet defined
[ 53.749565] mcp251x spi0.0: unable to set initial baudrate!
[ 54.750747] mcp251x spi0.0: bit-timing not yet defined
[ 54.750778] mcp251x spi0.0: unable to set initial baudrate!
[ 55.751945] mcp251x spi0.0: bit-timing not yet defined
[ 55.751976] mcp251x spi0.0: unable to set initial baudrate!
[ 56.753144] mcp251x spi0.0: bit-timing not yet defined
[ 56.753173] mcp251x spi0.0: unable to set initial baudrate!
[ 57.754351] mcp251x spi0.0: bit-timing not yet defined
[ 57.754378] mcp251x spi0.0: unable to set initial baudrate!
[ 58.755558] mcp251x spi0.0: bit-timing not yet defined
[ 58.755586] mcp251x spi0.0: unable to set initial baudrate!
[ 59.756778] mcp251x spi0.0: bit-timing not yet defined
[ 59.756807] mcp251x spi0.0: unable to set initial baudrate!
[ 60.757987] mcp251x spi0.0: bit-timing not yet defined
[ 60.758019] mcp251x spi0.0: unable to set initial baudrate!
[ 61.759188] mcp251x spi0.0: bit-timing not yet defined
[ 61.759215] mcp251x spi0.0: unable to set initial baudrate!
[ 62.760428] mcp251x spi0.0: bit-timing not yet defined
[ 62.760457] mcp251x spi0.0: unable to set initial baudrate!
[ 63.761645] mcp251x spi0.0: bit-timing not yet defined
[ 63.761675] mcp251x spi0.0: unable to set initial baudrate!
[ 64.762877] mcp251x spi0.0: bit-timing not yet defined
[ 64.762908] mcp251x spi0.0: unable to set initial baudrate!
[ 65.764091] mcp251x spi0.0: bit-timing not yet defined
[ 65.764119] mcp251x spi0.0: unable to set initial baudrate!
[ 66.765305] mcp251x spi0.0: bit-timing not yet defined
[ 66.765333] mcp251x spi0.0: unable to set initial baudrate!
[ 66.904472] can: controller area network core (rev 20090105 abi 8)
[ 67.766511] mcp251x spi0.0: bit-timing not yet defined
[ 67.766541] mcp251x spi0.0: unable to set initial baudrate!
[ 68.767728] mcp251x spi0.0: bit-timing not yet defined
[ 68.767791] mcp251x spi0.0: unable to set initial baudrate!
[ 69.768998] mcp251x spi0.0: bit-timing not yet defined
[ 69.769028] mcp251x spi0.0: unable to set initial baudrate!
[ 70.770212] mcp251x spi0.0: bit-timing not yet defined
[ 70.770246] mcp251x spi0.0: unable to set initial baudrate!
[ 71.771471] mcp251x spi0.0: bit-timing not yet defined
[ 71.771500] mcp251x spi0.0: unable to set initial baudrate!
[ 71.979901] can: raw protocol (rev 20090105)
[ 72.772687] mcp251x spi0.0: bit-timing not yet defined
[ 72.772715] mcp251x spi0.0: unable to set initial baudrate!
[ 73.773898] mcp251x spi0.0: bit-timing not yet defined
[ 73.773925] mcp251x spi0.0: unable to set initial baudrate!
[ 74.159007] can: broadcast manager protocol (rev 20090105 t)
[ 74.775119] mcp251x spi0.0: bit-timing not yet defined
[ 74.775149] mcp251x spi0.0: unable to set initial baudrate!
[ 75.776339] mcp251x spi0.0: bit-timing not yet defined
[ 75.776366] mcp251x spi0.0: unable to set initial baudrate!
[ 76.777548] mcp251x spi0.0: bit-timing not yet defined
[ 76.777576] mcp251x spi0.0: unable to set initial baudrate!
[ 77.778767] mcp251x spi0.0: bit-timing not yet defined
[ 77.778796] mcp251x spi0.0: unable to set initial baudrate!
[ 78.779976] mcp251x spi0.0: bit-timing not yet defined
[ 78.780004] mcp251x spi0.0: unable to set initial baudrate!
[ 79.781193] mcp251x spi0.0: bit-timing not yet defined
[ 79.781221] mcp251x spi0.0: unable to set initial baudrate!
[ 80.782393] mcp251x spi0.0: bit-timing not yet defined
[ 80.782424] mcp251x spi0.0: unable to set initial baudrate!
[ 81.783606] mcp251x spi0.0: bit-timing not yet defined
[ 81.783633] mcp251x spi0.0: unable to set initial baudrate!
[ 82.784805] mcp251x spi0.0: bit-timing not yet defined
[ 82.784831] mcp251x spi0.0: unable to set initial baudrate!
[ 83.786020] mcp251x spi0.0: bit-timing not yet defined
[ 83.786047] mcp251x spi0.0: unable to set initial baudrate!
[ 84.787243] mcp251x spi0.0: bit-timing not yet defined
[ 84.787271] mcp251x spi0.0: unable to set initial baudrate!
[ 85.788444] mcp251x spi0.0: bit-timing not yet defined
[ 85.788475] mcp251x spi0.0: unable to set initial baudrate!
[ 86.789651] mcp251x spi0.0: bit-timing not yet defined
[ 86.789679] mcp251x spi0.0: unable to set initial baudrate!
[ 87.790850] mcp251x spi0.0: bit-timing not yet defined
[ 87.790880] mcp251x spi0.0: unable to set initial baudrate!
[ 88.792057] mcp251x spi0.0: bit-timing not yet defined
[ 88.792085] mcp251x spi0.0: unable to set initial baudrate!
[ 89.793285] mcp251x spi0.0: bit-timing not yet defined
[ 89.793315] mcp251x spi0.0: unable to set initial baudrate!
[ 90.025098] mcp251x spi0.0: bit-timing not yet defined
[ 90.025131] mcp251x spi0.0: unable to set initial baudrate!
[ 90.794515] mcp251x spi0.0: bit-timing not yet defined
[ 90.794544] mcp251x spi0.0: unable to set initial baudrate!
[ 91.795732] mcp251x spi0.0: bit-timing not yet defined
[ 91.795761] mcp251x spi0.0: unable to set initial baudrate!
[ 92.796937] mcp251x spi0.0: bit-timing not yet defined
[ 92.797001] mcp251x spi0.0: unable to set initial baudrate!
[ 93.798180] mcp251x spi0.0: bit-timing not yet defined
[ 93.798208] mcp251x spi0.0: unable to set initial baudrate!
[ 94.799392] mcp251x spi0.0: bit-timing not yet defined
[ 94.799420] mcp251x spi0.0: unable to set initial baudrate!
[ 95.800609] mcp251x spi0.0: bit-timing not yet defined
[ 95.800638] mcp251x spi0.0: unable to set initial baudrate!
[ 96.283218] mcp251x spi0.0: CNF: 0x00 0xb5 0x01
Interrupt protocol:
- Code: Select all
CPU0
3: 5351 ARMCTRL BCM2708 Timer Tick
32: 125974 ARMCTRL dwc_otg, dwc_otg_pcd, dwc_otg_hcd:usb1
52: 0 ARMCTRL BCM2708 GPIO catchall handler
65: 309 ARMCTRL ARM Mailbox IRQ
66: 1 ARMCTRL VCHIQ doorbell
75: 1 ARMCTRL
77: 6871 ARMCTRL bcm2708_sdhci (dma)
80: 36 ARMCTRL bcm2708_spi.0
83: 20 ARMCTRL uart-pl011
84: 9197 ARMCTRL mmc0
195: 0 GPIO mcp251x
FIQ: usb_fiq
Err: 0
show CAN:
- Code: Select all
3: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 10
link/can
can state ERROR-ACTIVE restart-ms 0
bitrate 500000 sample-point 0.875
tq 125 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
mcp251x: tseg1 3..16 tseg2 2..8 sjw 1..4 brp 1..64 brp-inc 1
clock 8000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 0 0 0
RX: bytes packets errors dropped overrun mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0
I really do appreciate any help very much. Right now I am reall confused. First I thought maybe the bulk capacitor is to big, but it is partly working without a HDMI. Version 1 is damaged and everything seems to be working fine (except the CAN itself (ERROR-Active)) on MCP2515 side.
I wish you all nice Christmas holidays! Thank you very much for the help in advance.
Take care
Chris