-
Notifications
You must be signed in to change notification settings - Fork 85
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
LIDAR-Lite v3HP - NACK attack on Arduino Due #23
Comments
Garmin has not tested the v3HP with an Arduino Due. That being said - You shouldn't have too many problems, but the Arduino Due boards can be finicky. The Wire.h library is also less than perfect. There may be other I2C library solutions available that you could try and possibly get better results if you want to continue with a Due. However, below are a few things you could quickly try to see if they help. No guarantees. Good luck!! 1 - Since you are using the Due, you can remove most everything inside the #ifdef for FAST_I2C except the call to Wire.setClock(). This will make the code easier to read/follow and then you can try changing the I2C bus speed and see if it helps.
2 - The Due has external pullup resistors on the I2C bus (the UNO does not). The code in the v3HP example sketches will cause internal pullups to be activated by default. You don't want both, so you should turn off those internal pullups when using the Due and see if that helps. This can be done by adding these two lines of code directly after the I2C initialization instructions in the setup() routine -
3 - I've found that the Due doesn't perform a repeated START on the I2C bus when using the Wire library read functions as written like they are in the Arduino Library source for the v3HP. Try replacing the read() function in the library with the following to get the Due to use a repeated START during a read and see if that helps -
|
Glad that the read functions appears to be fixed. I'm honestly not sure what to tell you about the write side of things. Unfortunately, Garmin doesn't have any further insight on the Arduino Due as it hasn't been tested with the v3HP. Garmin's platform for the code base here was an Arduino UNO and the base is merely an example of how one can communicate with the LIDAR-Lite v3HP. Its main purpose is to help illustrate how someone might design their own application. If you want to continue with a Due, I would suggest examining your I2C bus signaling to try to determine where the issue might be. Then if you can point to an issue with the LIDAR-Lite you can go through Garmin Support to report your findings and get help. If you're open to a different platform, this code base does work very well on the Arduino UNO. I've also used this code with an Arduino MEGA in the past and had good luck, so that's another low cost option for you to try. No guarantees, of course. Sorry I can't be more help. Please report back if you find something interesting. Good luck! |
I have tested LiDAR 3HP on both Arduino UNO and Due microcontroller board with I2C connection. It seems like the Due microcontroller is always encountered by NACK attack comparing to UNO board and I found the value of nackCatcher is 2 returning from endTransmission(). I suspect that the Due board clock speed affects the performance on LiDAR 3HP which I added delayMicroseconds() command after each write() and read() function in LIDARLite_v3HP.cpp to ensure that master and slave device have sufficient time to acknowledge. After several trying, it still remains unsolved.
The text was updated successfully, but these errors were encountered: