Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
731 Views

Producing tone with Audio Codec on NIOS II?

Hey everyone, 

 

I'm just learning how to use the Audio CODEC on NIOS II with the DE2 board. I wrote the following assembly code to generate a square wave and use it to produce an output tone: 

 

.equ ADDR_AUDIODACFIFO, 0x10003040 

 

 

.global main 

main: 

movia r2, ADDR_AUDIODACFIFO 

 

# Set up the square wave's positive pulse 

preloop1: 

movi r3, 10000 

movi r4, 22 

 

# Send 22 outputs to the FIFO 

loop1: 

stwio r3, 8(r2) 

stwio r3, 12(r2) 

subi r4, r4, 1 

beq r4, r0, preloop2 

br loop1 

 

# Set up the square wave's negative pulse 

preloop2: 

movi r3, -10000 

movi r4, 22 

 

# Send 22 outputs to the FIFO 

loop2: 

stwio r3, 8(r2) 

stwio r3, 12(r2) 

subi r4, r4, 1 

beq r4, r0, preloop1 

br loop2 

 

It doesn't seem to be working - nothing is being written to the audio codec's FIFOs. Does anyone know what I need to do to produce a tone? Thanks.
0 Kudos
2 Replies
Altera_Forum
Honored Contributor I
29 Views

Hi , 

 

Have you configured the codec over I2C in slave mode ?
Altera_Forum
Honored Contributor I
29 Views

 

--- Quote Start ---  

Hi , 

 

Have you configured the codec over I2C in slave mode ? 

--- Quote End ---  

 

 

How do you do that? Can you do that in NIOS II?
Reply