-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Sensor VEML770 data not change (Wire) #1657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@asetyde there was one significant change to // set i2c device internal register pointer and read 20 bytes from there
Wire.beginTransmission(id);
Wire.write(registerHigh);
Wire.write(registerLow);
uint8_t err = Wire.endTransmission(false);
// since sendStop==false, this write() command was queued until a stop if issued, so the returned status
// is set to 7 (continue) to indicate this.
if( err!=7){ // something went wrong
Serial.printf("Error setting register pointer =%d (%s)",Wire.lastError(),Wire.getErrorText(Wire.lastError()));
}
else { // read from device
uint8_t count = Wire.requestFrom(id,20); // sendStop==true, default argument value if not explicitly set
if(count == 0){ // error condition for requestFrom()
Serial.printf("Error reading data =%d (%s)",Wire.lastError(),Wire.getErrorText(Wire.lastError()));
}
else {
while(Wire.available()){
Serial.printf("0x%02x ",Wire.read());
}
Serial.println();
} Chuck. |
|
( Also I've tried to restore to 27 June i2c.h/c and wire.cpp/wire.h but came many strange errors on WIFI generic and WIFISTA files .. on complier ) |
@asetyde I'll look through that library and see if I can find any problem. Chuck. |
Many many thanks @stickbreaker ! |
@asetyde found one Wire.endTransmission(false), I'll keep looking through the code. Chuck. |
@asetyde change this code in the VELM7700.cpp from: uint8_t
VEML7700::
receiveData(uint8_t command, uint16_t& data)
{
Wire.beginTransmission(I2C_ADDRESS);
if (Wire.write(command) != 1){
return STATUS_ERROR;
}
if (Wire.endTransmission(false)){ // NB: don't send stop here
return STATUS_ERROR;
}
if (Wire.requestFrom(uint8_t(I2C_ADDRESS), uint8_t(2)) != 2){
return STATUS_ERROR;
}
data = Wire.read();
data |= uint16_t(Wire.read()) << 8;
return STATUS_OK;
} to: uint8_t
VEML7700::
receiveData(uint8_t command, uint16_t& data)
{
Wire.beginTransmission(I2C_ADDRESS);
if (Wire.write(command) != 1){
return STATUS_ERROR;
}
if (Wire.endTransmission(false) != 7 ){ // NB: don't send stop here
return STATUS_ERROR;
}
if (Wire.requestFrom(uint8_t(I2C_ADDRESS), uint8_t(2)) != 2){
return STATUS_ERROR;
}
data = Wire.read();
data |= uint16_t(Wire.read()) << 8;
return STATUS_OK;
} Chuck. |
Seems worked !!! |
many many thanks chuck ! |
Sorry but with last 1.0.0 sensor FAIL @stickbreaker |
it's fixed for me @stickbreaker !! do you fix on library ? |
there was an command of Wire.reset() in previous versions it helped me to recover if i2c got struck...but it has been removed...any alternative for that? |
@usmanshahid001 with Chuck fix it working, about your ask, I can not reply, maybe Chuck ! |
@usmanshahid001 I'll see if I can recreate a compatible reset(). Chuck |
many thanks ! |
@usmanshahid001 the functionality of I'm testing an update that has a couple of changes to
Chuck. |
@stickbreaker thanks brother . |
@usmanshahid001 just uploaded these changes into pr #1717. Try it. Chuck. |
Fixed on #1717 =) |
I reload esp32 library and problem returns .. I think something is not go with fix ? |
Error reported from sensor 255 , from function -> uint8_t getAutoALSLux(float& lux) -> getAutoXLux -> |
WORK with version 1.0.0 rc1 |
But I've develop on board manager but I see only 1.0.0 and rc1 rc2 rc3 rc4 .. but no news on new update library ?? |
@stickbreaker Hi, with 1.01 rc1 sensor work but I find some freeze of i2C, because I see with microchip cap1296 , touch some times after light sensor work not response for 5 seconds , sometimes for many minutes ! Please do you have an idea about it ? |
@asetyde you can use if( Wire.busy() ) {
bool success = Wire.begin(); // reset i2c hardware, uses previously configured sda,scl pins and frequency.
if ( !success){
// if Wire.begin() failed, then the i2c bus will not work. If Wire() could not clear the bus (SDA and SCL high)
// then it cannot configure the i2c peripheral. until Wire.begin() succeeds, all i2c functionality is dead.
Serial.printf("i2c Bus reset failed, SCL=%d, SDA=%d \n",digitalRead(SCL),digitalRead(SDA));
} if you get a failure error code from either You need to find out what is locking up, the touch sensor, the 'light' sensor or the esp32. Then either change the circuit to handle the ESD(electro static discharge) and have some method to reset the 'locked up' component. Chuck. |
Sensor library VEML770 is killer, but at now I try your code, to investigate |
My sensor continues to read light, when change level change led level, when I turn off light I try to use touch cap1296 microchip but it's seems freeze , I turn on light and go ... some remain blocked |
Hi , i risolve bug on freezer i2c , ALSAutoLux with algoritm code has a strange bug , freeze i2c . i risolve not using ALS |
Hardware:
Board: ESP32 Wroom
Core Installation/update date: 1.0.0_rc3
IDE name: Arduino ide 1.8.5 and visual micro
Flash Frequency: 80Mhz
Upload Speed: 115200
Description:
Sensor VEML770 data not change after commit a59eafb before, data is updated correctly and sensor work, I've tried to go back with git but too many error with esptool, it's not possibile create a special realese before 27 June ?, too many big commit to find error .
Sensor VEML770 use wire, i2c;
Debug Messages:
none
The text was updated successfully, but these errors were encountered: