0

(I am able to successfully initialize CAN-Bus shield and SD-card module w/ card in it.)

Now I have removed all code related to the SD-card module, yet I left the module (without the card in it) physically connected. This results in the CAN-Bus shield initialization failing.
When I insert the card into the SD-card module the CAN-Bus shield initializes successfully. (I am still not doing SD-card module initialization.)

Of course, I can just disconnect the SD-card module or leave the card in it... But I am trying to understand this black magic.

I have connected the SD-card module CS to pin 8, the CAN-Bus shield clone CS is connected to pin 10. I tried to set the SD-card module CS pin to OUTPUT and to HIGH. That had no effect.

the CAN-Bus shield + schematics: http://www.elecfreaks.com/estore/can-bus-shield.html [Resource -> Schematics]
the SD-card module: https://ebay.com/itm/161366316226?_trksid=p2057872.m2749.l2649

  • 1
    Maybe it have similarity to this: http://arduino.stackexchange.com/questions/31924/how-to-setup-an-i2c-bus-which-stays-valid-if-a-slave-is-powered-down-or-fails - the uninitialized device can brind the bus to some bad state, as it does not care about the bus at all – gilhad Mar 07 '17 at 11:20
  • 2
    Would need a reference/link to the shield and schematics to answer that. – Mikael Patel Mar 07 '17 at 13:17
  • I think the SD-Card and the CAN Bus shield use the same pin and that is the problem. I read that on a post on here last week. – Code Gorilla Mar 07 '17 at 13:30
  • @MikaelPatel http://www.elecfreaks.com/estore/can-bus-shield.html This is the product; there is Resource tab with Schematics link – Jaroslav Záruba Mar 07 '17 at 13:59
  • @Matt Could be it. Maybe it would explain why I am not able to log any messages when actually connecting the whole ball of wires to the OBD2 access port. When testing on my PC both devices report "init OK" but then in the car I get no messages. Despite the wildly blinking LED on the shield. (That's why I stripped all the SD-card code in the first place.) – Jaroslav Záruba Mar 07 '17 at 14:01
  • Here is the post, I knew I read it :) http://arduino.stackexchange.com/questions/35198/can-bus-shield-sd-card-module-led-builtin-use-d13-possible-collision/35223#35223 – Code Gorilla Mar 07 '17 at 14:40
  • @Matt :)) That was me asking. My understanding is the only pin on the SD-card module I can (and have to) "move around" is the CS. So I moved it to 8. – Jaroslav Záruba Mar 07 '17 at 15:05
  • @Matt From what I understand the rest of the pins are supposed to be shared, i.e. it should not be an issue. – Jaroslav Záruba Mar 07 '17 at 15:09
  • 1
    J. Z., please edit the info from your first two comments here and from your comments to Majenko's answer into the question ... more likely to get upvoted if question is more complete – James Waldby - jwpat7 Mar 07 '17 at 17:03
  • fixed the shield url – Jaroslav Záruba Mar 08 '17 at 11:15

1 Answers1

2

Without seeing schematics this is purely supposition:

My guess is that the SD shield contains bi-directional level shifting. The MISO pin, which connects the DO pin of the SD card to the MCU, will have a 3.3V -> 5V level translator on it. This, with no SD card inserted, will be floating (flapping around in the breeze) causing the output of the level translator to randomly produce digital signals on the MISO pin. These signals interfere with the MISO signals from your CAN shield.

How best to cure the problem very much depends on what level shifting is in the circuit and how it is controlled and wired. For that we will need to see schematics of both the CAN and SD card shields.

Majenko
  • 105,095
  • 5
  • 79
  • 137