We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9323b67 commit a06b572Copy full SHA for a06b572
src/rp2_common/hardware_i2c/i2c.c
@@ -85,6 +85,12 @@ uint i2c_set_baudrate(i2c_inst_t *i2c, uint baudrate) {
85
i2c->hw->fs_scl_lcnt = lcnt;
86
i2c->hw->fs_spklen = lcnt < 16 ? 1 : lcnt / 16;
87
88
+ // Set hold time of SDA during transmit to 2. The TCS34725 color sensor
89
+ // does not work without this change, and perhaps it helps other I2C
90
+ // devices as well. There is no discernable change slowdown in timing traces.
91
+ i2c->hw->sda_hold =
92
+ I2C_IC_SDA_HOLD_IC_SDA_RX_HOLD_RESET << I2C_IC_SDA_HOLD_IC_SDA_RX_HOLD_LSB |
93
+ 2 << I2C_IC_SDA_HOLD_IC_SDA_TX_HOLD_LSB;
94
i2c->hw->enable = 1;
95
return freq_in / period;
96
}
0 commit comments