Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

Assembly or C program that produce an output tone on speaker NIOS II.

All i want to do is produce and output tone to the speaker.

My university has a sample code

http://www-ug.eecg.toronto.edu/msl/nios_devices/dev_audio.html

However for some reason the code is broken and outputs a scrambled noise from the speaker. I attempted to modify this code to output a single however it obviously doesn't work, same scrambled noise.Can someone explain why this code is broken so I can fix tone output code, or explain how to output a tone to the speaker?

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I want to produce a tone output on the speakers

    
    Assembly Example: Echo program - connects mic to speakers, polling
    .equ ADDR_AUDIODACFIFO, 0x10003040
    main:
      movia r2,ADDR_AUDIODACFIFO
      ldwio r3,4(r2)      /* Read fifospace register */
      andi  r3,r3,0xff    /* Extract#  of samples in Input Right Channel FIFO */
      beq   r3,r0,main  /* If no samples in FIFO, go back to start */
      ldwio r3,8(r2)
      stwio r3,8(r2)      /* Echo to left channel */
      ldwio r3,12(r2)
      stwio r3,12(r2)     /* Echo to right channel */
      br main
    

    This code was provided by my university website(http://www-ug.eecg.toronto.edu/msl/nios_devices/dev_audio.html), however its broken and the output is scrambled noise nothing is right. How can I output to the speaker a single tone?