VL53L1X with atmega328
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-05-31 3:07 AM
Hi,
I have project for obstacle distance measurement where VL53L1X sensor is used and the microcontroller is Atmeag 328. I have downloaded API reference code. But there are lot of files which is really confusing me. I have used single sensor in my project. I have written software I2C to read basic register information from VL53L1X. I am able read the following registers properly.
Model ID - 0x010F - Am reading 0xEA which is correct
Model Type - 0x0110 - Am reading 0xCC which is correct
Mask Revision - 0x0111 - Am reading 0x10 which is correct
But to measure the distance there are lot of API's. It would be really helpful if i get any sample code or example code with atmel Microcontroller.
Kindly help me.
- Labels:
-
Time of flight
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-06-06 4:00 PM
You are most of the way there. Don't quit now. There is a bit of code called X-Cube-vl53l1x. It's available at:
With the code you have written, you are all set. Copy the calls from the main.c and it will just work for you.
And this code makes a pretty handy reference - even if you don't use an ST processor.
For example:
status = VL53L1_WaitDeviceBooted(Dev);
status += VL53L1_DataInit(Dev); status += VL53L1_StaticInit(Dev); status += VL53L1_SetPresetMode(Dev,VL53L1_PRESETMODE_LITE_RANGING); status += VL53L1_SetDistanceMode(Dev, VL53L1_DISTANCEMODE_MEDIUM); status += VL53L1_SetMeasurementTimingBudgetMicroSeconds(Dev,20000); //status += VL53L1_SetInterMeasurementPeriodMilliSeconds(Dev, 100); status += VL53L1_GetMeasurementTimingBudgetMicroSeconds(Dev, &pMeasurementTimingBudgetMicroSeconds); printf('Timing Budget = %d\n', pMeasurementTimingBudgetMicroSeconds);status += VL53L1_StartMeasurement(Dev);
if(status){
printf('YOU DID SOMETHING WRONG \n'); while(1); } if (isInterrupt){ do // interrupt mode { __WFI(); if(IntCount !=0 ){ IntCount=0; status = VL53L1_GetRangingMeasurementData(Dev, &RangingData); if(status==0){ printf('%d,%d,%.2f,%.2f,%d\n', RangingData.RangeStatus,RangingData.RangeMilliMeter, RangingData.SignalRateRtnMegaCps/65536.0,RangingData.AmbientRateRtnMegaCps/65336.0,HAL_GetTick()); } status = VL53L1_ClearInterruptAndStartMeasurement(Dev); } } while(1);If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-06-08 4:27 AM
Thank you john kvam
it was useful
