ST意法半导体
直播中

谢海莲

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

如何配置LIS3DSH的状态机



配置LIS3DSH的状态机后,我无法获得中断。你能给我一些例子吗?我的代码如下:
LIS3DSH_Write_Byte(CTRL_REG1,(u8)0x01); //使能SM1,SM1中断路由到INT1
LIS3DSH_Write_Byte(CTRL_REG3,(u8)0x48); //中断信号有效高电平,中断锁定,IN​​T1信号使能
LIS3DSH_Write_Byte(CTRL_REG4,(u8)0x57); //启用X,Y,Z,ODR = 50 Hz。
LIS3DSH_Write_Byte(CTRL_REG5,(u8)0x00); //滤波器带宽800 Hz,+ / - 2g,禁用自检
LIS3DSH_Write_Byte(tiM3_1,(u8)20); // Timer3 1000ms
LIS3DSH_Write_Byte(ST1_0,TI3); // SM1状态1
LIS3DSH_Write_Byte(ST1_1,CONT); // SM1状态2

#tech

以上来自于谷歌翻译


以下为原文




hi,

   I can't get the interrupt after configuring the state machine of LIS3DSH. Could you give me some examples. My code as following:
LIS3DSH_Write_Byte(CTRL_REG1, (u8)0x01);//enable SM1, SM1 interrupt routed to INT1
LIS3DSH_Write_Byte(CTRL_REG3, (u8)0x48);//Interrupt signal active HIGH, Interrupt locked, INT1 signal enabled
LIS3DSH_Write_Byte(CTRL_REG4, (u8)0x57);//X, Y, Z enabled, ODR = 50 Hz.
LIS3DSH_Write_Byte(CTRL_REG5, (u8)0x00);//filter bandwidth 800 Hz, +/-2g, Self-test Disabled
LIS3DSH_Write_Byte(TIM3_1, (u8)20);//Timer3 1000ms
LIS3DSH_Write_Byte(ST1_0, TI3);//SM1 state 1
LIS3DSH_Write_Byte(ST1_1, CONT);//SM1 state 2
  
#tech

回帖(1)

张玲玲

2018-9-27 10:50:10
我不记得定时器是否引起了中断,我不这么认为。我记得这个加速度计有一个设置,默认情况下禁用,当达到停止或继续状态时会导致中断,也许你可以启用它,看看当它到达那个状态时是否会弹出中断。看着你:
 
 
 4.34
 
 此外,您可以通过将数据就绪中断和Fifo设置为流模式或任何其他中断(fifo full等)来检查中断是否实际有效。我个人遇到了一些问题,没有收到断线和中断,但加速度计工作正常。

以上来自于谷歌翻译


以下为原文





I don't remember if the timer caused an interrupt, I don't think so. I recall this accelerometer had a setting, by default disabled, that caused an interrupt when reaching an stop or continue state, maybe you could enable this and see if the interrupt pops when it reaches that state. Looked it for you:


4.34

Also, you could check that the interrupt actually works by setting the Data Ready interrupt and Fifo to stream mode, or any other interrupt (fifo full, etc). I've personally had some problems with broken traces and interrupts not being received but the accelerometer was working ok.
举报

更多回帖

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