5415 views|15 replies

10

Posts

0

Resources
The OP
 

LSM6DS3TR's INT1 cannot detect interrupt [Copy link]

 
 This post was last edited by piaoroumi on 2018-11-2 11:26 Read WHO_AM_I and get 69, configure accelerometer: gYroscopeWrite(CTRL9_XL, 0x38);//XL configure gYroscopeWrite(CTRL1_XL, 0x60);//XL configure gYroscopeWrite(INT1_CTRL, 0x01);// Then move the board, INT1 does not interrupt. Tried 2 boards, both are the same. Can you please tell me what the problem could be? The registers are written and read correctly.

This post is from MEMS sensors

Latest reply

There is long-term drift in the angle calculated by the gyroscope. It is recommended to use a magnetometer, or use a magnetometer in conjunction with a gyroscope. If you just want to determine whether the door is open, you can do it by judging the size of the angular velocity. When the door is not open, the angular velocity is close to 0. When the door is open, the angular velocity will increase. Because it is not an absolute data, if the door is opened slowly enough, it will not be detected.  Details Published on 2018-12-29 15:21
 
 

9703

Posts

24

Resources
2
 
What interrupt do you want INT1 to output?
This post is from MEMS sensors
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

10

Posts

0

Resources
3
 
littleshrimp posted on 2018-11-2 17:11 What interrupt do you want INT1 to output?
When accelerometer data is ready, the state of INT1 changes
This post is from MEMS sensors

Comments

Take a look at this post, there is a complete project https://en.eeworld.com/bbs/forum.php?mod=viewthread&tid=649230&highlight=LSM6DSl  Details Published on 2018-11-2 17:39
 
 
 

10

Posts

0

Resources
4
 
How can I configure the registers to simply enable INT1 to interrupt when the accelerometer has data?
This post is from MEMS sensors
 
 
 

9703

Posts

24

Resources
5
 
piaoroumi posted on 2018-11-2 17:32 When the accelerometer data is ready, the state of INT1 changes
You can take a look at this post, there is a complete projecthttps://en.eeworld.com/bbs/forum ... 0&highlight=LSM6DSl
This post is from MEMS sensors
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

10

Posts

0

Resources
6
 
Thanks, Brother Shrimp. I'll look into it!
This post is from MEMS sensors
 
 
 

9703

Posts

24

Resources
7
 
This post was last edited by littleshrimp on 2018-11-4 13:55 I did a test. If you only configure the LSM6DS3 register according to your configuration method, there is indeed a situation where the interrupt cannot be triggered. Then I added a reset of LSM6DS3 before powering on in the code, and then configured the corresponding registers. The interrupt was normal. Similarly, in the case of power-on without resetting, the output register was read once after the register was configured, and the interrupt was also normal. You can try these two methods. The problem may be that after the device is configured, the data is ready, the INT1 pin outputs a high level, and the microcontroller does not read the interrupt in time due to reset and other reasons. When the interrupt pin is running again, it is high and the rising edge interrupt cannot be triggered again. In addition to the above two methods, you can also try to use high-level interrupt or rising edge interrupt to judge the pin level test code:
  1. static uint8_t who_am_i; //WHO_AM_I (0Fh) HAL_I2C_Mem_Read(&hi2c1,0xd4,0x0f,I2C_MEMADD_SIZE_8BIT,&who_am_i,1,0x100); static uint8_t reg; //CTRL3_C (12h) 0x01 SOFT REST reg = 0x01; #warning "1. Reset sensor at power on" // HAL_I2C_Mem_Write(&hi2c1,0xd4,0x12,I2C_MEMADD_SIZE_8BIT,,1,0x100); HAL_Delay(500); //CTRL3_C (12h) 0x44 BDU IF_INC reg = 0x44; // HAL_I2C_Mem_Write(&hi2c1,0xd4,0x12,I2C_MEMADD_SIZE_8BIT,,1,0x100); //CTRL9_XL (18h) x,y,z en reg = 0x38; HAL_I2C_Mem_Write(&hi2c1,0xd4,0x18,I2C_MEMADD_SIZE _8BIT,,1,0x100); //CTRL1_XL (10h) reg = 0x60; HAL_I2C_Mem_Write(&hi2c1,0xd4,0x10,I2C_MEMADD_SIZE_8BIT,,1,0x100); //INT1_CTRL (0Dh) reg = 0x01; HAL_I2C_Mem_Write(&hi2c1,0xd4,0x0d,I2C_MEMADD_SIZE_8BIT,,1,0x100); #warning "2. Read the output register once after configuration" // HAL_I2C_Mem_Read(&hi2c1,0xd4,0x28,I2C_MEMADD_SIZE_8BIT,buffer,6,0x100); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ if(lsm63se_drdy_flag) { lsm63se_drdy_flag = 0; HAL_I2C_Mem_Read(&hi2c1,0xd4,0x1e,I2C_MEMADD_SIZE_8BIT,&status,1,0x100); if(status & 0x01) { HAL_I2C_Mem_Read(&hi2c1,0xd4,0x28,I2C_MEMADD_SIZE_8BIT,buffer,6,0x100); } } } /* USER CODE END 3 */
复制代码
Test project file: Use NUCLEO-L496ZG development board, STM32CubeMX to create a project, I2C communicates with LSM6DSL, CS and SA0 are connected to low level, CS is connected to high level, PA5 is connected to LSM6DS3_INT1 pin, rising edge interrupt, no pull-up and pull-down resistors lsm6ds3 nucleo-l496zg.rar (9.03 MB, downloads: 58)


This post is from MEMS sensors
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

10

Posts

0

Resources
8
 
I was busy with other things recently, and I found that Brother Xia has answered my questions again. I am really grateful. I will try it right away.
This post is from MEMS sensors
 
 
 

