I'm using the raspberry pi pigpio module to communicate with two other devices at once using two separate threads. The devices are connected to two different pairs of gpio pins. I need to adhere to strict timing limits for the request response sequences between the pi and each of the two devices.

The only way I'm able to send a message to a device is to acquire a lock and block the other thread from sending any messages, because otherwise the threads interfere with each other in defining the waveform. But blocking a thread from sending a message significantly increases the risk of going over the time limit and messes up the sequence.

Is there a way for the two threads to send messages from the pi to the two devices completely independent of each other. In other words can I store define two separate chains of waveforms dedicated to each thread so they don't interfere?

1 Answer 1


You can create several waveforms but only one can be transmitted at a time.

Depending on your application it might be possible to mitigate the delays by having a single thread dedicated to sending the waveform. The waveforms can be merged prior to transmission.

This doesn't sound simple though. Perhaps you will need some USB to serial dongles.

Your Answer

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

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