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.

AWR6843AOPEVM: 利用sdk里面的i2c部分的api读挂在I2C总线上的温度

Part Number: AWR6843AOPEVM
Other Parts Discussed in Thread: IWR6843AOPEVM

您好,我现在手头的设备是iwr6843aopEVM安装在Boost板子上

我想做的事情是通过i2c读取这块板子上面温度传感器TMP112x的值,我在官网找到了这块板子的资料https://www.ti.com/document-viewer/lit/html/SWRU546E/GUID-00256656-BC54-48EF-B44F-3054031A4C73#TITLE-SWRU546ID-B1E452BD-DA85-44F4-AD00-B689124D4D94,这里面2.8.2节显示I2C总线上的U18、U19都是温度传感器,我想去读他们任一的值。

我按照sdk里面i2c部分的test里面的例程在在固件写了一个任务和函数去读。但是失败了,程序每次执行到I2C_transfer()这个函数的时候会传输失败,我想问问您知不知道原因或者可能的原因(比如是否有硬件相关跳线的调整或者代码的初始化不正确)。下面是我读温度的函数

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* Read Temp function*/
float TMP_ReadTemp(I2C_Handle i2cHandle, uint8_t i2cSlaveAddress, uint8_t i2cSlaveRegAddress)
{
uint8_t txData[2];
bool retVal = true;
uint8_t rxData[2];
I2C_Transaction i2cTransaction;
int16_t digitalTemp = 2;
int32_t errCode;
/* Reset the transmit and receive buffer */
memset(&rxData, 0, sizeof (rxData));
/* Scan for the slave address */
txData[0] = i2cSlaveRegAddress;
i2cTransaction.slaveAddress = i2cSlaveAddress;
i2cTransaction.writeBuf = txData;
i2cTransaction.writeCount = 1;
i2cTransaction.readBuf = rxData;
i2cTransaction.readCount = 0;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

下面是我调用这个函数的任务

运行之后的结果是:

结果看起来像是正确初始化了,一直走到I2C_transfer(),然后这个transfer一直失败。我已经再三检查了我从设备的地址 和 从设备寄存器的地址,我觉得应该不是这个原因,想问一下针对这个问题您那边有什么解决办法么?

谢谢!

x 出现错误。请重试或与管理员联系。