This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CC2340R5:Zephyr I2C 驱动程序引用 10 位 I2C 寻址的错误位字段、并且与 I2C 速度相冲突

Guru**** 2779905 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1618938/cc2340r5-zephyr-i2c-driver-references-wrong-bitfield-for-10-bit-i2c-addressing-and-conflicts-with-i2c-speed

器件型号: CC2340R5

您好:

我在 C2340 的 Zephyr I2C 驱动程序中注意到我在 i2c_cc23xx_cc27xx.c:474 中的此行中收到错误:

	/* This is deprecated and could be ignored in the future */
	if (dev_config & I2C_ADDR_10_BITS) {
		LOG_ERR("10-bit addressing mode is not supported");
		return -ENOSYS;
	}

请注意、在 Zephyr I2C 驱动程序中、此模式现在由位 3 设置、而不是位 0:

/** Use 10-bit addressing. DEPRECATED - Use I2C_MSG_ADDR_10_BITS instead. */
#define I2C_ADDR_10_BITS		BIT(0)
/** Use 10-bit addressing for this message.
 *
 * @note Not all SoC I2C implementations support this feature. */
#define I2C_MSG_ADDR_10_BITS		BIT(3)

这会导致错误、因为 I2C_SPEED 模式现在使用低 3 位、并且 10 位模式似乎基于每条消息而不是全局配置:

/*
 * The following #defines are used to configure the I2C controller.
 */

/** I2C Standard Speed: 100 kHz */
#define I2C_SPEED_STANDARD		(0x1U)

/** I2C Fast Speed: 400 kHz */
#define I2C_SPEED_FAST			(0x2U)

/** I2C Fast Plus Speed: 1 MHz */
#define I2C_SPEED_FAST_PLUS		(0x3U)

/** I2C High Speed: 3.4 MHz */
#define I2C_SPEED_HIGH			(0x4U)

/** I2C Ultra Fast Speed: 5 MHz */
#define I2C_SPEED_ULTRA			(0x5U)

/** Device Tree specified speed */
#define I2C_SPEED_DT			(0x7U)

因此、如果您选择 I2C_SPEED_STANDARD 或 I2C_SPEED_DT、则 cc23xx_cc27xx I2C 驱动程序会将其视为 10 位寻址模式并返回错误。

我认为建议的修复方法应该只是更改行:

IF (DEV_CONFIG 和 I2C_ADDR_10_bits)  
收件人:
IF (DEV_CONFIG 和 I2C_MSG_ADDR_10_BIT)
 
或者、应在其他地方进行 10 位模式检查、因为高速模式仍然与此标志相冲突...
Munan
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    作为参考、我使用的是 v3.7.0-ti-9.14.00_ea 标签

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Munan:

    感谢您提供详细信息。 我已经邀请了一位专家来帮助您解决这个主题。

    此致、

    1 月

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Munan:

    感谢您对此进行研究。 是的、我验证了这是一个问题、Zephyr 文档明确指出  I2C_ADDR_10_bits 已被弃用。 您建议的更改是正确的修复。

    此致、

    Ging