Go to Post My opinion doesn't matter at inspection. - DonRotolo [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 24-02-2015, 16:13
jman4747's Avatar
jman4747 jman4747 is offline
Just building robots
AKA: Josh
FRC #4080 (Team Reboot)
Team Role: CAD
 
Join Date: Apr 2013
Rookie Year: 2011
Location: Atlanta GA
Posts: 418
jman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond repute
Programing VL6180 I2c Sensor I2c

I have been working on building 2 VI's for initializing and getting the range from the VL6180 sensor via I2c. I haven't used I2c before so I'm trying to see if I've done this right. Specifically the initialization (App note pages 24-25) and checking if a bit in a byte read from a register (0x4f) is 1 or 0 (App note page 7).

Data Sheet:
https://cdn.sparkfun.com/datasheets/...DM00112632.pdf

Application Note:
https://cdn.sparkfun.com/datasheets/...cationNote.pdf

Product Page: https://www.sparkfun.com/products/12784
Attached Thumbnails
Click image for larger version

Name:	VL6180 Get Range I2c.png
Views:	80
Size:	49.1 KB
ID:	18477  Click image for larger version

Name:	Open VL6180 I2c.png
Views:	98
Size:	62.4 KB
ID:	18478  
__________________
---------------------
Alumni, CAD Designer, machinist, and Mentor: FRC Team #4080

Mentor: Rookie FTC Team "EVE" #10458, FRC Team "Drewbotics" #5812

#banthebag
#RIBMEATS
#1620
Reply With Quote
  #2   Spotlight this post!  
Unread 26-02-2015, 20:33
jman4747's Avatar
jman4747 jman4747 is offline
Just building robots
AKA: Josh
FRC #4080 (Team Reboot)
Team Role: CAD
 
Join Date: Apr 2013
Rookie Year: 2011
Location: Atlanta GA
Posts: 418
jman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond repute
Re: Programing VL6180 I2c Sensor I2c

So...

It seems that some of the registers have 16bit addresses and the I2c VI only supports 8 bits (right?). To get around this I changed the initialization VI slightly so that the U-16 bit register addresses are split into two U-8 bytes with the lower 8 bits wired in to element zero of the data array and the upper 8 wired to the address input.
Attached Thumbnails
Click image for larger version

Name:	Open VL6180 I2c V2.png
Views:	70
Size:	60.8 KB
ID:	18500  
__________________
---------------------
Alumni, CAD Designer, machinist, and Mentor: FRC Team #4080

Mentor: Rookie FTC Team "EVE" #10458, FRC Team "Drewbotics" #5812

#banthebag
#RIBMEATS
#1620
Reply With Quote
  #3   Spotlight this post!  
Unread 11-03-2015, 10:55
zstreet zstreet is offline
Registered User
no team
 
Join Date: Mar 2015
Location: Michigan, USA
Posts: 1
zstreet is an unknown quantity at this point
Re: Programing VL6180 I2c Sensor I2c

Quote:
Originally Posted by jman4747 View Post
So...

It seems that some of the registers have 16bit addresses and the I2c VI only supports 8 bits (right?). To get around this I changed the initialization VI slightly so that the U-16 bit register addresses are split into two U-8 bytes with the lower 8 bits wired in to element zero of the data array and the upper 8 wired to the address input.
I am also trying to establish communication to a VL6180X through LabVIEW.

I am using LabVIEW 2013 so I cannot open your 2014 snippets to look at the subVIs. You are using a different set of I2C subVIs than me.

I also have a different breakout board:
https://www.tindie.com/products/oneh...range-finding/

Putting a scope on my SDA and SCL lines I have not gotten an acknowledge from the VL6180X yet. Currently I think I might have fried the regulator on my board.

Concerning your issues: the split number takes the high 8 bits and separates it from the low 8 bits but both are in the original format of U16. After the split number subVI you need to convert them to U8 also. Without downloading the I2C VIs I cannot be certain but it should be set up so that the Slave Address that you are putting in as 0x29 needs to be shifted 1 bit to 0x52.
Reply With Quote
  #4   Spotlight this post!  
Unread 11-03-2015, 15:11
Richard100 Richard100 is offline
Registered User
FRC #0836 (RoboBees)
Team Role: Mentor
 
Join Date: Nov 2009
Rookie Year: 2008
Location: Southern Maryland
Posts: 79
Richard100 is a splendid one to beholdRichard100 is a splendid one to beholdRichard100 is a splendid one to beholdRichard100 is a splendid one to beholdRichard100 is a splendid one to beholdRichard100 is a splendid one to behold
Re: Programing VL6180 I2c Sensor I2c

With the advent of the new WPI I2C vi's for LabVIEW 2014, you no longer need to left-shift the slave (device) address by one bit. Simply use the sensor spec sheet I2C address within Labview.
Reply With Quote
  #5   Spotlight this post!  
Unread 11-03-2015, 18:06
jman4747's Avatar
jman4747 jman4747 is offline
Just building robots
AKA: Josh
FRC #4080 (Team Reboot)
Team Role: CAD
 
Join Date: Apr 2013
Rookie Year: 2011
Location: Atlanta GA
Posts: 418
jman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond repute
Re: Programing VL6180 I2c Sensor I2c

Quote:
Originally Posted by zstreet View Post
Putting a scope on my SDA and SCL lines I have not gotten an acknowledge from the VL6180X yet. Currently I think I might have fried the regulator on my board.

Concerning your issues: the split number takes the high 8 bits and separates it from the low 8 bits but both are in the original format of U16. After the split number subVI you need to convert them to U8 also. Without downloading the I2C VIs I cannot be certain but it should be set up so that the Slave Address that you are putting in as 0x29 needs to be shifted 1 bit to 0x52.
Don't think you fried it that thing has a crazy complex communications setup that wont respond until after a lot of set up has been preformed. Your breakout has a regulator for use with 3-5.5V so if you are plugging directly into the roboRIO/CRio you will l be fine.

The solution I was working on started with setting up an arduino with the working library and checking function of the sensor, then If it worked figure out what that code was doing and mimic it. By that point I had gotten the RIO to write addresses and data in the correct order. Hint: Have an arduino hooked up to the RIO and have it print what it receives to the serial monitor, I can't imagine trying to debug I2C with a scope. I think for this you will need a bi-directional I2C safe level converter: https://www.sparkfun.com/products/12009

In the end I couldn't figure out exactly all the steps and the order of which the arduino handles the amazing amount of initialization steps by reading the example and source files. The other problem was filtering out steps that set up ALS measurement because I don't need that feature. If I had the time and a bit more C++ experience I could do it.

So after a day of fiddling with it I gave up and focused on using a one of the analog SHARP IR proximity sensors for now. I will go back once I have some time later, this thing is a little tough for someone who hasn't used I2C before.

Post your 2013 code and I can look at it. I can write a 2013 example as well.
Attached Thumbnails
Click image for larger version

Name:	Open VL6180 I2c.png
Views:	54
Size:	108.2 KB
ID:	18607  
__________________
---------------------
Alumni, CAD Designer, machinist, and Mentor: FRC Team #4080

Mentor: Rookie FTC Team "EVE" #10458, FRC Team "Drewbotics" #5812

#banthebag
#RIBMEATS
#1620
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:20.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi