I wonder if you added pull-up resistors externally?
Both SCL and SDA need to be pulled up with 2K ~ 10K resistors to VDD.
If you have already done it, I'm sorry.
Yes I added 4.7K resistor.
Then it should be fine.
I like to use 4.7K, too.
Sorry for disturbing.
I tested the sensor with Arduino and works fine so the hardware should be OK. The problem is in the code I wrote, but I don't undrestand where I made a mistake.
Just for your information.
Attached is my old program for Vishay veml6075 for CY8CKIT-044.
So both sensor and board are different,
but I hope that I2C functions could be some hint.
test181009.cyprj.Archive01.zip 594.6 K
Thank you Moto,
the differences are in this photo:
I don't understand if to read a data I have to call:
I2C_I2CMasterSendStart(VEML6070_I2C_ADDRESS_W, 0, 1);
and then call the read function
I2C_I2CMasterSendRestart(VEML6070_I2C_ADDRESS_R_MSB, 1, 1) ;
and then call the stop and do the same to read the LSB register.
From the picture seems i have to call only the SendStart(VEML_6070_i2C_ADDRESS_R_MSB,1,1) and than read the byte, and do the same with the other register read for LSB.
Briefly reading your I2C_Utils are doing more complicated things than mine.
By any chance, can you modify my program to use the slave_address of your sensor and register command?
Or use some blank project with my i2c_utils.c/h just set slave_address to your sensor and call read_reg,
since VEML_6075 and VEML_6070 sound quite close, those utilities may work.
Then you can compare functions for difference(s).
Ok, I try and let you know!
I tried with your code but nothing changed, i get 0x0000 everytime i ask to read UV register
Thank you so much. From your comments and re-reading datasheet, I was able to get it running. The problems were the timing and the delay, after setting your CyDelay(1) and the 300us during the read,write and stop function everything works!!!
Thanks for the good news!
You made my day ;-)