More SPI Problems

Hi guys, I need a little advice (again). I am using a SPI camera and a nRF24L01 which is SPI. The camera is a hacked VC0706, hacked because I broke out the SPI bus by soldering very small wires to the SPI pins of the VC0706 DSP chip and altered the Adafruit library so that I can grab the fram buffer using SPI.

In isolation, this works really well, it now takes under a second to get a 640x480 image instead of 24 seconds using uart!

My issue is that I need to send the image in 32 byte chunks using a nRF24L01. The nRF24L01 uses SPI also and initially I thought it wouldn't be an issue using both devices on the same SPI bus being as that's what SPI is designed to do, simply set the SS pin of the device to be used at that time low and all the other devices high, easy stuff.

The problem is that when I try to load up the nRF24L01 transmit buffer using SPI, I set the ss pin for the VC0706 Hgh, then the SS pin for the nRF24L01 Low, then try and send the bytes to the nRF24L01 but with the VC0706 plugged in it don't work, the bytes don't get as far as the nRF24L01.

If I change nothing in the software but physically unplug MOSI and MISO of the VC0706 from the arduino, the comms to the nRF24L01 works fine.

I have to think that the VC0706 is not honouring its SS pin and is somehow corrupting the SPI bus comms.

I am in a bit of a quandry as I concider I am not using the camera within spec and so maybe I can't rely on it's SPI to work as expected, or maybe I'm doing something wrong.

At any rate I thought that maybe I can solve this another way. I decided that maybe I can use the SS pin of the nRF24L01 to control a component that could break the miso and/or mosi lines of the VC0706 when it is low.I thought I could use a transistor for this but I'm not sure how that could be done.

It seems that you can use a transistor as a switch but in my mind a switch is a circuit breaker, but all the 'transistor as a switch' circuit diagrams I have seen connect the emitter to ground, I want to connect the emitter to pin 12(MISO) and the collector to the MISO of the VC0706 so that when the nRF24L01 SS pin goes low, it breaks the MISO wire for the VC0706, thus allowing propper comms on the SPI between arduino and nRF24L01.

So, firstly, my knowledge of electronics is poor as you may have guessed, I don't know what component I need to use to disconnect the VC0706 SPI lines on demand. Also, I don't know why this damn VC0706 is not honoring its SS.

If anyone has any advice or experience with these cameras then I would love to hear your opinion, also, if you know what component I would use to achieve what I am trying to do then also please let me know.

Thanks you guys, kind regards, Rick.

If the MISO line from your device is not behaving, you should think about using a tri-state buffer instead of a transistor. Here are a few examples. http://www.onsemi.com/PowerSolutions/product.do?id=NL17SZ126 https://www.futurlec.com/74LS/74LS126.shtml https://www.futurlec.com/74HC/74HC126pr.shtml

They have an output enable (OE) input that acts like a slave select.

Ah, that's brilliant, got one on order. That should solve the problem, it's just a shame it has to come to that and that the VC0706 doesn't play nice :(

Thanks for filling me in on the tri state buffer, I've done some research and it seems like a great device to add to my list of useful gadgets :)

They are a handy device. I've used them for all kinds of bus sharing, not just SPI.

Also, if I may add some infos, using tri-state buffer will settle lot of problem if you build a project around an SDcard and a VS1053 mp3 module. It will fix some problem when the MISO line is shared between more then 2 slave devices.

rickpbush: then the SS pin for the nRF24L01 Low,

I presume you mean CSN. Its use is not as simple as you have described. Read the Nordic datasheet for the fine detail.

...R