SPI on Atmega32u4/Atmega328p Arduino Core
Closed this issue · 5 comments
I'm unable to get SPI mode working despite trying just about every wiring configuration.
Rather than posting the permutations below, have any of the original contributors tested SPI with this ASM330? If so, (1) what was the wiring configuration and (2) was that done with the STM32 or an Uno/equivalent AVR.
Hello @aidanchandra ,
SPI mode is basically the same for all ST MEMS sensors. If you give a look at the implementation of IO_Read and IO_Write in the sensor class, it is always the same for all ST MEMS sensors. Honestly, I don't remember if I have tested the SPI mode for this specific sensor but for sure I have tested many ST MEMS sensors in SPI mode without any issue. So, I'm pretty confident that the implementation is fine. What is your hardware setup? Which board are you using with ASM330LHH?
Best Regards,
Carlo
Hey @cparata , thanks for the prompt reply.
I'm using a knock-off atmega32u4 based Arduino Pro Micro at 5V and I'm running those signals through a bidirectional level shifter based off of the TXS0108E. I'll list my wiring below.
D15 (SCLK) <------> TXS0108E <-------> SCL
D14 (MISO) <------> TXS0108E <-------> SDO (I've also swapped this with SDA to no avail)
D16 (MOSI) <------> TXS0108E <-------> SDA
CS <------> GND
VDDIO <------> 3.3V
i2C mode works completely fine, though, and correctly will change address when I toggle SDO and will disable when I toggle CS, which makes me think all pins are working correctly.
I am going to grab my oscilloscope and I have a logic analyzer on the way, so if nothing pops out as obviously wrong, I can post waveforms later.
Aidan
Hi @aidanchandra ,
the library expects that CS pin is controlled by the microcontroller. So, could you connect the CS pin to a gpio of the microcontroller and pass it as parameter in the constructor?
Best Regards,
Carlo
Hi @aidanchandra
any update on this? Did you try with a GPIO for CS?
Close as no feedback from OP.