April HiH6130 Command Mode

Trying to hack my 6130 I2C address via command mode after successfully reading temp/humidity with code similar to nora. Command mode reference details are here. A 7-bit address, a write bit (0), and Start_CM (0xA0) w/n 3ms of power-up enables command mode (any further delay after power-up drops you into measure/fetch mode). A byte status provides status + diagnostics + response bits. It appears that I’m not getting in quick enough. No subaddress is required by 6130.

I’m attempting the write/read sequence as follows to get into command mode:

`
// HiH-6130 command mode h4x

imp.configure(“HiH-6130-CmdMode”, [], []);
hardware.configure(I2C1_89); // SCL=8, SDA=9
local i2c = hardware.i2c1;
server.log(i2c.write(0x27 << 1, format("%c", 0xA0)));
server.log(i2c.read(0x27 << 1 | 1, “”, 1)[0] >> 6); // getting 1, expecting 2

`

I’m getting “stale data” status bits, implying I’m not getting into command mode. I’ll ultimately need to get into command mode, read EEPROM to confirm my I2C address, alter my address (I actually need three 6130s on the I2C bus), then confirm new changed address.

TIA,
Dirk

Also tried connecting imp pin 7 to 6130 VDD and writing toggling it to try and more precisely control the power timing as follows:

`
// HiH-6130 command mode h4x, imp pin 7 => 6130 pin VDD for switchable power

imp.configure(“HiH-6130-CmdMode”, [], []);
hardware.configure(I2C1_89); // SCL=8, SDA=9
hardware.pin7.configure(DIGITAL_OUT);
local i2c = hardware.i2c1;

hardware.pin7.write(0);
hardware.pin7.write(1);
server.log(i2c.write(0x27 << 1, format("%c", 0xA0))); // getting 0 as expected
server.log(i2c.read(0x27 << 1 | 1, “”, 1)[0] >> 6); // getting 1, expecting 2
`

Still no luck on a good command mode statusing…

TIA,
Dirk

Yeah, you would absolutely need to control power to manage this.

I’d try waiting a little after your write(0) for the power to be drained from the bypass caps of the 6130 before turning it on again.

Also, a server.log takes a long time (as it does a wifi transmit). Try doing the write/read then doing the printing outside the timing critical section.