I'm writing .cpp driver for Arduino for the LIS3DHH but something seems wrong.
No replies from the accelerometer.
Do you have any suggestion on the SPI correct communication task reading my files?
I didn't have chance to try your code yet. But at first glance, can you please try SPI mode 3?
I've found the issue. It was a bad SPI writeRegister procedure.
Attached the files updated.
Now I'm struggling withe the interrupt 1 settings, but this is another
this is my actual register setting to oversampling of 32 using the INT1 in opendrain mode (externally pulluped)
#define CTRL_REG1 0x80 // Normal mode enable and register address NOT automatically incremented
#define CTRL_REG4 0x44 // FIR, BW=235 Hz and Open drain selection on INT1 pin (externally pulluped)
#define CTRL_REG5 0x00
#define FIFO_CTRL (0x20 + (OSR-1)) // FIFO mode. Stops collecting data when FIFO is full. FIFO threshold level set to OSR
#define INT1_CTRL 0x08 // FIFO threshold flag on INT1 pin
#define OSR 32 // Oversampling ratio OSR, equal to number of samples to sum
I cannot understand why the INT1 doesn't work.
I checked the register values after writing and they are corrected
What do you think?
Are them right?
If I change the DRDY_PULSE = 1, I get the interrupt each value uploaded in the FIFO register.
Instead the I get an interrupt every 910 us => 1.1KHz the accelerometer ODR.
Anyway I'm not able to get the right FIFO interrupt.
Retrieving data ...