Forum Discussion
Altera_Forum
Honored Contributor
10 years agoNios SPI read
Hi everybody, I'm using the alt_avalon_spi_command Altera function to write on a DAC and i have problem when i tried to read what i have wrote before. The DAC requiert 1 instruction byte (r/w+7 a...
Altera_Forum
Honored Contributor
10 years agoHi Galfonz,
I'm using a DAC34H84 of Texas instruments. The write spi function does not have any problem. {0x00,0x01,0x8C} ===> 0x00 is the instruction byte (w+adress register); 0x01 is the MSB of the 16 bits of data and 0x8C is the LSB. So look only this function void read_dac84h84_spi(){ alt_u8 adress=0x04; alt_u8 rdata[2]; alt_avalon_spi_command(DAC34_SPI_BASE,0,1,(0x10+ad ress),2,rdata,NULL); arg0=master spi id, arg1= slave spi id, arg2=write lentgh,arg3=write data pointer,arg4=read lentgh,arg5=read data pointer,arg6=flags printf("Register %d : %X%X\n",adress,rdata);// return;} Best regards