I am using a Raspberry Pi to communicate with a SPI-enabled device over the 40-pin cable. To the best of my understanding, the Python scripts rely on the SpiDev device. The script uses the xfer3() API for writing/reading data.

For specific device purposes, I need to set the start of data delay between the assertion of CS and start of SCLK. I found the documentation for xfer3() and it looks like this:

rcvd = xfer3([values], speed, delay, bit)

Apparently, there is a delay parameter. However, it seems like the delay is at the end of transmission.

Is there a way to configure the delay at the beginning of the packet transmission?

1 Answer 1


You will have to control CS yourself. You will have to assert the signal, delay, and then call the SPI transfer.

Unless your delay is significant (milliseconds rather than microseconds) this is likely to be pretty hit and miss as each step will be subject to the vagaries of Linux timing.

  • Thanks. Any pointer on how to control the CS? Do you mean directly minipulating the GPIO pin?
    – ysap
    Jan 21, 2022 at 15:29
  • @ysap Yes, setting the level directly.
    – joan
    Jan 21, 2022 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.