10

Posts

0

Resources
9
 
Brother Xia, I have obtained the interrupt according to your configuration. And I configured it to generate an interrupt on a single click. Let me talk about my application scenario. We are working on the smart lock solution. Because the customer mentioned that there are already suppliers making gyroscopes to detect door opening and closing. So we also want to use this solution. The idea is: do a good job of calibration when the door is closed. Then when the door moves, the gyroscope is used to calculate the angle of the door to determine the door's open and close status. I would like to ask: Is this idea feasible?
This post is from MEMS sensors
 
 
 

10

Posts

0

Resources
10
 
Brother Xia, I did a test and configured it using your method. I got the interrupt. Thank you very much. Our application scenario is this: when the door is closed, do the initialization. Then use the gyroscope to calculate the opening and closing angle of the door. Implement the automatic door closing function. I would like to ask, is this usage method feasible?
This post is from MEMS sensors

Comments

It should be possible. When the gyroscope is working, the current will be larger. Battery power supply needs attention. In addition, the gyroscope calculates the door opening angle as a relative angle, which can be used with acceleration to determine the door closing detection. Another method is to use a magnetometer, which is equivalent to placing a compass on the door. There is a fixed magnetic field around it, which can be infected through calibration.  Details Published on 2018-11-25 07:56
 
 
 

9703

Posts

24

Resources
11
 
piaoroumi posted on 2018-11-24 18:27 Brother Xia, I did a test. Configured it using your method. Got an interrupt, thank you very much. Our application scenario is this: When the door is closed, ...
It should be possible. When the gyroscope is working, the current will be larger. Battery power supply needs to be noted. In addition, the gyroscope calculates the door opening angle as a relative angle, which can be combined with acceleration to determine the door closing detection. Another method is to use a magnetometer, which is equivalent to putting a compass on the door. There is a fixed magnetic field around it. The infection can be solved by calibration to calculate the absolute angle of the door opening. The disadvantage is that it is afraid of dynamic magnetic field interference. For example, if someone shakes a magnet outside the sensor, it may misjudge. If necessary, these three can be combined
This post is from MEMS sensors

Comments

I have enabled the gyroscope and read the interrupts, and I see that they are always being interrupted. I want no interrupts to be generated when the door is not moving, only when it is moving. Where can I set the angular velocity threshold?  Details Published on 2018-11-26 11:28
 
 
 

10

Posts

0

Resources
12
 
littleshrimp posted on 2018-11-25 07:56 It should be possible. The current will be larger when the gyroscope is working. Battery power supply needs to be noted. The gyroscope calculates the angle of the door opening as a relative angle.
I have enabled the gyroscope now, and read the interrupt, and then found that interrupts will be generated all the time. I hope that there will be no interrupt when the door does not move. Only when it moves. Where can I set the angular velocity threshold? /* íó?Yò?3?ê??ˉ******** ************************/ void gYroscopeG_Init(void) { gYroscopeWrite(CTRL2_G, 0x1C);// gYroscopeWrite(CTRL6_C, 0x70); gYroscopeWrite(CTRL7_G, 0x43); gYroscopeWrite(INT1_CTRL, 0x02);//ê1?üíó?Yò??D??. }

This post is from MEMS sensors

Comments

Normally you need to keep receiving data and then analyze the door opening angle. LSM6DS3 has a 4D or 6D threshold trigger interrupt function, which may not meet your requirements. [attachimg]388998[/attachimg] [attachimg]388999[/attachimg]  Details Published on 2018-11-26 11:48
 
 
 

9703

Posts

24

Resources
13
 
piaoroumi posted on 2018-11-26 11:28 I have enabled the gyroscope and read the interrupt, and found that it will always generate interrupts. I hope that there will be no interrupts when the door does not move...
Normally, you need to keep receiving data and then analyze the angle of the door opening. The lsm6ds3 has a 4D or 6D threshold to trigger the interrupt function, which should not meet your requirements


This post is from MEMS sensors
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

10

Posts

0

Resources
14
 
I guess I can't use it. I can't stay awake all the time. It's a power-sensitive system.
This post is from MEMS sensors
 
 
 

1

Posts

0

Resources
15
 
piaoroumi posted on 2018-11-24 18:27 Brother Xia, I did a test. I configured it using your method. I got the interrupt. Thank you very much. Our application scenario is like this: when the door is closed, ...
Brother, I saw your door switch solution: when the door is closed, do the initialization. Then use the gyroscope to calculate the opening and closing angle of the door. Have you realized the automatic door closing function? I am doing a graduation project now, and I chose this example. I would like to ask you about the idea and implementation of this solution.
This post is from MEMS sensors

Comments

The angle calculated by the gyroscope has long-term drift. It is recommended to use a magnetometer, or use a magnetometer in conjunction with a gyroscope. If you just want to determine whether the door is open, you can do so by determining the magnitude of the angular velocity. When the door is not open, the angular velocity is close to 0. When the door is open, the angular velocity will increase. Because it is not absolute data,  Details Published on 2018-12-29 15:21
 
 
 

9703

Posts

24

Resources
16
 
devil'eye posted on 2018-12-27 14:20 Brother, I saw your door switch solution: when the door is closed, do initialization. Then use the gyroscope to calculate the opening and closing angle of the door. Automatic door closing...
There is long-term drift in the angle calculated by the gyroscope. It is recommended to use a magnetometer, or use a magnetometer in conjunction with a gyroscope. If you just want to determine whether the door is open, you can do it by judging the size of the angular velocity. When the door is not open, the angular velocity is close to 0. When the door is open, the angular velocity will increase. Because it is not an absolute data, if the door is opened slowly enough, it will not be detected.
This post is from MEMS sensors
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list