bitbank2 / VL53L0X

A simple C library to read the distance values from the VL53L0X time of flight sensor
Other
54 stars 23 forks source link

initSensor returns 0 #1

Open hsch0 opened 6 years ago

hsch0 commented 6 years ago

I can't get the demo code to work on my Raspberry Pi. I changed the main.c file already to i = tofInit(1, 0x29, 1). The application always exits with -1 because the function static int initSensor(int bLongRangeMode) returns a 0. Should the GPIO Pin be connected to the Raspberry?

the sensor and my i2c interface should be ok: root@raspberrypi:~/VL53L0X# i2cdetect -y 1

0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --

bitbank2 commented 6 years ago

It sounds like you're doing everything correctly. I don't remember if I tested it on the RPI, but I do know that some devices (e.g. CCS811) do clock stretching and the RPI I2C can't handle it properly. Do you have a non-RPI board to test it on?