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.

[参考译文] LAUNCHXL-CC2640R2:通过 i2c 实现 MEMS 集成

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

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1060475/launchxl-cc2640r2-mems-integration-through-i2c

器件型号:LAUNCHXL-CC2640R2
主题中讨论的其他器件:TMP116

你(们)好

这里、我使用 I2C 将 CC26409R2评估板与 MEMS LSM6DS3集成在一起。 在这里、我将使用 TI SDK 提供的示例。 我在这里面临的挑战是、我不知道在我想要写入时如何馈送子地址和数据。 没有连续读取或写入的示例。 这是用于写入和读取的结构 AM。

下面提到的结构源来自"i2ctmp_CC2640R2_LAUNCHXL_tirtos_ccs"项目、该项目是从'C:\ti\simplelink_cc2640r2_sdk_5_30_00_03\examples\rtos\cc2640R2_LAUNCHXL_drivers\i2ctmp"导入的

typedef 结构
void *writeBuf;
size_t writeCount;
void * readBuf;
size_t ReadCount;
uint_least8_t slaveAddress;
} I2C_Transaction

I2C_Transaction i2cTransaction;

i2cTransaction.writeBuf = txBuffer;
i2cTransaction.writeCount = 1;
i2cTransaction.readBuf = rxBuffer;
i2cTransaction.ReadCount = 2;
i2cTransaction.slaveAddress = TMP116_BP_ADDR;  

现在我想在0x11 (子地址)控制寄存器中写入0x10 (数据)。

现在、请告诉我如何在上述结构中输入子地址和数据。

请举个例子、在 LSM6DS3 MEMS 中执行连续读取和写入

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

    Thaikamaranna、您好!

    创建一个 txBuffer 数组,该数组包含要在事务期间写入的数据。

    uint8_t         txBuffer[2] = {0x11, 0x10};
    //...
    i2cTransaction.writeBuf   = txBuffer;
    i2cTransaction.writeCount = 2;

    考虑在 I2C 线路上使用示波器或逻辑分析仪、并确保该事务符合 LSM6DS3数据表的预期。

    此致、
    Ryan