0
\$\begingroup\$

I need memory to read from, for my project. I first intended to use an SD card, but I now found out a W25Q64/128 SPI Flash is more practical, since I don't need to write data.

However, this W25QXX Flash works with 3.3V SPI and the Arduino Mega has a 5V SPI.

By searching around, I find many solutions, but two that work which are quite different:

  • Using a voltage divider, which has the advantage of a simple circuit, but has problems that too less current is passed. However according to this link, in the end, someone fixed it easily by using much smaller resistor values.
  • Using a buffer circuit, which has the advantage of probably being more secure, but means some quite big ICs to be added. A circuit is mentioned in this link; credits to Steve Marple.

Question: Why should I (or shouldn't I) use this SPI Flash with a 5V using small resistor divider voltages?

(It seems that if I only want to add only this single 3.3V SPI Flash on the SPI bus, I can use the voltage divider using small resistors).

UPDATE

After Marcus Müller's answer, I found the following page that gives a lot of backgrounds (his solution is indeed the one with the most advantages): how-to-interface-a-5v-output-to-a-3-3v-input

\$\endgroup\$
1
\$\begingroup\$

Assuming you don't plan to use the chip in anything but standard SPI (not Dual- or QSPI), then all the signal pins are unidirectional!

That means that in the Arduino->Flash direction, a voltage divider that divides 5V down to 3.3V is sufficient (place it close to the receiving end, usually). This applies to the clock and the master-out, slave in (MOSI) data pin (called "Data Input" in the flash datasheet).

In the opposite direction (MISO / Data Output), there's little you can do to ensure reliable transmission but buffer. A buffer doesn't have to be large – in fact, a dual-NPN package would totally do with two resistors, and that would take single-digit square millimeters in SMD.

You might simply want to invest 33ct into something like a 74LVC1T45. That thing is maybe 1.7×1mm² in size even in its largest variant; I doubt that will be a limiting factor for your circuitry.

\$\endgroup\$
  • \$\begingroup\$ Thanks for this info. That buffer chip seems fine; btw, when I meant large ICs, I was more referring to a 16 pin DIP IC. This one is hopefully solderable by me (no experience in SMD soldering so far). Btw, I also found that reducing the SPI speed might help a lot, and the speed I need is about 31 kbps (so very slow). \$\endgroup\$ – Michel Keijzers Jul 19 at 12:36
  • 1
    \$\begingroup\$ since your arduino code is what defines the SPI clock, yeah, that's an easy option. Robustness always increases with reduced rate, but you really won't benefit much from reducing from say 100 kHz to 31 kHz clock rate - it works reliably or it doesn't. \$\endgroup\$ – Marcus Müller Jul 19 at 12:38
  • 1
    \$\begingroup\$ oh and don't be afraid of SOT-26-6 packaged ICs like this one. The pins are still roughly a millimeter spaced from each other, which can well be done without overly steady hands and magnet wire (solder the pins of your decoupling caps directly to the IC) \$\endgroup\$ – Marcus Müller Jul 19 at 12:41
  • 1
    \$\begingroup\$ @MichelKeijzers the buffer's job is to put the signal from a 0-3.3V range to a 0-5V range. If the HIGH output of the Flash IC is 3V, then that's far too close to the HIGH decision boundary of the 5V logic of the arduino. Add a little voltage drop on the line between sender and transmitter, and a little noise, and you suddenly get random bit flips. \$\endgroup\$ – Marcus Müller Jul 19 at 12:43
  • 1
    \$\begingroup\$ :) cool! Ah, and on a PCB, these are super easy to solder: fix the first pin, fix the pin on the opposite end of the IC, solder the rest. It's not hard to avoid solder bridges between pins that have a 1mm pitch, especially if your PCB has solder mask between them. \$\endgroup\$ – Marcus Müller Jul 19 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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