Part Number:ADS7953
Dear Sir/Madam,
I have used ADS7953 ADC to read 16CH input of voltage range 0V to 5V. VA+ = 5V, VBD = 3.3V , REFP = 2.5V and REFM = 0V (GND).
On board I have constant voltage source generating 4.096V (U10 in schematic) and connected to CH11 input of ADC. The host controller is RPI model 3B+.
The problem is on configuring the ADC to manual mode, I have to read CH11 to get 4.096V. But here I get 0 value on MISO line ( it is in tri-state even after pull up to 3.3V using 4.7KE).
Schematic -
(Please visit the site to view this file)
Oscilloscope capture - (CH1 - MOSI - Yellow) (CH2 - MISO - BLUE) (CH3- SCK - PINK) (CH4 - CS# - GREEN)
IMAGE1 - shows only one frame
IMAGE2 - Shows 3 frames
IMAGE3 - Shows two frames in detail.
Program ADC program -
def build_adc_command(mode, en_prog, next_channel, vref_change, operation, channel_gpio, gpio_dat):
command = ((mode & 0x0F) << 12) | ((en_prog & 0x01) << 11) | ((next_channel & 0x0F) << 7) |\
((vref_change & 0x01) << 6) | ((operation & 0x01) << 5) | ((channel_gpio & 0x01) << 4) |\
(gpio_dat & 0x0F)
# print(command)
return [((command >> 8) & 0xFF), (command & 0xFF)]
NUM_CH = 16
if __name__ == '__main__':
adcValues = [0 for i in range(NUM_CH)]
spi = spidev.SpiDev()
spi.open(0, 1)
spi.max_speed_hz = 1000000
spi.mode = 0b11
spi.cshigh = False
spi.lsbfirst = False
spi.bits_per_word = 8
spi.no_cs = True
GPIO.setmode(GPIO.BOARD)
GPIO.cleanup()
# setmode to input
# setmode to output
GPIOsetup(26, GPIO.OUT)
reset = False
while 1:
try:
time.sleep(0.25) # 10 hz output
# 0b00011101
# 0b10000000
# for ch in range(0, 7):
# spi.xfer([0b00011101, 0b10000000])
if reset is False:
GPIO.output(26, GPIO.LOW)
time.sleep(0.01)
adcValues = spi.xfer2([0x42, 0x0f])
time.sleep(0.001)
GPIO.output(26, GPIO.HIGH)
reset = True
time.sleep(0.001)
GPIO.output(26, GPIO.LOW)
adcValues = spi.xfer2(build_adc_command(0b0001, 0b1, 0b1011, 0b1, 0b0, 0b1, 0b0000))
print("xfer return Values 1 = ", adcValues)
time.sleep(0.001)
GPIO.output(26, GPIO.HIGH)
time.sleep(0.001)
GPIO.output(26, GPIO.LOW)
adcValues = spi.xfer2(build_adc_command(0b0001, 0b1, 0b0001, 0b1, 0b0, 0b1, 0b1111))
print("xfer return Values 2 = ", adcValues)
time.sleep(0.001)
GPIO.output(26, GPIO.HIGH)
time.sleep(0.001)
GPIO.output(26, GPIO.LOW)
adcValues = spi.xfer2(build_adc_command(0b0001, 0b1, 0b0010, 0b1, 0b0, 0b1, 0b0000))
print("xfer return Values 3 = ", adcValues)
time.sleep(0.001)
GPIO.output(26, GPIO.HIGH)
time.sleep(0.001)
GPIO.output(26, GPIO.LOW)
adcValues = spi.xfer2(build_adc_command(0b0001, 0b1, 0b0011, 0b1, 0b0, 0b1, 0b1111))
print("xfer return Values 4 = ", adcValues)
time.sleep(0.001)
GPIO.output(26, GPIO.HIGH)
except KeyboardInterrupt:
break
After going through above information, my problems are
1. ADC MISO pin always in tri-state even giving pull up.
2. Is the command sent are correct?
3. Not even junk data coming from MISO pin.
Kindly provide a solution at the earliest.