-
Notifications
You must be signed in to change notification settings - Fork 21
Incorrect distance measurement in Short distance mode #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @phantom-8 , |
Hi Carlo, thanks for reply. The sensors are installed onto a robot. The reason for choosing short distance mode is because it's immune to strong ambient light. I don't need to detect stuff for more than 1 meter. However, I expect the sensors not to return incorrect values when it says the measurement is valid (setting RangeStatus to 0). For sensor 3, it should just report Out-Of-Range (RangeStatus of 4), not 0 or small distance with RangeStatus of 0. During my testing, I've encountered another serious problem. There seems to be some conflicts on the I2C bus with Serial Port receive. I've reported a similar issue a while back and have made an amendment on it. |
Some fix/enhancement have been done around Serial and I2C. |
Hi @phantom-8 , |
Hi @fpistm, thanks for informing me on the fix. I'll try and see if it helps. Hi @cparata, the piano scenario is just 1 of the examples. In short distance mode, there are many other instances where the sensors report incorrect measurement even it says it's valid. The problem is that the robot will move around based on the sensor data and the data can't be trusted. I'm now switched to Long distance mode and doing some more testing and see if this mode is more reliable. |
Hi @phantom-8 , |
Just wanted to report back. I've tested the newest stm32duino core (ver a4fb01). It didn't fix the UART issue that I have. I've also use the compiler flag to increase transmit & receive buffer size to 1024 and the UART receive problem still happened. However, with the larger buffer size, the problem occurrence is less frequent comparing to before. |
Well hard to tell more and I could not reproduce this. |
@fpistm, the setup is quite complicated. I've 6 sensors on the I2C bus and the UART receive problem started to occur. It was working fine under 5 sensors environment. It seems to me its timing related, as the I2C bus gets more traffic, the problem on the UART becomes more apparent. I'm currently trying to bypass the UART problem. Since the stm32 doesn't need to receive much data from the other side, I'm implementing some rudimentary handshaking using digital pins. I will open up a ticket on the stm32duino core section later after I've finished my current project. |
You do not answer the questions which board you used and which I2C pins and USART pins? |
I'm using STM32F103C8T6 Blue Pill. It's connected to another Arduino Mega 2560 via UART1 (Pin A9 & A10); and to a ESP32 via UART2 (Only Pin PA2). The connection between STM32 & ESP32 is 1 way. That is, STM32 will send information to ESP32 and only the TX2 (PA2) is connected. All 6 VL53L1X sensors are connected to the STM32 using SCL1 (PB6) and SDA1 (PB7). Each VL53L1X has the XSHUT pin connected to STM32 on Pin PB12, PB13, PB14, PB15, PA8 & PA12. The GPIO1 pin on the VL53L1X is not used. BTW, I'm currently testing another VL53L1X library from Pololu on the STM32. This library also exhibits the same UART problem and that's why I think the problem is on the Arduino core, not the library itself. @cparata, my initial testing on the Pololu VL53L1X library don't have the incorrect measurement when the RangeStatus is 0. In other words, the distance measurement is always correct when it says the data is valid. This is done on both Short & Long distance mode. |
Ok so it seems there are 2 issues. |
My report on the UART receive slowdown and missing data is a false alarm. It turns out to be the I2C bus problem. The I2C bus timed out and was slowing down my program in receiving UART data. Sometimes, the call to I2C even hang. The issue seems to be related to the 6th sensor wiring. This 6th sensor is installed on a different location than the other 5 sensors. I'm still trying to troubleshoot the exact cause. Sorry for the false alarm. BTW, I tried to slowdown the I2C clock speed to 1K by calling "Wire2.setClock(1000)". Is this correct? Or is it even possible to make the I2C bus that slow? |
Hi @phantom-8 , |
The reason to slow down the I2C bus is because I'm having problem in the 6th sensor which is now being moved to the 2nd I2C bus for diagnostics. I suspect the culprit is the wiring or interference around the I2C wires. Thus, by decreasing the bus speed, the I2C bus should be more tolerable. |
Hi @phantom-8 Maybe you met one issue referenced here. |
Hi @phantom-8 ,
Let me know if in this way the issue with Sensor 3 is mitigated. |
Any update on this ? |
@phantom-8 any update ? |
They were several update at core level around the I2C (Timing issue fixed, error management, ...). |
Under Short distance mode with timing budget and inter-measurement time of 33ms, the VL53L1X library sometimes return incorrect distance measurement even with Range Status code of 0.
The below log is from measurement of 5 sensors. The 1st column is logging time & sequence number, 2nd to 6th columns are distance measurement with range status in square brackets for 5 sensors. Some of the measurement from the 3rd sensor has 0 or small distance values even the range status code is 0. All the sensors are stationary (not moving) and pointing at fixed targets with distance of at least 1m. BTW, I've also tested with a single sensor configuration, so the problem has nothing to do with multiple sensors.
Note: The 3rd sensor is pointing at the side of a black shiny piano facing 45 degree.
The text was updated successfully, but these errors were encountered: