I want to send values from an RPi to a DAC in order to generate an analog signal. The DAC is 16 bits, and I'm using the py-spidev library. Let's say I have a pre-prepared list of 1000 16-bit values that I want to send, and I want a signal to last exactly 1 second, which means 1 ms to send each value. Is there any way to define this timing using the xfer function, for example? Using time.sleep or a loop doesn't help because I don't get the necessary temporal precision. Additionally, the chip select (CS) must activate for each 16 bits. Any other ideas are welcome.

  • pigpio should be capable of this (using waves, not spidev). For pigpio to work you need a Pi earlier than the Pi5 model.
    – joan
    Apr 3 at 6:59


Your Answer

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

Browse other questions tagged or ask your own question.