Intel® FPGA University Program
University Program Material, Education Boards, and Laboratory Exercises
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
1238 Discussions

Producing tone with Audio Codec on NIOS II?

Altera_Forum
Honored Contributor II
1,148 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 II
446 Views

Hi , 

 

Have you configured the codec over I2C in slave mode ?
0 Kudos
Altera_Forum
Honored Contributor II
446 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?
0 Kudos
Reply