Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20704 Discussions

de2 115 board audio codec i2c address

Altera_Forum
Honored Contributor II
1,868 Views

hello everyone, 

im trying to access audio codec and i faced a problem. what is the slave address of this audio codec? 

 

i looked into the demostration files for getting an idea about i2c bus. i saw these lines:  

 

//=========start=========== 

6'd1 : begin  

SD = I2C_DATA; 

SDO = 0; 

end 

 

6'd2 : SCLK = 0; 

//======SLAVE ADDR========= 

6'd3 : SDO = SD[23]; 

6'd4 : SDO = SD[22]; 

6'd5 : SDO = SD[21]; 

6'd6 : SDO = SD[20]; 

6'd7 : SDO = SD[19]; 

6'd8 : SDO = SD[18]; 

6'd9 : SDO = SD[17]; 

6'd10 : SDO = SD[16];  

6'd11 : SDO = 1'b1;//ACK 

 

 

//========SUB ADDR========== 

6'd12 : begin  

SDO = SD[15];  

ACK1 = I2C_SDAT;  

6'd13 : SDO = SD[14]; 

6'd14 : SDO = SD[13]; 

6'd15 : SDO = SD[12]; 

6'd16 : SDO = SD[11]; 

6'd17 : SDO = SD[10]; 

6'd18 : SDO = SD[9]; 

6'd19 : SDO = SD[8]; 

going so far.. 

 

 

etc. but, i couldn't understand difference between sub addr and slave addr. 

 

the sub address may be register address. but, what should be slave address?  

 

i need your help 

thanks, 

can
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
546 Views

Hi can, 

 

I need to implement ADC using Codec on DE2-115 board. Can you help me out with some example. 

 

thanks, 

vrv
0 Kudos
Altera_Forum
Honored Contributor II
546 Views

can't you get the device address from the datasheet of the audio codec WM8731 ?

0 Kudos
Altera_Forum
Honored Contributor II
546 Views

Hello canokcelik, 

 

I'm studying the audio codec and if you take a look in another part of this code (clock_500.v block) you will observe that this address is fixed: 

 

wire [23:0]DATA={8'h34,DATA_A}; 

 

I dont know what 34h means, I just know that is the slave address. 35h means another address, but I forgot what it means... =/ 

 

Sub address is the address of the registers, as you said, for example: 

 

ROM[0] = 16'h0c00; //power down => (0000 110)(0 0000 0000) it means register 6 (R6), take a look in the datasheet. 

sub_addr binary settings 

 

ROM[1] = 16'h0ec2; //master => (0000 111)(0 1100 0010) it means register 7 (R7) 

 

I hope I have helped you and sorry for the bad english.
0 Kudos
Altera_Forum
Honored Contributor II
546 Views

Hello everyone, sorry for delay. 

i have solved the problem. The slave address is 0x34, as viniciuslagrota indicated in his reply.  

 

viniciuslagrota: h prefix in h34 means that following number's radix is hexadecimal. so it is converted to "00011010" in your example because of 8'h34(In here, 8 indicates that following number must has 8 bits). you can send me an email about what you are doing now. may be, i can help you about somethink.
0 Kudos
Reply