cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 SPI high level 5V

Scarlet
Associate III

Sorry, I have another question to ask everyone. I'm currently using the Nucleo F429ZI with SPI interface to receive 12-bit encoded data from another ADC. The Vdrive of that ADC can provide 3.3V or 5V for driving. However, the high level of the STM32F429ZIT6 is 3.3V. If I want the SPI high level to be 5V, what methods can I use to achieve this?

Originally, I was researching GPIO's Open Drain to use an external 5V to accomplish this, but in CubeIDE, the SPI is set to Push-Pull. So I would like to ask, when using STM32, how can I achieve a 5V high level if the SPI requires it?

Scarlet_0-1713766357977.png

 

28 REPLIES 28
Imen.D
ST Employee

Hello @Scarlet ,

It's possible to setup the configuration described and speaking about 5V tolerant pins only in input mode.

When the output mode is enabled, the GPIO is no more 5V tolerant.

It could work based on next principle for I2C. Taking into consideration that problematic could be difference between VDD and VDDx, which should never exceed 3.6 V:

ImenD_0-1713802018636.png

 

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
AScha.3
Chief

>The Vdrive of that ADC can provide 3.3V 

So use this 3v3 setting and you are on the safe side.

>If I want the SPI high level to be 5V, what methods can I use to achieve this?

Only for inputs (here) can use a voltage divider, like 2k - 3k3 -gnd. So input at 3v3 max.

Or a 5v tolerant gate as level shifter at 3v3 VDD (VHC or UHC series have such ).

If you feel a post has answered your question, please click "Accept as Solution".
Andrew Neil
Evangelist III

@Scarlet wrote:

The Vdrive of that ADC can provide 3.3V or 5V for driving.


So why not just use the 3.3V option ?

 


@Scarlet wrote:

However, the high level of the STM32F429ZIT6 is 3.3V.


Indeed - so, again, why not just use the 3.3V option in your ADC?

Because this ADC can use a higher SPI frequency with a Vdrive of 5V, I want to try if it's possible to reduce processing time.

Scarlet_0-1713832730247.png

 

Hi @Imen.D,

Originally, I planned to use the Open Drain method to provide external 5V, but in CubeIDE, the SPI setting is configured as Push Pull. I cannot guarantee that when outputting a high level, the 5V won't flow to the STM32 VDD 3.3V.

Or a 5v tolerant gate as level shifter at 3v3 VDD (VHC or UHC series have such ).


I will check the level shifter aspect. I plan to use the MAX14850AEE for voltage conversion, but this is not the optimal solution. However, I will further research this area. Thanks.

 

Only for inputs (here) can use a voltage divider, like 2k - 3k3 -gnd. So input at 3v3 max.


The voltage divider is like this?:

Scarlet_1-1713847414424.png

 

 

 

 

>The voltage divider is like this?:   yes, but without the short to 5V . 🙂

AScha3_1-1713852781034.png

But need lower impedance resistors, at 2k /3k3 it might work up to 10MHz - but never 50MHz.

+

as level shifter gates i use something like this :

SN74LVC1G86   (single XOR gate ; at mouser 20ct , 595-SN74LVC1G86DCKR )

so need one for every line :

AScha3_2-1713854172977.png

At 50MHz this is the way to go ; LVC gate can switch in 1.3ns at 3v3 (50pF load), so perfect here.

If you feel a post has answered your question, please click "Accept as Solution".

Open drain and about 50 Mhz is probably no good combination, either current hungry  or with bad waveforms.

I've noticed that something I said earlier could be misunderstood.

I'm currently outputting SCK from MCU to ADC, and then transferring ADC data back to the MCU.

So, the method of converting MISO from 5V to 3.3V is feasible, but if it's MCU SCK from 3.3V to 5V for the ADC,  might need a different approach.

Thank you so much.