- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everybody,
I'm working on CYBLE222014, to read data from an UV sensor from Vishay (VEML6070). This sensor has one write register(0x70>>1) and two read register(0x71>>1 and 0x73>>1), for UV MSB and LSB. In the datasheet they say to inizialize the sensor with 2 step: first read ACK register(0x18>>1) and second write 0x06 in write register(0x70>>1); than you can read the UV value from the 2 registers, but if i run my code i read only 0x0000. I think i make a mistake in the read function, but I checked many times and seems OK.
Any idea to solve?
Best Regards
Francesco
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
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).
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
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.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes I added 4.7K resistor.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Then it should be fine.
I like to use 4.7K, too.
Sorry for disturbing.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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);
I2C_I2CMasterWriteByte(....);
and then call the read function
I2C_I2CMasterSendRestart(VEML6070_I2C_ADDRESS_R_MSB, 1, 1) ;
I2C_I2CMasterReadByte()
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
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).
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, I try and let you know!
Francesco
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried with your code but nothing changed, i get 0x0000 everytime i ask to read UV register
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Momo,
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!!!
Francesco
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Francesco-san,
Thanks for the good news!
You made my day 😉
Best Regards,
22-May-2020
Motoo Tanaka