Description
Using Adafruit_Blinka on Jetson Xavier and
Following: https://learn.adafruit.com/circuitpython-basics-i2c-and-spi/spi-devices instruction, the SPI baudrate stay at 10Mhz instead of the new specified value.
sample test code will print 10000000 instead of 500000
spi = busio.SPI(board.SCK, MOSI=board.MOSI)
while not spi.try_lock():
pass
spi.configure(baudrate=500000)
spi.unlock()
leds = adafruit_tlc59711.TLC59711(spi)
leds[0] = (0, 0, 0)
print(f'*** SPI Clk: {spi._spi.baudrate} ******')
The problem comes from the _write(self) function (line 177):
self._spi.configure(baudrate=10000000, polarity=0, phase=0)
It's not using the previously set baudrate. The line could be instead:
self._spi.configure(baudrate=self._spi._spi.baudrate, polarity=0, phase=0)
but that feels incomplete as polarity and phase are not kept.
Should the values be kept in https://github.com/adafruit/Adafruit_Blinka/blob/master/src/busio.py SPI class and calling configure without parameter will reuse the previously set? I have no idea of the impact on other project and will let you decide the best course of action.