cancel
Showing results for 
Search instead for 
Did you mean: 

Write issues with CTRL_REG6_XL of LSM6DS0

valerio2
Associate II
Posted on January 11, 2016 at 11:04

Hi everybody,

I have a custom board hosting anLSM6DS0 sensor and an STM32F427 micro which communicate via SPI. The SPI interface is configured as follow:


SPI5h.Instance = SPI_MEMS;

SPI5h.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16; 
/* 5 MHz */

SPI5h.Init.Direction = SPI_DIRECTION_2LINES;

SPI5h.Init.CLKPhase = SPI_PHASE_2EDGE;

SPI5h.Init.CLKPolarity = SPI_POLARITY_HIGH;

SPI5h.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;

SPI5h.Init.CRCPolynomial = 7;

SPI5h.Init.DataSize = SPI_DATASIZE_8BIT;

SPI5h.Init.FirstBit = SPI_FIRSTBIT_MSB;

SPI5h.Init.NSS = SPI_NSS_HARD_OUTPUT;

SPI5h.Init.TIMode = SPI_TIMODE_DISABLE;

SPI5h.Init.Mode = SPI_MODE_MASTER;

At startup I firstly check if the module is present reading successfully the WHO_AM_I register, then I try to configure theCTRL_REG6_XL register to enable the accelerometer. So I perform the following write/read operations

1.
HAL_SPI_Transmit(&SPI5h, &wCTRL_REG6_XL, 
sizeof
(rCTRL_REG6_XL), 1000);
2.
HAL_SPI_Transmit(&SPI5h, &diCTRL_REG6_XL, 
sizeof
(diCTRL_REG6_XL), 1000);
3.
HAL_Delay(100);
4.
5.
HAL_SPI_Transmit(&SPI5h, &rCTRL_REG6_XL, 
sizeof
(rCTRL_REG6_XL), 1000);
6.
HAL_SPI_Receive(&SPI5h, &rxSENSOR, 
sizeof
(rxSENSOR), 1000);
7.
HAL_Delay(100);

where

wCTRL_REG6_X = 0x20,

rCTRL_REG6_X =

wCTRL_REG6_X | 0x80 and

diCTRL_REG6_XL = 0x20 is the configuration data. That is, I just switch on the accelerometer leaving every other parameter at default.

At row 5, then I read again the register content to check whether the settings have been correctly stored, but

rxSENSOR = 0xF0. Within the module's reference pdf I could not find anything related with this and I am really puzzled.

Any suggstion is appreciated. Regards.
0 REPLIES 0