Giter VIP home page Giter VIP logo

Comments (3)

Gadgetoid avatar Gadgetoid commented on August 27, 2024

Could you post a minimal code example to reproduce this? I've just tested this with the following code and verified via my scope that it's taken effect:

import time
import sys
from spidev import SpiDev

dev = SpiDev(0,0)
dev.max_speed_hz = 10

try:
    while True:
        dev.writebytes([1,2,4,8,16,32,64,128])
        time.sleep(0.001)
except KeyboardInterrupt:
    sys.exit(0)

I believe the speeds, in hz, snap to the nearest available speed due to the way the hardware works. It could be that you're trying to make a change too small, so it's just snapping to 64Mhz ( should be 62.5Mhz )

A table of speeds is listed here: https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md

from py-spidev.

tnedev avatar tnedev commented on August 27, 2024

I'm using the SPIDev through Adafruit Python ILI9341 and GPIO Libraries

Adaftuit GPIO Python Library: https://github.com/adafruit/Adafruit_Python_GPIO
Adafruit Python ILI9341: Library: https://github.com/adafruit/Adafruit_Python_ILI9341

I'm running extended version of this example code:https://github.com/adafruit/Adafruit_Python_ILI9341/blob/master/examples/image.py

Basically, Adafruit Python GPIO SPI provides a wrapper for the SPIDev
Changing the clock speed of the Python SPIDev wrapper does not change the clock speed which I confirmed with logic analyzer.
My guess was that the problem comes from the SPIDev library.
I will test with your example code and confirm if it works with me.

From what

from py-spidev.

tnedev avatar tnedev commented on August 27, 2024

Hi,

I confirm that it works well through the original SPIDev. It seems that the Adafruit wrapper messed it up somehow.

Case closed.

from py-spidev.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.