hello, can anyone help me, I'm currently trying to find out if my ads1293 has connected to a raspberry pi 4 by using the REVID register from the datasheet provided.
However, the code I'm using states that Device ID = 0X0, which should be 0X01 .
Can someone help me tell the error? I'm currently using python.
Thank you.
this is the code:
import RPi.GPIO as GPIO
import spidev
import time
# GPIO pin
#MOSI = 19
#MISO = 21
#SCLK = 23
#GND = 25
#CE0 = 24
#DRDY = 22
"""Global Variabel"""
Vref = 2.4
#NUM_ECG = 3
"""inisialisasi pin""" # Gunakan board GPIO
PIN_MOSI = 10
PIN_MISO = 9
PIN_SCLK = 11
PIN_CS = 0
PIN_DRDY = 25
""" SPI Device init """
spi= spidev.SpiDev()
spi.open(0,0)
spi.max_speed_hz = 20000000
spi.mode = 0b01
"""inisialisasi GPIO"""
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
#GPIO.setup(PIN_MOSI,GPIO.OUT)
#GPIO.setup(PIN_MISO,GPIO.IN)
#GPIO.setup(PIN_SCLK,GPIO.OUT)
GPIO.setup(PIN_CS,GPIO.OUT)
GPIO.setup(PIN_DRDY,GPIO.IN)
#READ SPI
GPIO.output(PIN_CS, GPIO.LOW)
time.sleep(1)
spi.writebytes([0xC0]) # 0xc0 = 1100 0000
ID_sig = spi.readbytes(1)
print ("Device ID:",hex(ID_sig[0]))
#Stop
GPIO.output(PIN_CS, GPIO.HIGH)
spi.close()
GPIO.cleanup()
print("Done")