I was working on a PCB design and I am stuck on a question over SPI communication over different voltages.

I am using some 74HC595 and 74HC165 shift registers to expand number of GPOIs, running on 5v DC. This will be controlled by an STM32 (STM32F103R8T6), running on 3.3v DC, connected over SPI bus. I read in STM32 datasheet that the GPIOs are 5v tolerant.

I was wondering, if I can have different voltages across these GPIO expansion chips and the μCU. Or is there anything I need to take care of?

I saw similar questions, but in my case, the STM32 seems to be 5v tolerant:

  1. controlling SPI devices using the Arduino - different voltages
  • \$\begingroup\$ You can supply 74HC chips with 3.3 volt. \$\endgroup\$
    – Tagli
    Commented Jan 28, 2021 at 12:20

2 Answers 2


You need to be a bit careful with the 5V-tolerant inputs as they can only withstand Vdd + 4.0, which will be violated if the 3.3V supply is off when the 5V supply is present.

My preference is to use commercial voltage translators (the kind with two supplies and a direction pin) if you can't operate everything from 3.3V (the preferable solution) because SPI generally calls for high speed level shifting. For that reason, the kind of level shifting that uses passive pullups (such as the MOSFET method) is generally undesirable.

  • \$\begingroup\$ I am confused. When you say Vdd+4.0, isnt Vdd 3.3v for this IC? Does that technically become 3.3+4? \$\endgroup\$ Commented Jan 28, 2021 at 13:15
  • 1
    \$\begingroup\$ @DigitalEther When the 3.3V supply is not present, Vdd for the STM32 will tend to be close to zero. The 5V supply on the other chips may or may not be present, in general. That is precisely the situation I am concerned with here, not the normal operating conditions. If your 3.3V supply is derived from the 5V supply via an LDO, for example, you may be able to guarantee there is no issue, but that's not always true. \$\endgroup\$ Commented Jan 28, 2021 at 13:17
  • \$\begingroup\$ So, if I can ensure that the circuit always has 5v as well as 3.3v supply, both at once or none, will that be still a problem? Because I am using the same 5v rail to pull it down to 3.3v using an AMS1117. So if the 5v supply is present, only then the 3.3v will be there, else not. \$\endgroup\$ Commented Jan 28, 2021 at 13:21
  • \$\begingroup\$ In that case, it should be okay assuming the 5V supply is not applied too suddenly (too fast rise time). The LM1117 dropout voltage is 1.3V worst-case. \$\endgroup\$ Commented Jan 28, 2021 at 13:25
  • \$\begingroup\$ Does that mean, I can connect SPI of my shift registers (running on 5v), directly to SPI on the STM32 (running on 3.3v) without any extra components, if I can ensure both voltages are supplied at once else, none? On the "fast rise time", would you suggest adding a new component? \$\endgroup\$ Commented Jan 28, 2021 at 13:40

Change to 74HCT chips. They operate with 3.3V data when powered from 5V.

Second option is to use 5V tolerant SPI pins on STM32 and use the SPI pins in opendrain mode, and have a pull-up to 5V.

Another option is to use 3.3V for everything.

  • \$\begingroup\$ Okay I got what you mean. 74HCT595 and 74HCT165. This is certainly something I can switch to without any problem if I get the same package as of 74HCs \$\endgroup\$ Commented Jan 28, 2021 at 13:56

Your Answer

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

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