In my project, I want run "regular" Python code on my main computer and have it communicate with external devices connected through the Raspberry Pi Pico. So I use this u2if file.
In the actual use process I found that when I set the SPI configure like that (polarity=0, phase=1), But what I see in the oscilloscope is (polarity=0, phase=0). I'm very confused about this, and I'm guessing if these two parameters of polarity and phase are not actually being received, the program is still using the default parameters.
Can you give me some suggestions? thanks!
Below is my code.
`import busio
import board
import digitalio
In my project, I want run "regular" Python code on my main computer and have it communicate with external devices connected through the Raspberry Pi Pico. So I use this u2if file.
In the actual use process I found that when I set the SPI configure like that (polarity=0, phase=1), But what I see in the oscilloscope is (polarity=0, phase=0). I'm very confused about this, and I'm guessing if these two parameters of polarity and phase are not actually being received, the program is still using the default parameters. Can you give me some suggestions? thanks!
Below is my code. `import busio import board import digitalio
cs = digitalio.DigitalInOut(board.GP26) cs.direction = digitalio.Direction.OUTPUT cs.value = True
spi = busio.SPI(clock=board.SCK0, MOSI=board.MOSI0, MISO=board.MISO0)
while not spi.try_lock(): pass
spi.configure(baudrate=4000000, polarity=0, phase=1, bits=8)
try: cs.value = False spi.write(b'\xff') cs.value = True
finally: spi.unlock()`