SPI issues on CS line

Started by vnv, November 22, 2022, 06:00:18 PM

Previous topic - Next topic

vnv

Hello everyone,

there are issues on CS line for SPI which are very very strange.

So I have a small code running in python which sends out 0x40 command and does the read.
Problem is that CS bounces down/up couple of times before doing real clocking which puts device in some bad state because devices doesn't expect CS to bounce for no reason.

Here is the code:

#!/usr/bin/env python

import os
import sys

if not os.getegid() == 0:
    sys.exit('Script must be run as root')

from time import sleep
from pyA20Lime import spi

spi.open("/dev/spidev1.0", mode=0, delay=0, bits_per_word=8, speed=500000)

while True:

    spi.write([0x40])
    value = spi.read(2)
    print value

    sleep(0.4)

spi.close()


And here are the images what goes on,


https://pasteboard.co/GEp40MmZ14i6.png

https://pasteboard.co/A2EigGNS9XSk.png





Does anyone knows what could this be and why would CS pin bounce before actual clock cycles start to go out?


BR!

LubOlimex

Olimex-made Python PyPi packages are no longer maintained and don't work well with latest Olimage Linux images. If you are interested in Python use one of the generic SPI ones:

https://pypi.org/project/spidev/

or maybe try:

https://github.com/cpb-/spi-tools

Of course, you can just use the standard SPI support (without Python) that is built-in the latest images.
Technical support and documentation manager at Olimex