Intel® FPGA University Program
University Program Material, Education Boards, and Laboratory Exercises
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
1049 Discussions

Producing tone with Audio Codec on NIOS II?

Altera_Forum
Honored Contributor I
749 Views

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
47 Views

Hi , 

 

Have you configured the codec over I2C in slave mode ?
Altera_Forum
Honored Contributor I
47 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