cancel
Showing results for 
Search instead for 
Did you mean: 

Interface VL6180 ToF proximity sensor to a 3rd-party controller

ST-user
Associate

Hi,

I'm trying to get the VL6180 Time-of-Flight (ToF) proximity sensor working with the SAM E54 Xplained Pro evaluation kit.

Hardware Setup:

Current Status:

  1. SERCOM3 is connected to SDA on PA2 and SDL on PA23

  2. The external interrupt (GPIO 1) is connected on PB08

  3. GPIO 0 is connected on PB09

  4. Using the VL6180X API (v2.3.1)

Goal:

  • Get the VL6180 working via I2C

  • Operate the sensor in interrupt mode to read sensor data

I attempted to use the VL6180X API (v2.3.1), but it needs to be ported to the SAM E54. I'm struggling to understand:

  1. Which parts of the API need modification for the SAM E54?

  2. How to correctly implement I2C communication with the VL6180 using the API?

  3. How to configure and handle interrupt-based operation on the SAM E54?

  4. Are there any example projects or resources that could help with this setup?

Any help or guidance would be greatly appreciated! Thanks in advance.

1 REPLY 1
John E KVAM
ST Employee

Be a little careful here please. The VL6180 is going out of production. Last orders are in March. Not an issue if this is a college project, but please switch to the VL53L4CD if you plan on going into production.

Once you have applied power, and the XShut pin has been lifted, you should be able to communicate.

Being able to read the chip Id is your first goal.

As delivered our code just works - assuming of course you have a C compliler.

But there is an issue - we do not know how your I2C is programmed. 

Therefor there is a program.c file that is basically empty. 

It's your job to place the I2C read byte and write byte calls your MCU uses into this file. 

Go to github and have a look around. Find a project that writes bytes and words to any sensor using this MCU. 

Then 'borrow' that code an insert it into the RdByte functions that are in Platform.c

The functions you are going to need to fill out for your MCU are:

VL6180_API int VL6180_I2CWrite(VL6180Dev_t dev, uint8_t  *buff, uint8_t len);
VL6180_API int VL6180_I2CRead(VL6180Dev_t dev, uint8_t *buff, uint8_t len);

VL6180_API int VL6180_i2c_init(VL6180Dev_t dev, char *comPortStr, unsigned int baudRate);
VL6180_API int VL6180_i2c_fini(VL6180Dev_t dev);

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.