Showing results for 
Search instead for 
Did you mean: 

How to use VCNL4040 with STM32 ?

Associate II

I am trying to integrate VCNL4040 with stm32, but having issues in that, is there any library available for integrating the same.

Associate II

I have the same concern as you. I connected the VCNL4040 to an STM32L0 series MCU. It seems I am able to write to the sensor, but not able to read. I connected the same sensor to the Arduino Uno board and everything worked well. There are some minor difference in the signals observed on Oscilloscope, between the STM32 and Arduino boards.

Could you resolve your problem? Do you have any comment on my problem?


Associate II

I had the same issue first.

The problem was that I2C read procedure requires a "repeated start" condition instead of "Stop/Start" between Write and Read procedure.

Do not use HAL_I2C_Master_Transmit and HAL_I2C_Master_Receive combination to read a register.
Use HAL_I2C_Mem_Read only which performs a repeated start condition --> VCNL3040 works