There is no read value when changing 50MHz into 1MHz. No change in pin connections.
pin connections:
RPI3 - W25Q64FV
MOSI - DI
MISO - D0
SPI_CLK - CLK
CE0 - CS
GND - GND
3.3V - VCC
need to verify the pin connections.
change the code as below according to Chip select pin.
import spidev
import time
import RPi.GPIO as GPIO
unique_id_reg=0x4B
dummybyte=0x00
GPIO.setwarnings(False)
# Set up GPIO mode
GPIO.setmode(GPIO.BOARD) # Use Broadcom (BCM) GPIO numbering scheme
mode = GPIO.getmode()
print(mode)
SPI_CE0 = 24 # GPIO 8 (physical pin 24)
#GPIO.setup(SPI_CE0, GPIO.OUT)
GPIO.setup(SPI_CE0, GPIO.OUT, initial=GPIO.HIGH)
spi = spidev.SpiDev()
spi.open(0,0)
spi.max_speed_hz = 1000000
spi.mode = 0
GPIO.output(SPI_CE0, GPIO.LOW) # Set CE0 to low to enable communication
sendCommand=[unique_id_reg,dummybyte,dummybyte,dummybyte,dummybyte]
spi.writebytes(sendCommand)
unique_id=spi.readbytes(8)
# Set CS pin to high to disable communication
GPIO.output(SPI_CE0, GPIO.HIGH)
print("Unique ID:", ''.join(format(x, '02x') for x in unique_id))
spi.close()
# Clean up GPIO settings
GPIO.cleanup()
pin connections:
RPI3 - W25Q64FV
MOSI - DI
MISO - D0
SPI_CLK - CLK
CE0 - CS
GND - GND
3.3V - VCC
need to verify the pin connections.
change the code as below according to Chip select pin.
import spidev
import time
import RPi.GPIO as GPIO
unique_id_reg=0x4B
dummybyte=0x00
GPIO.setwarnings(False)
# Set up GPIO mode
GPIO.setmode(GPIO.BOARD) # Use Broadcom (BCM) GPIO numbering scheme
mode = GPIO.getmode()
print(mode)
SPI_CE0 = 24 # GPIO 8 (physical pin 24)
#GPIO.setup(SPI_CE0, GPIO.OUT)
GPIO.setup(SPI_CE0, GPIO.OUT, initial=GPIO.HIGH)
spi = spidev.SpiDev()
spi.open(0,0)
spi.max_speed_hz = 1000000
spi.mode = 0
GPIO.output(SPI_CE0, GPIO.LOW) # Set CE0 to low to enable communication
sendCommand=[unique_id_reg,dummybyte,dummybyte,dummybyte,dummybyte]
spi.writebytes(sendCommand)
unique_id=spi.readbytes(8)
# Set CS pin to high to disable communication
GPIO.output(SPI_CE0, GPIO.HIGH)
print("Unique ID:", ''.join(format(x, '02x') for x in unique_id))
spi.close()
# Clean up GPIO settings
GPIO.cleanup()
Statistics: Posted by Fwpriya — Wed Mar 20, 2024 5:36 am