cancel
Showing results for 
Search instead for 
Did you mean: 

[ATT]9358

alessio31183
Associate II
Posted on August 29, 2017 at 18:35

Dear all,

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?

0690X000006080OQAQ.png
4 REPLIES 4
Miroslav BATEK
ST Employee
Posted on August 30, 2017 at 11:16

I didn't have chance to try your code yet. But at first glance, can you please try SPI mode 3?

Posted on August 30, 2017 at 11:29

Hi Miroslav,

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

issue.

Thanks

Alessio

________________

Attachments :

LIS3DHH.cpp.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyRS&d=%2Fa%2F0X0000000b8B%2FlIWi6xYE216a.HD7s74uNFjzUVBojEOMALzNfNN22qY&asPdf=false

LIS3DHH.h.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyI6&d=%2Fa%2F0X0000000b89%2F8A9hJQ..Byl.qHClsAqj2PgmNAtmHEB.8j2qPDRMJiM&asPdf=false
Posted on August 30, 2017 at 11:38

 ,

 ,

....

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?

alessio31183
Associate II
Posted on August 30, 2017 at 20:56

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.