So what I'm trying to do is use the ArduCAM OV2640 (2MP Mini) to take a timelapse. Of course the first thing I have to do it to get it to take a picture and write it to an SD card. The thing is, the camera works fine by itself, however when I hook up the SD card something happens where the SPI no longer works (I have a general understanding of how SPI works -- not a highly technical understanding though).
So my main question is if it's possible for a device using SPI to 'use up' the entire SPI bus so that other peripheral devices can't interact with the microcontroller?
And if so, is there any software or way to visualize this? Like something that monitors the SPI bus?
And as for how to actually fix the problem, would it be practical to use a shield with a built in SD card module? Or use a logic gate to determine which device to allow access?
I really don't have the greatest understanding of this, so any help would be appreciated.
EDIT:
I'm using this camera module with this sd card module. As for my wireup, the camera follows as below: Camera Schematic
The common pins between the SD card module and camera are VCC,GND,MISO (pin 12) , MOSI (pin 11), and SCK (pin 13). I have an individual CS pin for each.
-
What exactly are the used modules and your wireup? You could maybe have the same problem as described in arduino.stackexchange.com/questions/43707/multiple-spi-device/….Maximilian Gerhardt– Maximilian Gerhardt04/18/2018 21:18:10Commented Apr 18, 2018 at 21:18
-
I'll take a look at the link you referenced, and I have updated my post with wireups/modules. Also, should I be using resistors?Luke Thistlethwaite– Luke Thistlethwaite04/18/2018 21:29:07Commented Apr 18, 2018 at 21:29
1 Answer 1
In this case, I don't think that a device is "using SPI to 'use up' the entire SPI bus so that other peripheral devices can't interact with the microcontroller". I think that your problem probably lies with how your SD card is connecting via the SPI bus.
The problem is that a lot of Serial Peripheral Interface (SPI) devices, particularly the cheaper ones, don't properly put the MISO pin into high-impedance when SS is pulled high.
I had almost exactly this situation with one of my projects. I eventually resolved it by placing a tri-state buffer in the MISO line for each of the SPI devices.
In that case, I used a 74HC125 (4-channel tri-state buffer).
This is the page on Better SPI Bus Design in 3 steps that finally got me on the right track. I think the explanations are reasonably clear (at least compared with many other sites I found!).
-
1This is very common with SD cards. I always use a separate SPI bus for SD cards (and of course an MCU with multiple SPI buses).Majenko– Majenko04/18/2018 22:05:03Commented Apr 18, 2018 at 22:05
-
@Majenko I thought arduino only had 1 spi bus?Luke Thistlethwaite– Luke Thistlethwaite04/18/2018 22:21:47Commented Apr 18, 2018 at 22:21
-
@LukeThistlethwaite Many Arduino branded boards have only one SPI bus. There are a myriad of other options though, some with many SPI busses (one I use regularly has 4 busses).Majenko– Majenko04/18/2018 22:22:41Commented Apr 18, 2018 at 22:22
-
@Majenko My bad, I just thought that you were referencing an arduino board since, after all, this is arduino.stackexchange.comLuke Thistlethwaite– Luke Thistlethwaite04/18/2018 22:28:48Commented Apr 18, 2018 at 22:28
-
1@LukeThistlethwaite There are Arduino boards with multiple SPI busses.Generally the ARM based boards like the Arduino Due.Majenko– Majenko04/18/2018 22:29:34Commented Apr 18, 2018 at 22:29