VL53L4CX Setup Problems / Hard Fault?
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:
- I create a new project with Board Selector, NUCLEO-U575ZI-Q.
- I click Software Packs, and Select the dropdown for X-CUBE-TOF1.
- I select VL53L4CX under the Board Part Ranging dropdown.
- I setup a GPIO pin on the Nucleo for XSHUT, see below.

- 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.
- In Middleware and Software Packs, I choose X-CUBE-TOF1, and choose the GPIO for VL53L4CX _XSHUT and I2C2 for VL53L4CX BUS IO driver.
- Then, I setup the code as below:




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:

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:

Schematic for VL53L4CX Breakout Board.

PCB Design for VL53L4CX Breakout Board.

X-CUBE-TOF1 setup and MCU pinout.

Physical Setup with Nucleo and Breakout Board.
