-
Notifications
You must be signed in to change notification settings - Fork 156
[driver] driver for ST vl53l5, vl53l7, vl53l8 #1296
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
base: develop
Are you sure you want to change the base?
Conversation
d5c4350 to
1d8b904
Compare
chris-durand
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! I don't have the time for a full review because I'll be on a dive boat in the Andaman sea in 2 hours ;)
Putting ST's code into ext is the right way to go. Getting it from the website is also fine because it's BSD licensed and you are providing the automated update script. @salkinium or @rleh can probably help with making a repo in modm-ext.
b2b4199 to
b2d643f
Compare
|
All examples work in HW now. If you set up the ext repo, I can add the submodule and move the ST files there... |
|
I created https://github.com/modm-ext/vl53-partial and granted you access. |
|
Adding submodule done. |
84974a0 to
a2d2cda
Compare
salkinium
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, just some minor improvements needed.
b5d0896 to
b24a4ac
Compare
|
Thank you @salkinium for the detailed review, I tried to address most of the issues, only the stack and example include questions remain. I left the stack as is because the I2C examples seem to need this, I changed the SPI examples stack to 16kB. |
2ed7da9 to
12f448e
Compare
|
Yes, the macOS CI is super slow (~2h), I'm trying to fix it over at #1301. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this, thank you! I will have a look at the submodule until Monday and check if I can get it to update automatically by going past the login wall like we do for the CubeMX database.
| Cs::reset(); | ||
| // SpiMaster::transfer(&tx_buffer[0], nullptr, data_size); | ||
| SpiMaster::transfer(addr_buffer, nullptr, sizeof(addr_buffer)); | ||
| SpiMaster::transfer(&p_values[position], nullptr, data_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dumb question: Why are we chunking this here? Is there a limit on the SPI transfer length? Cos the I2C just dumps 32kB of data into the sensor in one transfer, if I understand this correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ST ULD implementation does this and due to the lack of documentation for the sensors besides the provided drivers, I just did the same.
I can test tomorrow if we can just write the entire firmware blob at once.
STs Ultra Light Driver for VL53L5 (I2C), VL53L7 (I2C), and VL53L8 (I2C, SPI) 8x8 Pixel Time-of-Flight Sensors
As the interaction with the sensor is pretty complicated (many undocumented registers and huge binary blobs), I use the ultra light drivers (ULD) for the sensors as provided by ST.
If you think this is a good way of integrating support for these sensors, I suggest to add these ULDs as a submodule under ext (see temp commit here for proposed structure). Does this work for y'all?
The VL53L5 driver exists undre STs namespace on github, the VL53LMZ driver for VL53L7 and VL53L8 only on STs website, I thus decided on STs website as datasorce for all drivers; I hope this is fine?
The
update.pyscript in the future submodule automatically extracts the files, fixes some typos and bugs in their C-API, prefixes global functions with "VL53_", and unifies the use of theVL53_Platformstruct among both drivers and their examples.modm transport
I added the modm transport SPI and I2C classes in the
ext/vl53folder, is this the right place or should they go in thesrc/modm/driver/positionfolder?Examples
The VL53L8 sensor supports SPI and I2C, the VL53L7 sensor (same driver as the VL53L8 but wider field of view) supports only I2C, the VL53L5 supports only I2C.
Examples should cover these cases.
Todos:
Future plans: