doceme / py-spidev

MIT License
461 stars 203 forks source link

Unexpected SCK behavior #123

Open Ouroboros75 opened 2 years ago

Ouroboros75 commented 2 years ago

I'm trying to establish a Pi 3b+ as an SPI file transfer master Here's the code i'm using:

`#!/usr/bin/python3 import spidev import time import binascii import RPi.GPIO as GPIO import crc16

spi = spidev.SpiDev() spi.open(1, 0) spi.max_speed_hz = 42000000 GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.OUT) GPIO.setup(18, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)

buffSend=[] for i in range(4192000): buffSend.append(0x48) print("start") print(len(buffSend)) try: spi.writebytes2(buffSend) print("\nsend") except KeyboardInterrupt: spi.close() `

The resulting SCK wave form is: weird

This is rather confusing to me. From what i understand, after each 4 bytes transferred there's an unusual gap until the next 4 bytes. Is that correct? If yes how can i remove this gap. Any help is GREATLY appreciated.