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.

[参考译文] I2C LED

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

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/894373/i2c-leds

您好!

该板有8个 LED 连接到 I2C 并联

根据数据表,其 I2C 端口2,地址0x60

我一直在使用 TI RTOS 电机控制示例,并已将其修改为写入2个字节{0xAA, 0xAA},但 LED 不会亮起

因为我不熟悉 Sitara 和 TI RTOS。

相关代码段如下所示(使用终端验证代码按预期执行。

虽然没有错误指示,但 LED 指示灯不亮。

有什么想法?

UART_printf ("I2C 2设置\n");

/*初始化参数*/

I2C_Params_init (&i2cParams);
i2cParams.transferMode = I2C_MODE_BLOCKING;

/*打开 I2C 实例*/
i2c2_handle = I2C_open (2、&i2cParams);
如果(!i2c2_handle)
UART_printf ("I2C 未打开\n");
其他
UART_printf ("I2C open ok\n");

/*使用 I2C 事务配置常用参数*/
i2cTransaction.slaveAddress = 0x60;
i2cTransaction.writeBuf =(uint8_t *)&txBuf[0];
i2cTransaction.writeCount = 2;

UART_printf ("I2C2 write\n");


i2c2_status = I2C_transfer (i2c2_handle、&i2cTransaction);
if (i2c2_status == false)

//I2C_Close (i2c2_handle);
UART_printf ("I2C 2错误\n");

其他
UART_printf ("I2C 2 no err\n");