Let's say we're writing two programs that uses both UART bus. The program A uses UART at 9600bps baud rate, and the program B uses UART at 115200bps baud rate. Can both of them operate concurrently and independently without affect each other?

  • you did not clearly define what operate concurrently means .... so i will say yes, in a restricted manner ... the serial bus uses two data lines ... you can transmit data at one baud rate and receive data at a different baud rate, both at the same time .... however, you cannot use a digital data line for more than one data stream at any one time .... think about a light bulb ... you cannot have it turned on and turned off at exactly the same time .... that sort of behavior only happens in the quantum realm
    – jsotola
    Aug 4 '19 at 16:47
  • Based on the accepted answer, I've edited this to reflect the scope (the question "run mulitple programs accessing the same hardware" is way, way too vague to be answerable).
    – goldilocks
    Aug 4 '19 at 19:45
  • I wasn't talking about UART only. There are other protocols on raspberry pi as well such as I2C, SPI etc. In which I think concurent accessing might be cause colisions as well.
    – MrBit
    Aug 7 '19 at 15:32

No, in general they can not. An RS232 based serial link is not a bus, it is a single node to node connection.

There is something called RS485 which is used for multi-node connections. However RS485 only operates with a single baud rate for all nodes.

You could try to program your solution but would have to cope with collisions yourself. This might work if you can write the software at the Pi end and each of the devices you want to talk with.

However if one device only transmits and the other device only receives it might be possible (I'm not sure if the Pi end can cope with different receive and transmit baud rates).

  • Is there any solutions like making a "generic driver" that can fordward the comunication to and from the hardware? I was trying to do that by myself using inter process communication but I'm trying to find if there's something that can do that for me.
    – MrBit
    Aug 4 '19 at 15:21
  • 1
    There is no generic solution to all problems. There may be a solution to your problem but we can't know that until we know the details of your problem. If you have a real problem in mind I'd be tempted to ask it in a new question.
    – joan
    Aug 4 '19 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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