Quantcast
Channel: EngineerZone: Message List
Viewing all articles
Browse latest Browse all 22030

Re: ADAU1701 I2C communication with mcu

$
0
0

Hi Omar,

 

I think I found at least one bug. SigmaStudio is telling you to write this combination of addresses and data:

ScreenHunter_03 Mar. 11 22.17.jpg

 

However, judging from your code, you're writing this:

ScreenHunter_04 Mar. 11 22.18.jpg

Note the discrepancy highlighted in red. It looks like you forgot to increment the subaddress (i.e. the address in parameter memory).

(You can see this in lines 21 and 30 of your pasted code)

 

So, the updated code should be like this:

 

#include <Wire.h>  

void setup()  
{  
Wire.begin();  
}  

void loop()  
{    Wire.beginTransmission(0x68);    Wire.write(0x00);    Wire.write(0x00);     Wire.write(0x00);    Wire.write(0x00);    Wire.write(0x00);    Wire.write(0xFF);    Wire.endTransmission();    Wire.beginTransmission(0x68);    Wire.write(0x00);    Wire.write(0x01);   Wire.write(0x00);    Wire.write(0x00);    Wire.write(0x06);    Wire.write(0xD4);    Wire.endTransmission();    Wire.beginTransmission(0x68);    Wire.write(0x00);    Wire.write(0x02);    Wire.write(0x00);    Wire.write(0x00);    Wire.write(0x00);    Wire.write(0x00);    Wire.endTransmission();  

}  

 

You can see my changes in lines 21 and 30. Hopefully that will resolve the problem.

 

By the way, as you move forward in your development, you might find it useful to follow this tutorial.

http://ez.analog.com/docs/DOC-1806

It explains how to use tools within SigmaStudio to generate almost all of your microcontroller code automatically. Using that approach, you won't have as much potential for bugs caused by typos.

 

Let me know if this resolves the issue!


Viewing all articles
Browse latest Browse all 22030

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>