(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
-
1Maybe it have similarity to this: arduino.stackexchange.com/questions/31924/… - the uninitialized device can brind the bus to some bad state, as it does not care about the bus at allgilhad– gilhad2017年03月07日 11:20:02 +00:00Commented Mar 7, 2017 at 11:20
-
2Would need a reference/link to the shield and schematics to answer that.Mikael Patel– Mikael Patel2017年03月07日 13:17:15 +00:00Commented Mar 7, 2017 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– Code Gorilla2017年03月07日 13:30:07 +00:00Commented Mar 7, 2017 at 13:30
-
@MikaelPatel elecfreaks.com/estore/can-bus-shield.html This is the product; there is Resource tab with Schematics linkJaroslav Záruba– Jaroslav Záruba2017年03月07日 13:59:07 +00:00Commented Mar 7, 2017 at 13:59
-
1J. 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 completeJames Waldby - jwpat7– James Waldby - jwpat72017年03月07日 17:03:06 +00:00Commented Mar 7, 2017 at 17:03
1 Answer 1
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.
-
CAN-Shield: elecfreaks.com/estore/can-bus-shield.html [Resources -> Schematics]Jaroslav Záruba– Jaroslav Záruba2017年03月07日 14:03:52 +00:00Commented Mar 7, 2017 at 14:03
-
SD-card: ebay.com/itm/161366316226?_trksid=p2057872.m2749.l2649 I can't seem to find more info on this little bugger.Jaroslav Záruba– Jaroslav Záruba2017年03月07日 14:05:02 +00:00Commented Mar 7, 2017 at 14:05
-
Need a schematic of the SD card to know how the 74LVC125A is wired up - is it buffering the DO pin of the SD card or not?Majenko– Majenko2017年03月07日 14:07:18 +00:00Commented Mar 7, 2017 at 14:07
-
Unfortunately I can't find any vendor name on that thing, or a product page... The link above is all I could find.Jaroslav Záruba– Jaroslav Záruba2017年03月07日 14:37:28 +00:00Commented Mar 7, 2017 at 14:37
-
1Then you would have to reverse engineer it. Shouldn't be hard with a DMM.Majenko– Majenko2017年03月07日 15:36:45 +00:00Commented Mar 7, 2017 at 15:36