ST意法半导体
直播中

曹皓轩

7年用户 186经验值
私信 关注
[问答]

硬复位时软件不匹配

你好Miroslav,我已经完成了IIS2DH加速器的以下配置。
///////////////////////////示例代码///////////////////// ///////////////////////////////
响应= LIS3DH_GetWHO_AM_I(安培; who_am_i);

如果(who_am_i == IC_READ_SUCCESS){
print('Who AM I%x  r  n',who_am_i); unsigned char响应,状态;

AxesRaw_t数据;
response = LIS3DH_SetODR(LIS3DH_ODR_10Hz);
如果(响应== 1){
打印( 'SET_ODR_OK  r  n');
}
response = LIS3DH_SetMode(LIS3DH_LOW_POWER);
如果(响应== 1){
打印( 'SET_MODE_OK  r  n');
}
response = LIS3DH_SetFullScale(LIS3DH_FULLSCALE_2);
如果(响应== 1){
打印( 'SET_FULLSCALE_OK  r  n');
}
response = LIS3DH_SetAxis(LIS3DH_X_ENABLE | LIS3DH_Y_ENABLE | LIS3DH_Z_ENABLE);
如果(响应== 1){
打印( 'SET_AXIS_OK  r  n');
}
response = LIS3DH_SetFilterDataSel(MEMS_ENABLE);
如果(响应== 1){
print('过滤数据选择启用 r  n');
}而(1)

{
response = LIS3DH_GetAccAxesRaw(& data);
如果(响应== 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);
}
}}

其他{
print('设备读取失败 r  n');
} ///////////////////////////////////// ***** /////// ////////////////////////////////////////////
当我通过软复位重启thr board时,它给出了以下X,Y和Z原始数据:

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
硬盘重启时,跟随原始数据:
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
因此,在硬重启读数中,您已经看到前15-20个读数有些不可用,之后它的稳定读数几乎为零。为什么会这样?你能解决一下吗?

以上来自于谷歌翻译


以下为原文




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 %xrn',who_am_i);unsigned char response,status;

AxesRaw_t data;
response = LIS3DH_SetODR(LIS3DH_ODR_10Hz);
if(response==1){
print('SET_ODR_OKrn');
}
response = LIS3DH_SetMode(LIS3DH_LOW_POWER);
if(response==1){
print('SET_MODE_OKrn');
}
response = LIS3DH_SetFullScale(LIS3DH_FULLSCALE_2);
if(response==1){
print('SET_FULLSCALE_OKrn');
}
response = LIS3DH_SetAxis(LIS3DH_X_ENABLE | LIS3DH_Y_ENABLE | LIS3DH_Z_ENABLE);
if(response==1){
print('SET_AXIS_OKrn');
}
response = LIS3DH_SetFilterDataSel(MEMS_ENABLE);
if(response==1){
print('Filter Data Selection enablern');
}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 %drn',data.AXIS_X,data.AXIS_Y,data.AXIS_Z);
}
}}

else{
print('Device Read Failedrn');
}/////////////////////////////////////*****///////////////////////////////////////////////////
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)

曾玲娟

2019-4-26 12:13:38
我不知道你的意思是软复位和硬重启?
无论如何,我认为当传感器启动并且内部寄存器尚未初始化时,您没有等待足够的时间。
您可以将引导状态链接到INT2引脚(使用CTRL_REG6中的BOOT_I2位)并检查传感器何时完成内部初始化。

以上来自于谷歌翻译


以下为原文




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.
举报

曹皓轩

2019-4-26 12:21:11
感谢您的支持。但是我在CTRL_REG6中启用了BOOT_I2位,但它没有工作。此外,软复位意味着使用我们已加载到控制器中的固件代码重新启动电路板,硬复位意味着关闭电源然后再打开。你说过'
检查传感器何时完成内部初始化
'那我们怎么做?

以上来自于谷歌翻译


以下为原文




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?
举报

曹皓轩

2019-4-26 12:26:44
您好Miroslav,请对我的查询发表评论。

以上来自于谷歌翻译


以下为原文




Hi Miroslav, please give comment to my query.
举报

曾玲娟

2019-4-26 12:42:43
所以问题只是在“硬复位”这意味着电源循环,我的理解是否正确?
开机后和传感器配置之前,您的程序有延迟吗?如果没有,您可以添加它或增加延迟并检查问题是否仍然存在?

以上来自于谷歌翻译


以下为原文




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?
举报

更多回帖

发帖
×
20
完善资料,
赚取积分