Problems with SPI (Nucleo L476RG)

Post here first, or if you can't find a relevant section!
jh2399
Posts: 6
Joined: Wed Aug 03, 2022 8:34 pm

Re: Problems with SPI (Nucleo L476RG)

Post by jh2399 »

Oh no.. So I knew the sensor was supposed to be 3.3V, but I (erroneously) thought Arduino output 3.3V on it's output pins.

So you're saying the sensor I have should have never worked with the Arduino in the first place without a voltage divider or a LLC, correct? And the fact that it did means the manufacturer of the board I got modified it in some way for it to work with 5V? And as a result when I try connecting it to the STM32 which outputs 3.3V, it doesn't work? And if it's not modified by the manufacturer then by giving it 5V from the Arduino, perhaps it is damaged?
GonzoG
Posts: 403
Joined: Wed Jan 15, 2020 11:30 am
Answers: 27
Location: Prudnik, Poland

Re: Problems with SPI (Nucleo L476RG)

Post by GonzoG »

According to datasheet it can handle up to 3.7V so it cannot work with Arduino without added circuitry.
datasheet, page 6:
https://www.pnicorp.com/wp-content/uplo ... al-r04.pdf

There are different Arduino boards. Some are 5V (with 8b ATMega MCUs), some are 3.3V (with SAMD, nRF, RP2040 MCUs).
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: Problems with SPI (Nucleo L476RG)

Post by ag123 »

something like a 74HCT245
https://www.ti.com/lit/gpn/SN74HCT245
https://www.nexperia.com/products/analo ... CT245.html
could be used to bridge 3.3v to 5v

while a 74LVC245
https://www.ti.com/lit/gpn/SN74LVC245A
may be needed to bridge 5v to 3.3v

some 5v devices can be driven directly from STM32, it depends on compatible input levels for those devices.
for some of the STM32 input pins it could take a 5v gpio input, it needs to be 5v tolerant pins (check the specs).
however, for 'safety' I'd sometimes place a series resistor, say a few 100 ohms to maybe 3-5k ohms if I'm after all connecting a higher voltage into stm32.
I'd guess a resistor divider would work just well. The only thing about resistors is that it may get caught up with RC issues if there are parasitic capacitances scattered around, so this may limit higher frequency/speeds interfacing.
jh2399
Posts: 6
Joined: Wed Aug 03, 2022 8:34 pm

Re: Problems with SPI (Nucleo L476RG)

Post by jh2399 »

Just as a test, I created a voltage divider to run the 4 outputs (CS, SCLK, MOSI, MISO) of the Arduino through so that it would output 3.3V instead of 5V and SPI and the sensor still worked just fine :( . I was really hoping that when I converted the output to 3.3V it would cease to work.
Post Reply

Return to “General discussion”