VL53LnX

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Folks,

 

Has anyone successfully integrated the VL53L0X or VL53L1X with any XMEGA?  Or know anyone outside this forum who can help me with this?  In particular, I'm targeting the ATXMEGAC3 Xplained board.

 

Thanks for your help,

Mark Pham

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Since teh OP could not provide links to what they want to interface to:

 

https://www.adafruit.com/product...

 

https://www.pololu.com/product/3415

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Apart from i2c, there’s nothing specific to the xmega, so checkout the adafruit link that Jim provided. That should lead you to the ST api code.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Jim and Kartman, but those designs are for the MEGAs not the XMEGAs, which I thought would be straight forward, but has proven to be more difficult than I've anticipated.  Tried to roll my own XMEGA TWI driver, tried AVR's example driver, tried other drivers from the internet, still no go.  Will try porting the Wire class for the MEGA Arduino to XMEGA.  In the meantime, if anyone's got the VL53LnX sensors working with the XMEGA, please let me know.

 

Regards,

Mark Pham

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mark_pham wrote:
Tried to roll my own XMEGA TWI driver, tried AVR's example driver,

 

Why not simply use Atmel START to configure the TWI in the XMEGA?

 

https://start.atmel.com/

 

KIds these days....gotta do things the hard way....

 

POOF!!! Done!

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
Apart from i2c, there’s nothing specific to the xmega

 

mark_pham wrote:
those designs are for the MEGAs not the XMEGAs

You seem to have entirely missed Kartman's point!

 

The VL chip neither knows nor cares what microcontroller you use - all it sees is the transactions on the I2C bus.

 

So the only bit that's specific to a particular microcontroller (ATmega, Xmega, PIC, STM32, whatever)  is the low-level I2C driver.

 

If you're stuck with getting an I2C driver working, that's clearly a fundamental problem - nothing to do with the VL chips!

 

I would suggest getting the I2C working with some "standard" peripherals before moving on to something more esoteric like these VL things.

 

Something like this: https://www.avrfreaks.net/commen...

 

What debug tools do you have - both for the software, and the hardware?

 

An oscilloscope or logic analyser is indispensable for this kind of stuff ... 

 

I2C basics: https://www.avrfreaks.net/commen...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Tue. Dec 3, 2019 - 09:42 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Apart from the excellent suggestions above just to point out that if I type "Xmega TWI application note" into Google it says: http://ww1.microchip.com/downloa...

 

Atmel (now Microchip) have application notes covering most of the Xmega peripherals (they all have numbers like AVR1301, AVR1302 etc). There will be .zip files with example code to accompany each of the PDFs too.

 

(you may well find that the example code you get out of start.atmel is remarkably similar to these app notes anyway ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@ Mark Pham: Note that the Application Notes are also available on the Product Page for the chip:

 

eg,  https://www.microchip.com/wwwproducts/en/ATXMEGA384C3  - look on the 'Documents' tab ...

 

Would probably also be worth getting an XMEGA-C3 Xplained board:

 

https://www.microchip.com/DevelopmentTools/ProductDetails/PartNO/ATXMEGAC3-XPLD

 

no doubt there are I2C examples for it ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...