请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号: 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