This is an automated email from the ASF dual-hosted git repository.
wes3 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new f8effc74e hw/mcu/dialog: Add 1MHz high-speed mode to hal i2c
f8effc74e is described below
commit f8effc74e2a99786d43a315a76aa498f4bb084e0
Author: Will San Filippo <[email protected]>
AuthorDate: Thu May 16 14:40:35 2024 -0400
hw/mcu/dialog: Add 1MHz high-speed mode to hal i2c
Adds 1MHz i2c speed to the i2c hal. The 1MHz speed requires
high speed mode on the chip. In order for this to work it
appears that the RESTART_EN bit has to be set in the control
register or a tx abort condition occurs (bit 8 in tx abort source reg)
---
hw/mcu/dialog/da1469x/src/hal_i2c.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/mcu/dialog/da1469x/src/hal_i2c.c
b/hw/mcu/dialog/da1469x/src/hal_i2c.c
index d6983b9c6..53b9c7d3a 100644
--- a/hw/mcu/dialog/da1469x/src/hal_i2c.c
+++ b/hw/mcu/dialog/da1469x/src/hal_i2c.c
@@ -187,7 +187,8 @@ i2c_config(const struct da1469x_hal_i2c *i2c, uint32_t
frequency)
i2c_con_reg = i2c->data->I2C_CON_REG;
/* Clear speed register */
- i2c_con_reg &= ~I2C_I2C_CON_REG_I2C_SPEED_Msk;
+ i2c_con_reg &= ~(I2C_I2C_CON_REG_I2C_SPEED_Msk |
+ I2C_I2C_CON_REG_I2C_RESTART_EN_Msk);
switch (frequency) {
case 100:
i2c_con_reg |= (1 << I2C_I2C_CON_REG_I2C_SPEED_Pos);
@@ -195,6 +196,10 @@ i2c_config(const struct da1469x_hal_i2c *i2c, uint32_t
frequency)
case 400:
i2c_con_reg |= (2 << I2C_I2C_CON_REG_I2C_SPEED_Pos);
break;
+ case 1000:
+ i2c_con_reg |= ((3 << I2C_I2C_CON_REG_I2C_SPEED_Pos) |
+ I2C_I2C_CON_REG_I2C_RESTART_EN_Msk);
+ break;
default:
return HAL_I2C_ERR_INVAL;
}