I have used DAC80508 evaluation board (DAC80508EVM) with following mentioned simple python program on Raspberry PI and it works well to get DAC outputs. Then I have used same DAC IC (DAC80508MRTER) and I prepared a board with similar circuitry to the evaluation board and tried to use same program to get outputs and I always get 0V on all outputs. I need you help to rectify the issue.
from gpiozero import LED
import binascii
import spidev
from time import sleep
dac1 = LED(21)
dac1.on()
spi = spidev.SpiDev() #create spi object
spi.open(0,1) #open spi port 0, device (CS) 1
spi.max_speed_hz = 5000
spi.mode = 1
dac1.on()
sleep(0.1)
dac1.off()
voltage_write = spi.writebytes([0x02,0xFF,0x00])
sleep(0.1)
dac1.on()
sleep(0.1)
dac1.off()
power_up = spi.writebytes([0x03, 0x00, 0x00])
sleep(0.1)
dac1.on()
sleep(0.1)
dac1.off();
voltage_write = spi.writebytes([0x04, 0x00, 0xFF ])
dac1.on()
hb1 = []
lb1 = []
for i in range(8):
x = 6
while(x >5):
x = input("Enter a voltage to set the DAC 1: channel " + str(i) + " ")
if x >5 :
print("Enter voltage less than 5 V")
y = int(x/5.0*(2**16-1))
hb1.append((y & 0xFF00)>>8)
lb1.append(y & 0x00FF)
j = 8
while j < 16:
dac1.on()
sleep(0.1)
dac1.off()
h = hb1[j-8]
l = lb1[j-8]
voltage_write = spi.writebytes([j, h, l])
dac1.on()
j = j+1
sleep(1)
try:
while True:
pass
except KeyboardInterrupt:
print("Closed")
spi.close()