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.

[参考译文] MCF8316A:I2C Communicator 无法通信

Guru**** 2484615 points
Other Parts Discussed in Thread: MCF8316A

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

https://e2e.ti.com/support/motor-drivers-group/motor-drivers/f/motor-drivers-forum/1165926/mcf8316a-i2c-communicator-cannot-communicate

器件型号:MCF8316A

大家好、

以下是客户提出的问题、可能需要您的帮助:

使用 Arduino Nano 控制 MCF8316A、而测试多次失败。  

#include <Wire.h>
#include <avr/wdt.h>
 const uint32_t address = 0x00000478; //12-bit address, should not exceed 4095 (0x0FFF) 
 const uint32_t command = 0x0000043E; //12-bit address, should not exceed 4095 (0x0FFF) 
byte buffer[30]; 
byte datav[10]={1,2,3,4,5,6,7,8,9,10}; 
 boolean flag=true;
 int i;
  byte dataOut[4];
 int data;
 void setup()
 {
    Wire.begin();
    Serial.begin(115200); 
    Serial.println("I2C OK");
    delay(10);
 }
 void loop()
 {
    //read
display(0x00000440);//write address
receiveEvent(4);//read the data
  delay(2000);
  
 wdt_reset(); 
 
 }
 void display(const uint32_t data) {  //write address
  byte dataOut[4];
  dataOut[3] = (data >> 24) & 0xFF;
  dataOut[2] = (data >> 16) & 0xFF;
  dataOut[1] = (data >> 8) & 0xFF;
  dataOut[0] = data & 0xFF;
  Wire.beginTransmission(0x01);
  Wire.write(dataOut, 4);
  Wire.endTransmission();
  
    Serial.println("display:");
    Serial.println(dataOut[0]);
    Serial.println(dataOut[1]);
    Serial.println(dataOut[2]);
    Serial.println(dataOut[3]);
 }
 void receiveEvent(const uint32_t bytes) {//read data
  int data;
  while(Wire.available() > 0) {
    data += Wire.read();
    data = (data << 8);
  }
  Serial.println("receiveEvent:");
  Serial.println(data); 
}

您可以帮助检查此案例吗? 谢谢。

此致、

樱桃

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

    您好、Cherry、  

    感谢您在 e2e 电机驱动器论坛上发帖

    我已将此主题分配给一名团队成员、我们将在下周做出回应  

    此致、  
    Andrew  

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

    您好、Cherry、

    在尝试与 MCF8316A 进行通信时、您是否会帮助客户提供 SCL 和 SDA 线路的逻辑分析仪捕获? (清楚地显示了 MCF8316A 的起始、正在发送的字节和 NACK)

    此致、
    Eric C.