Connecting MCP2515 via SPI for CAN driver with Android kernel 4.9

Hi @rubberduck203,
Hi @doitright,

I added a level shifter (TXS0108e) but it is always not working .
in the kernel logs it says always

Cannot initialize MCP2515. Wrong wiring?
Probe failed, err=19

would you mind checking my connection (see below picture). may be i missing again something !

Thx
Hatem

I think you have master out connected to slave out and master in -> slave in.

1 Like

I think that @rubberduck203 is right. Flip them.

SPI_DO --> SI
SPI_DI <-- SO

And do keep in mind the potential for your having damaged the SoC when feeding it 5V. If it still doesn’t work, then you may need a logic probe to track down where the problem is.

Edit: And make sure that you are aware of how the “OE” pin on the level shifter works. Depending on how that board is wired up, you may need to drive that pin high (1.8v). See the “simplified application” diagram on the first page of the txs0108 datasheet: http://www.ti.com/lit/ds/symlink/txs0108e.pdf

The diagram shows 3 passives: 2 capacitors, and a pull-down resistor. That is consistent with the passives I see on your picture. If that resistor is a pull down, then you will need to drive it high to turn the chip on.

1 Like

@doitright @rubberduck203 thanks a lot for your prompt answers.
@doitright how can I check if the soc is damaged.
And in case it is damaged is it only the gpio which were connected to 5v or it may be more then that.

Regards
Hatem

Well checking if its damaged, comes down to this; if there is data on the wire and it doesn’t read it, its damaged. Also, if it attempts to write data to the wire, and it doesn’t end up there, it is damaged. That is why you might need a logic probe – to see if the bus is behaving correctly, and to check if it is still behaving correctly on the other side of the logic shifter.

Any of the pins to which you hooked up 5V could be damaged. I can’t give you any indication about how deeply it could be damaged (or even if it has been, did you try reversing the data pins yet?). This may depend on how much current it supplied, how long the 5V was connected to it, how the SoC is constructed, etc.

The easiest way to test it would be to see if it works on a different board. If one board works, and the other doesn’t, then you have something wrong with the one that isn’t working.

1 Like

HI @doitright @rubberduck203 :slight_smile:

I have a good news :slight_smile: it is working . I changed the connections for in and out and put EO to 1.8v
now i see in the kernel log

[33mmcp251x spi32766.0 can0e[0m: MCP2515 successfully initialized.

second good news :slight_smile: SOC is not damaged.

my new wiring:

thx
Hatem

2 Likes

Hi again :slight_smile:
Do you know if I have to use a termination resistor (jumper J1) to be able to communicate with other devices ? or it is not mandatory ?
I am trying to communicate with a raspberry + pican2 but it is not working.
thanks
Hatem

http://www.ni.com/white-paper/9759/en/#toc2

Looks like both “end” devices on the line need termination, but devices connected between the two ends do not. That means that if you are trying to connect just two devices to each other, then since they are both “ends”, they should both have terminations.

1 Like

Hi @doitright , thanks . it is working now . in my two can interfaces i already have the 120ohm resistors built in . i needed only to put the jumpers to enable them.