cancel
Showing results for 
Search instead for 
Did you mean: 

Data mismatching while Hard and soft reset

Arpan Patel
Associate II
Posted on January 18, 2018 at 06:19

Hello Miroslav, I have done following configuration for IIS2DH acceleromenter.

/////////////////////////// Sample Code ////////////////////////////////////////////////////

response=LIS3DH_GetWHO_AM_I(&who_am_i);

if(who_am_i==IC_READ_SUCCESS){

print('Who AM I %x\r\n',who_am_i);

unsigned char response,status;

AxesRaw_t data;

response = LIS3DH_SetODR(LIS3DH_ODR_10Hz);

if(response==1){

print('SET_ODR_OK\r\n');

}

response = LIS3DH_SetMode(LIS3DH_LOW_POWER);

if(response==1){

print('SET_MODE_OK\r\n');

}

response = LIS3DH_SetFullScale(LIS3DH_FULLSCALE_2);

if(response==1){

print('SET_FULLSCALE_OK\r\n');

}

response = LIS3DH_SetAxis(LIS3DH_X_ENABLE | LIS3DH_Y_ENABLE | LIS3DH_Z_ENABLE);

if(response==1){

print('SET_AXIS_OK\r\n');

}

response = LIS3DH_SetFilterDataSel(MEMS_ENABLE);

if(response==1){

print('Filter Data Selection enable\r\n');

}

while(1)

{

response = LIS3DH_GetAccAxesRaw(&data);

if(response==1){

data.AXIS_X = data.AXIS_X >> 8;

data.AXIS_Y = data.AXIS_Y >> 8;

data.AXIS_Z = data.AXIS_Z >> 8;

print('x %d y %d z %d\r\n',data.AXIS_X,data.AXIS_Y,data.AXIS_Z);

}

}

}

else{

print('Device Read Failed\r\n');

}

/////////////////////////////////////*****///////////////////////////////////////////////////

When I reboot thr board by soft reset it has given following X,Y and Z raw data:

x -1 y -1 z 0

x 0 y -2 z 1

x -1 y 0 z -2

x 0 y -1 z 1

x -1 y 0 z 0

x 1 y -1 z 0

x 0 y 0 z 0

x 0 y -1 z 0

x -1 y -1 z -1

x -1 y -1 z 0

x 0 y 0 z -1

x 0 y -1 z -1

x 1 y 0 z 0

x 0 y 0 z -2

x 0 y 1 z -2

x 0 y 0 z 0

x -1 y -1 z -2

x -1 y -1 z -1

x 0 y -1 z 0

And following raw data when Hard reboot the board:

x -2 y 62 z -12

x -1 y 55 z -11

x -1 y 47 z -9

x -1 y 42 z -10

x -1 y 37 z -7

x -2 y 31 z -6

x -1 y 27 z -7

x -1 y 24 z -7

x 0 y 20 z -5

x -1 y 18 z -4

x -1 y 15 z -4

x -1 y 12 z -1

x -1 y 10 z -2

x 0 y 10 z -3

x -2 y 8 z -2

x -1 y 7 z -2

x -1 y 6 z -1

x -2 y 5 z -2

x -1 y 4 z -1

x 0 y 4 z -1

x 0 y 3 z -1

x 0 y 2 z -2

x -1 y 3 z -3

x 0 y 1 z -1

x -1 y 2 z -1

x 0 y 1 z -2

x -1 y 1 z -2

x 0 y 1 z 0

x 0 y 1 z -1

x -2 y 0 z 0

x 0 y 0 z 0

So, in that hard reboot readings you have seen that first 15-20 readings are some unusaul and after that it has stable readings nearly to zero. Why this is happened? Can you please give some solution on that.

5 REPLIES 5
Miroslav BATEK
ST Employee
Posted on January 18, 2018 at 14:51

I don't know what you mean by soft reset and hard reboot?

Anyway I suppose you don't wait enough time when the sensors starts-up and the internal registers are not initialized yet.

You can link up boot status to the INT2 pin (using BOOT_I2 bit in CTRL_REG6) and check when the sensors finishes the internal initialization.

0690X00000609QCQAY.png
Posted on January 19, 2018 at 04:11

Thanks for your support. But I have enabled BOOT_I2 bit in the CTRL_REG6 but it has not worked. Furthermore, soft reset means to reboot the board using the firmware code which we have load into the controller and hard reset means power off and then on. You have said that '

check when the sensors finish the internal initialization

' so how we do it?
Posted on January 23, 2018 at 11:18

Hi Miroslav, please give comment to my query. 

Miroslav BATEK
ST Employee
Posted on January 24, 2018 at 10:59

So the problem is only in case 'hard reset' which means power cycle, is my understanding correct?

Do you have a delay in you program, after power on and before sensor configuration? If not, can you add it or increase the delay and check if the problem persist?

Posted on January 24, 2018 at 14:06

Hi, Yes problem in power cycle. I have tried with 1 to 10sec of delay but I have facing same problem. So, now how I tackle it? please help me.