cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L4CX Setup Problems / Hard Fault?

cory9
Associate

Hello, I am having trouble with the VL53L4CX Sensor for my Capstone Design Project. My group created our own breakout board for the sensor, and I was able to get it up and running with the VL53L4CX_SimpleRanging project provided by ST.

However, I am having trouble figuring out the setup for our own project. Here's my steps to get to my problem:

  1. I create a new project with Board Selector, NUCLEO-U575ZI-Q.
  2. I click Software Packs, and Select the dropdown for X-CUBE-TOF1.
  3. I select VL53L4CX under the Board Part Ranging dropdown.
  4. I setup a GPIO pin on the Nucleo for XSHUT, see below.
     
    cory9_1-1740376058750.png

     

  5. I setup I2C2 with Fast Mode, and connect the VL53L4CX breakout board to the Nucleo Board (SCL to SCL, SDA to SDA, XSHUT to GPIO, AVDD to 3.3V, IOVDD to 3.3V, GND to GND). I also setup UART1 for terminal debugging.
  6. In Middleware and Software Packs, I choose X-CUBE-TOF1, and choose the GPIO for VL53L4CX _XSHUT and I2C2 for VL53L4CX BUS IO driver.
  7. Then, I setup the code as below:  
     cory9_3-1740376144306.png

cory9_4-1740376180798.png

cory9_5-1740376201638.png

cory9_6-1740376230036.png

This code compiles and I enter debug mode. However, when I click run, it immediately stops and I see this HardFault_Handler() as shown below:

cory9_7-1740376256453.png

This is where I am stuck. I've provided some files/screenshots that may help, including the breakout board design. Please feel free to ask for further information if needed. Any help is much appreciated, thank you so much.

 

Additional Screenshots:

cory9_8-1740376286911.png

Schematic for VL53L4CX Breakout Board.

 

cory9_9-1740376304396.png

PCB Design for VL53L4CX Breakout Board.

 

cory9_10-1740376322183.png

X-CUBE-TOF1 setup and MCU pinout.

 

cory9_12-1740376438474.png

Physical Setup with Nucleo and Breakout Board.

 

3 REPLIES 3
Ozone
Lead III

> This code compiles and I enter debug mode. However, when I click run, it immediately stops and I see this HardFault_Handler() as shown below: ...

The window on the left side in this image is the call trace.
Which seems to indicate something is missing with the timer / delay implementation.

 

Thanks for giving me a lead, although I'm not sure what my next steps are since the example project does not have any timers enabled. Also, I forgot to provide this is the debugger console error that I receive:

cory9_0-1740382654324.png

 

You are using Cube / HAL, which uses the Systick timer for delay purposes by default.
One of the reasons for me to not use Cube / HAL.

> ... and I was able to get it up and running with the VL53L4CX_SimpleRanging project provided by ST.

You can compare the code of your current project with this one, especially the sensor startup phase and the related timing.
Perhaps setting a breakpoint in the systick handler.