Page 2 of 2
Re: Problems with SPI (Nucleo L476RG)
Posted: Fri Aug 05, 2022 7:21 pm
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?
Re: Problems with SPI (Nucleo L476RG)
Posted: Sat Aug 06, 2022 12:44 am
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).
Re: Problems with SPI (Nucleo L476RG)
Posted: Sat Aug 06, 2022 2:49 am
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.
Re: Problems with SPI (Nucleo L476RG)
Posted: Mon Aug 08, 2022 7:50 pm
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.