• 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 If the data is is fixed, you can preallocate the bytes string like:

    data = b"\x01\x02\x03\x05"
    # and later

    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.

  • @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 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.

Log in to reply

Pycom on Twitter