I am trying to get an ADC and external oscillator (ADS131M02-q1 and SG531p respectively) to read a 1Vpp@60Hz signal from a function generator to print to a Raspberry Pi my issue is that the ADC value and voltage value always read as 0
import spidev
import time
# create a new SPI object
spi = spidev.SpiDev()
spi.open(0, 0)
# set the SPI mode and clock frequency
spi.mode = 0b01
spi.max_speed_hz = 1000000
# read the ADC values and print them to the console
while True:
# send the reset command to the ADC
spi.xfer([0x06])
# read the ADC values
adc_values = spi.readbytes(4)
value = (adc_values[0] << 24) | (adc_values[1] << 16) | (adc_values[2] << 8) | adc_values[3]
voltage = value / (2 ** 31 - 1) * 2.5
print("ADC Value: ", value)
print("Voltage: ", voltage)
# wait for some time before reading again
time.sleep(0.1)
above is the code, so far I have confirmed the wiring to the spi pins on the RPi, checked the functionality of the oscillator and function generator on a oscilloscope and checked to make sure that default register values on the ADC are necessary, I am extremely new at python so i am wondering if i have made a clear error in the code