Page 1 of 1

VL53L0X stand-alone and forcing drivers

Posted: Thu May 18, 2017 4:37 am
by bpospeck
Along the same vein as this topic viewtopic.php?f=6&t=2410, I'm wondering if using just the raw sensor from here should still be able to function with the existing Z-ranger code.

If so, it seems to me the only relevant pins I'd need to connect to the Crazyflie are Vin, GND, SDA, and SCL. Is that correct? After that, it should be good to go after forcing the driver for it I believe.

That leads me to another question. Is it possible to force multiple drivers in the file?

Thanks in advance for the help!

Re: VL53L0X stand-alone and forcing drivers

Posted: Thu May 18, 2017 8:29 am
by arnaud

Yes it is possible to use this kind of breakout with the zranger driver. As long as your breakout board can be powered with 3V it will work.

The breackout board should be cabled the same way as the Zranger board. Vin, gnd, sda and scl are indeed enough.

Forcing multiple driver is not currently possible. I wanted to implement it as a colon-separated-list (so that one would be able to be able to force "bcZRanger:bcBuzzer" for example), but I never took the time to implement it.

One fairly quick hack to activate two decks (we have had to do it for some development) is to add and use another FORCE_DECK define in the deck init file: ... ore/deck.c.

Re: VL53L0X stand-alone and forcing drivers

Posted: Fri May 19, 2017 2:08 am
by bpospeck
I have tested my VL53L0X with the 3.3V from an Arduino and it does work. Whenever I try to use it with the Crazyflie and Z-ranger driver it doesn't seem to work.

I've double checked my pin connections, and made sure everything is up to date and flashed. When connecting with the client, it shows the value in the actual height box around the mid 1650's pretty consistently. This appears to be what the readings show when it isn't plugged in at all too. I've even tried it in different lighting conditions from bright to dim. The wired connection shouldn't be an issue: I essentially have the long CF pins sticking through the bottom of the board and attached to female-female headers which attach to the VL53L0X pins. The female headers are holding well on both ends, no loose connections are present. I'm running out of ideas on what to check with this.

And for the extra deck hack, essentially just copy and paste all the code blocks involved with the deck_force/DECK_FORCE, renaming all instances of deck_force/DECK_FORCE.

Thanks for your help!

Re: VL53L0X stand-alone and forcing drivers

Posted: Mon May 22, 2017 10:05 am
by arnaud
First things is to make sure the vl53 driver is really starting. To do that you can disconnect the VL sensor and then the Crazyflie should not start correctly: it will hang before blinking the M1 LED green.

You can also look at the console:

Code: Select all

DECK_CORE: Initializing compile-time forced driver bcZRanger
Next you can look at the raw measurement data, it is the log variable "range.zrange". You can setup a log block and look at it in the plotter to see if the measurement are really taken.

If both these test works, then your cabling is right and there is a bug somewhere else, most likely in the Crazyflie firmware, and we need to track it.

Re: VL53L0X stand-alone and forcing drivers

Posted: Thu Feb 25, 2021 1:45 am
by imranmomtaz

I got to make it work by the following code:

Code: Select all

CFLAGS += -DDECK_FORCE=deck1:deck2
Please note, the following does not work:

Code: Select all

CFLAGS += -DDECK_FORCE=deck1 : deck2
It is probably better to adjust code to take care of whitespace.

Re: VL53L0X stand-alone and forcing drivers

Posted: Thu Feb 25, 2021 9:38 am
by arnaud
Spaces would not have worked without adding quotes around it anyway since CFLAGS is passed as argument to gcc during the compilation.

Rather than handling space in the firmware (which tend to be a non-trivial task in embedded C), I think this should be handled by better documentation. Maybe adding a note in the file?