NanoBeacon / config-files

sample config for IN100
MIT License
13 stars 2 forks source link

BME280 burst data readout #3

Open phoreglad opened 11 months ago

phoreglad commented 11 months ago

Hi,

I want to use IN100 to read data from BME280 sensor, but my current application expects to receive the data from all 8 registers instead of 6 as it is in the example. I tried to use burst read as recommended by the datasheet in section 4 but was unable to get it to work.

My current I2C configuration is:

"i2c": {
        "sw0PwrCtl": 1,
        "coldBootEn": 1,
        "warmBootEn": 1,
        "sclPin": 4,
        "sdaPin": 5,
        "addrBit": 7,
        "speed": 400,
        "slvAddr": 119,
        "memStoreLen": 8,
        "memStoreOffset": 0,
        "cmd": [
            "i2c wait: 3 1 27",
            "i2c tx: 3 f2",
            "i2c tx: 3 1",
            "i2c tx: 3 f5",
            "i2c tx: 3 0",
            "i2c tx: 3 f4",
            "i2c tx: 3 25",
            "i2c null:",
            "i2c wait: 3 1 4e",
            "i2c tx: 3 f7",
            "i2c null:",
            "i2c rx: 3",
            "i2c rx: 3",
            "i2c rx: 3",
            "i2c rx: 3",
            "i2c rx: 3",
            "i2c rx: 3",
            "i2c rx: 3",
            "i2c rx: 3",
            "i2c null:"
        ]
    },

Using the same command sequence on Raspberry Pi Pico works fine.

Would it be possible to add an example configuration for burst reading BME280 data registers?

NanoBeacon commented 11 months ago

Hi There,

Can you share more details about it not working? Are you seeing no data being read back at all? There is a known issue with multiple read commands being sent a row where at most 5 read commands will work before a new write command must be issued.

phoreglad commented 11 months ago

Yes, that was what was happening. IIRC when I looked at the signals on an oscilloscope, after the last write command (0xf7) there was no activity on SCL or SDA lines. Later today I can add a picture from the scope to show exactly what's going on.

phoreglad commented 11 months ago

As promised I'm attaching pictures from my scope. Channel 1 - SCL Channel 2 - SDA Channel 3 - SW0

First, the whole communication sequence during the SW0 active period: all

Zooming to the last command shows that after it's sent the SCL and SDA lines are idle and IN100 doesn't attempt to read the data at all: last_write_sw0

I have also checked if the register configuration commands and data read commands are sent correctly. I can attach those pictures as well if needed.

phoreglad commented 10 months ago

If I understand correctly splitting the read into multiple shorter ones (e.g. 3 + 5 bytes) should fix this problem, am I right?