SPI connection to MDEK1001 over Raspberry with Python?

  • I connected my mdek1001 board to my raspberry pi.

  • Uart mode over shell worked.

  • I write simple python script to access features.

  • Start with the simple command like reset which did not required input data or response.

  • In shell mode reset works and all lights on when starting unit again.

  • TVL frame for reset is 0x14 0x00 according to API guide.

  • also >tvx 0x14 0x00 command works in shell too.
    in python ;

    import spidev
    import time
    spi = spidev.SpiDev()
    spi.open(0, 0)

    spi.xfer2([0x14, 0x00])

    spi.writebytes([0x14, 0x00])

    spi.xfer2([0x14, 0x00])

But none of them working ?

Is anyone share their codes to start ?

Regards

Solved.
It’s looks like the spi mode problem.
Now working code is ;
import spidev
import time

spi = spidev.SpiDev()
spi.open(0, 0)
spi.max_speed_hz = 16000000
spi.mode = 0
spi.xfer([0x14, 0x00])

1 Like