CircuitPython version
Adafruit CircuitPython 7.2.0-alpha.1-344-ga8d865187-dirty
Custom Board with STM32F412CG
Code/REPL
import time
import board
import digitalio
import busio
from adafruit_bus_device.spi_device import SPIDevice
spi_sns_mag_cs = digitalio.DigitalInOut(board.SPI_SNS_MAG_CS)
spi_sns_mag_cs.direction = digitalio.Direction.OUTPUT
spi_sns_mag_cs.value = True
spi_sns = busio.SPI(board.SPI_SNS_SCK, MOSI=board.SPI_SNS_BIDI, MISO=None, half_duplex=True)
mag_sns = SPIDevice(spi_sns, spi_sns_mag_cs, baudrate=781250, polarity=1, phase=1)
while True:
time.sleep(5.0)
with mag_sns as spi:
spi.write(bytearray([0x4F]))
result = bytearray(1)
spi.readinto(result)
print(result)
Behavior
In the scope capture below, SCK Is yellow and chip select is blue. The SCK should be idle high before chip select goes active low. The SCK signal stays idle high in between the transactions, which is the correct behavior. After the 2nd byte (readinto), it looks like the SCK pin is set back to an input and the signal starts to decay. It should remain high until chip select goes high again.
Because SCK is not already idle high on the first byte (write), it goes to high due to polarity=1 after the chip select is active low and creates 9 rising edges of the clock on the first byte (write), instead of the expected 8 rising edges.
Description
No response
Additional information
No response
CircuitPython version
Code/REPL
Behavior
In the scope capture below, SCK Is yellow and chip select is blue. The SCK should be idle high before chip select goes active low. The SCK signal stays idle high in between the transactions, which is the correct behavior. After the 2nd byte (readinto), it looks like the SCK pin is set back to an input and the signal starts to decay. It should remain high until chip select goes high again.
Because SCK is not already idle high on the first byte (write), it goes to high due to polarity=1 after the chip select is active low and creates 9 rising edges of the clock on the first byte (write), instead of the expected 8 rising edges.
Description
No response
Additional information
No response