Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
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.
12409 Discussions

Help! my program can't work with nios ii on DE1 board

Altera_Forum
Honored Contributor II
833 Views

Hi,there! 

I built a nios project with the audio IP from university program IPs(version 10.1),and program as follow: 

 

int main(void) 

alt_up_audio_dev *audio_dev; 

unsigned int r_buf=1000; 

unsigned int l_buf=1000; 

unsigned int fifospace; 

 

audio_dev=alt_up_audio_open_dev("/dev/audio_controller"); 

if(audio_dev==NULL) 

printf("Error:could not open audio device\n"); 

else 

printf("Opened audio device\n"); 

while(1) 

fifospace=alt_up_audio_write_fifo_space(audio_dev,ALT_UP_AUDIO_RIGHT); 

if(fifospace>2) 

alt_up_audio_write_fifo(audio_dev, 

&(l_buf),2,ALT_UP_AUDIO_LEFT); 

alt_up_audio_write_fifo(audio_dev,&(r_buf),2,ALT_UP_AUDIO_RIGHT); 

 

return 0; 

I ensured that hardware connection was right,and a 18.4MHz clock signal from pll connected to wm8731 MCLK port,but when run as hardware in nios ii ide,no sound come out from line out port. I'm strongly puzzled.After looking for useful info in handbook pdf for a long time,found no. 

Can you help me? I'll sincerely appreciate that.
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
101 Views

Do you see "Opened audio device" in the console? 

I've ever used this component so I don't know if the code is right. I think you should use multiple word buffers instead of just unsigned ints. 

If your data size is 16 bits, what you are sending is a succession of 0 and 1000 values. This is a signal at a rather high frequency (half the sampling rate) and a rather low amplitude (about 1/32 of the maximum). So if it works it must be hard to hear. 

What word size and sampling frequency did you use?
Altera_Forum
Honored Contributor II
101 Views

Thanks for replying. I can see "Opened audio device" in the console window,and audio bit width is 16,and sampling rate is 48k sps. 

Are you familiar with the university program IP?
Altera_Forum
Honored Contributor II
101 Views

No I'm not, but to output any audio you will have to use buffers instead of just ints, and fill them with a signal such as a sine wave.

Reply