Forum Discussion

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

Problem with my ADC/DAC stratix 2 dev board...

Hey,

I am new to nios II just started using it for my university project. I have been playing around with my Stratix 2 development board where I able to use virtually all the features on the board through nios II but i am having trouble with my ADCs and DACs. This is a simple program i created to put a voltage on the DAC and then have the ADC read in the value and display it on the screen:

# include "alt_types.h"# include <stdio.h># include <unistd.h># include "system.h"# include "sys/alt_irq.h"# include "altera_avalon_pio_regs.h"

int main(void)

{

while( 1 )

{

usleep(500000);

unsigned int data1 = 4095;

IOWR_ALTERA_AVALON_PIO_DATA(DAC_A_PIO_BASE, data1);

printf( "\n DAC : %d and ADC : %d" , data1,IORD_ALTERA_AVALON_PIO_DATA(ADC_A_PIO_BASE)http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/wink.gif ;

}

return(0);

}

When i run this code on my system that i created in SOPC builder and Quartus by editing design files that came with the developement software, full_featured.sof. I get the following output:

DAC: 4095 and ADC: 5

DAC: 4095 and ADC: 6

DAC: 4095 and ADC: 3

DAC: 4095 and ADC: 1

DAC: 4095 and ADC: 7

DAC: 4095 and ADC: 4

Which clearly shows that the ADC is just picking up noise or something like that. I have double checked my pin assignments for the ADC and DAC in quartus and have made sure that the clock jumpers on the board are correct. Anyhelp would be very very apprciated.

Regards

1 Reply

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

    Did you measure anything wioth a dvm, just to be sure the DAC generates a voltage and the ADS has some input??