1

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.

2

1 Answer 1

3

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!).

6
  • 1
    This 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
    Apr 18, 2018 at 22:05
  • @Majenko I thought arduino only had 1 spi bus? 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
    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.com 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
    Apr 18, 2018 at 22:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.