1

Let's say that I have connected Raspberry Pi 3 GPIO GND pin to PC RS-232 GND pin, Raspberry Pi 3 GPIO pin 8(UART Tx) to PC RS-232 Rx pin and GPIO pin 10(UART Rx) to PC RX-232 Tx pin through level shifter. As Raspberry Pi 3 can be controlled over serial connection and Raspberry Pi 3 itself can control other devices over serial connection, then which device is controlling which in scenario described above? Or is it possible that I log into Raspberry Pi 3 from PC over serial connection and the other way around at the same time? This is a bit weird question, but maybe somebody could explain this.

  • If you do that you will destroy the Pi. A PC RS-232 port is +/- 12V which will quite happily kill a Pi. Do you have some sort of converter dongle at the PC or PI end? – joan Apr 20 '16 at 15:37
1

UART serial communication at a fundamental level is not master/slave based like say, USB or I2C is. It is about as simple a protocol as can be imagined and simply describes how groups of bits (usually, 8 of them in a byte) can be communicated across a wire. There must be a previous arrangement between the two parties about some of the details (including the speed) in order for this to work, or else they will just interpret random rubbish from each other.

which device is controlling which in scenario described above

Neither has any control over the other. A very accurate analogy would be, if you call your friend, you are now connected via the phone system. Who controls who in this scenario?

We could say it is possible for you to control your friend or vice versa, either by agreement or some form of psychological coercion. Similarly, there are protocols built on top of serial that could allow one device to control the other; this would require a corresponding software implementation at both ends.

Along those lines, by default the standard Pi operating systems are set up to use the UART port as a "serial console", meaning if you connect to that with a PC, you can login and control the Pi. However, this is easily disabled to allow whatever form of duplex serial communication you can find or dream up to occur. For example, you could run serial console programs from both ends to create a "chat" style scenario (where again, neither party has any control over the other).

0

It depends what you like to do.

If you connect to a serial connection which runs a getty process on your raspberry pi, then it's the same as having a console running ssh or telnet locally.

Otherwise you have to write some client code who parses you serial input and executes the commands.

But I am sure you like to run a getty on you serial device.

See /etc/inittab for more details.

  • /etc/inittab does not exist since Debian/Raspbian ditched SysV init last year. If you have a sufficiently old version of the OS then you may still have it. – goldilocks Apr 20 '16 at 15:02

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.