opendata-stuttgart / sensors-software

sourcecode for reading sensor data
571 stars 309 forks source link

Problems with I2C - DNMS sensor not found #951

Closed imaluschi closed 1 year ago

imaluschi commented 2 years ago

Update of firmware of existing (and working) Sensors makes problems, the DNMS is not found anymore.

Configuration

I'm not able to investigate deeper. Idea, anyone?

pjgueno commented 2 years ago

Thanks a lot for you complete description !

I am on the NRZ-2020-133/DE firmware for my DNMS: Capture d’écran 2022-02-04 à 20 07 14 But the Teensy was not updated for a long time.

Can you try to flash the latest.bin with the flasher ?

I hope it is not something with the DNMS code. In that case can you also open an issue here? https://github.com/hbitter/DNMS/issues

Can you also check for interferences in the I2C line to the DNMS. It is a reported issue. How long is your cable ? Do you have an extension bus ?

I will check the PowerOntestsensor() function. I don't think something changed in it for a longtime.

imaluschi commented 2 years ago

No extension bus (as described), cable about 150mm long. Can't imagine interferences, the cable is shielded, connection with plug (XH2.54) on both sides. Tried also to unplug the BME280, as expected DNMS is the only I2C device detected before powerOnTestSensors(); and not detected afterwards. DNMS was additionaly plugged to Laptop during the tests, therefore not rebooted because of plugging/unplugging to/from power. As written, it is detected before powerOnTestSensors() and not afterwards, no change during this time on the DNMS.

airrohr-firmware was also updated via AutoUpdater, to stable version NRZ-2020-133 and to beta version NRZ-2021-134-B4 - I think that will make flashing the bin obsolete P2040389

P2040388_zugeschnitten .

imaluschi commented 2 years ago

Inserted the I2C-Scanner into powerOnTestSensors()

if (cfg::bmx280_read)
{
     Debug.println("powerOnTestSensors(), BMX280 ( if (cfg::bmx280_read) )");
     i2cScanner();  
        debug_outln_info(F("Read BMxE280..."));
        if (!initBMX280(0x76) && !initBMX280(0x77))
        {
            debug_outln_error(F("Check BMx280 wiring"));
            bmx280_init_failed = true;
        }
     Debug.println("powerOnTestSensors(), BMX280 Ende )");
     i2cScanner();
}

Screenshot_20220205_132305 Seems ok.

The DNMS is always found in 0x55, but not reconized after initDNMS(). A short time later, after finishing powerOnTestSensors() ist is recognized again.

if (cfg::dnms_read)
{
      Debug.println("powerOnTestSensors(), DNMS ( if (cfg::dnms_read) )"); 
      i2cScanner();  
        debug_outln_info(F("Read DNMS..."));
        initDNMS();
      Debug.println("powerOnTestSensors(), DNMS Ende )");  
      i2cScanner();  
    }
}

Screenshot_20220205_132324

Could there also be an issue because the I2C-Scanner finds the DNMS under 0x55 not under 0x55H ?

imaluschi commented 2 years ago

Seems dnms_reset() is making problems. Commented it out, and correct DNMS-version is found.

static void initDNMS()
{
    char dnms_version[DNMS_MAX_VERSION_LEN + 1];

    debug_out(F("Trying DNMS sensor on 0x55H "), DEBUG_MIN_INFO);
//  dnms_reset();
    delay(1000);
    if (dnms_read_version(dnms_version) != 0)
    {
        debug_outln_info(FPSTR(DBG_TXT_NOT_FOUND));
        debug_outln_error(F("Check DNMS wiring"));
        dnms_init_failed = true;
    }
    else
    {
        dnms_version[DNMS_MAX_VERSION_LEN] = 0;
        debug_outln_info(FPSTR(DBG_TXT_FOUND), String(": ") + String(dnms_version));
    }
}

Screenshot_20220205_141723

Seems to work without dnms_reset() ! Screenshot_20220205_142040

imaluschi commented 2 years ago

Works so far without problems. Screenshot_20220209_001120 .

pjgueno commented 1 year ago

Force dnms_reset()