3.3V SPI bus with Arduino

Hi The project I am working on has me controlling a board which has 3.3V logic levels

The board documentation says it is 5V tolerant

I can communicate on the i2c bus without problems but the SPI bus does not seem to load any data

The board manufacturers tech support say I should be using 3.3V logic and that may be the cause of the problem

I only need to write on the SPI bus (as master) I don't think I will ever need to read from the slave via SPI

I also have to keep my SPI signals tri-stated until I recieve permission from the slave board to control the SPI bus. I do this using i2c.

How best to convert the logic levels on the SPI bus?

I am using an Arduino Uno to develop the application but I also have Arduino Mega 2560 which I may use on the final version. Does this have 3.3V logic already and therefore negate the problem?

cheers Rich

You need a buffer chip, such as TXB0104 for 4 signals (SCK, MOSI, CS).

Has an Output Enable signal that you pull Low to tristate the outputs, and drive High from Arduino output pin the enable the outputs.

Thanks for that.

As another option would I be better using the Arduino Due as that is 3.3V?

Rich

Your call. Big step up processor wise. Why not try the other direction - drop down to a 8 MHz board running at 3.3V? http://arduino.cc/en/Main/ArduinoBoardProMini

I’ve ordered a TXB0104 to test whether this 5V on the supposedly 3.3V tolerant bus is actually the cause of the problem

While waiting for that to arrive I was wondering, why can’t I just connect some low(ish) value resistors and 3.3V zeners on the bus (as I happen to have some here)

Arduino MOSI ------///-----|<|----- 0V

Same for SCK

And connect the 3.3V bus to the junction of the zener and the resistor?

Would that not do pretty much the same thing bearing in mind I am only sending and not receiving on the SPI bus?

Rich

Yes, but it may also fail due to crummy high speed signals with that stuff on the line. That's why SD cards, which also use SPI, work better with active buffers vs passive components.

So is that a 'give it a go' while waiting for the TX0104 to arrive, or a 'not worth bothering' ?

I suppose really there the answer is 'only one way to find out'..... ??

Give it a go - you may need to use the SPI clock divisor commands to slow down the rate to yield good, repeatable results.

Any recommended resistor values? I was thinking around 400ohms

Well, with 2 resistors in series, Vout = (Vin * R2)/(R1 +R2), where R1 connects to +5 source and R2 connects to Gnd, Vout being the junction. Lets use 1000 for R2

3.3V = 5V*1000/(R1 + 1000) 3.3R1 + 3300 = 5000 3.3R1 = 1700 R1 = 1700/3.3 = 515 So, 1K and something around 515 ohm, I think 510 is a standard value.

As I got bored waiting for the TXB0104 to arrive, I implemented this using the resistor dividers as you stated and it worked perfectly. At least it proved that using 5V on the 3.3V (supposedly 5V tolerant) SPI bus was indeed the cause of my troubles!

Most likely i will use the Arduino Due on the 'production' version as it will not add that much expense over using the Mega 2560 and level shifiting circuitry

cheers Rich