2024-10-06 11:22 PM - edited 2024-10-07 12:11 AM
I am trying to use VL53l8cx with STM32F407VGT6 to find depth . I have previously worked with VL53l5cx and VL53l1cx and was comfortab;e with both of these . I am unable to use this sensor at all as everytime a hard fault arises .
I have been able to use it on Arduino but wasnt able to use it with any st controller or dev board.
The link to the projects is below:
https://drive.google.com/drive/folders/1tsidyGcB8i_SaHW2IKRrtKeJuAWvVb6X?usp=drive_link
https://drive.google.com/drive/folders/17VWmdfnXCuZRXwIgr5QM44ov2SjAzd09?usp=drive_link
This is where the hardfault occurs :
2024-10-07 07:49 AM
I just posed this on a similar query:
The VL53L8CX actually has an MCU in it, and that 80K of code you write to it to start the sensor is the Firmware running in that sensor.
As such a 'register map' would more reasonably be called an interface protocol. But we do communicate over the i2C using addresses - and for all the world it's a register map. But a pretty complex one.
There are a couple of ways you can hook up that stm32f4 discovery. If you are using the VL53L8-satel, you might be having a known issue with the SPI (Our supply stuffed the wrong level shifter.)
Solved: VL53L8CX SPI doesn't work properly - STMicroelectronics Community
Check your board for the wrong part.
It was also noted that if you run the SPI too slowly it has an issue. 3Mbits seems to work just fine.
But you should be able to get the sensor running with the I2C.
The startup code downloads some 80K and we have to change pages to get it all downloaded. That's register 0x7fff.
When running all the communication is done on the same page.
If using a non-ST MCU sometimes the I2C cannot make those large I2C transfers, and one has to break them into smaller chunks. (This is not your issue, but it happens to others. )
Don't give up on the APi so quickly please. Running this beast with a register map can be done, but it took us years. And you would end up hating ST. The API is validated and well tested. It has lots of advantages.
See if any of that solves your issue.
As you are not getting the firmware to download, it limits the issue to either an SPI part issue, the SPI speed issue or a mis-configured I2C.
2024-10-07 09:05 AM
@Rituraj wrote:I am unable to use this sensor at all as every time a hard fault arises .
On debugging Hard Faults: