SPI
-
I should drive the signal data to 2 display, so I would like to use SPI. Can I use two SPI ? How can I configure two different SPI? Is it correct?
spi = SPI(0) spi2 = SPI(0) spi.init(mode=SPI.MASTER, baudrate=40000000, polarity=0, phase=0, bits=8, pins=('P20','P19', 'P18')) spi2.init(mode=SPI.MASTER, baudrate=40000000, polarity=0, phase=0, bits=8, pins=('P8','P11', 'P14')) -
@ma SPI used a shared bus. So you can connect both devices to the the same SPI interface. Only the CS (chip select) pins must be different and be activated alternatively.
-
@robert-hh thank you. I'm using:
spi.write(bytes([0x01, 0x02, 0x03, 0x04, 0x05]))can I use a different way to write with SPI? I need to be faster
-
@ma If the data is is fixed, you can preallocate the bytes string like:
data = b"\x01\x02\x03\x05" # and later spi.write(data)But that only saves some time before the writing starts. The writing speed itself will not be affected and is most likely slower than 40 MHz. The baud rate you specify is just an upper limit.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login