5

I have 2 Raspberry Pis in my system. One can be 'docked' to the other one and some time later it can become 'undocked'. While docked, the 2 Pis will have a connection between 2 GPIO pins ( 1 pin on each Pi ). So there will be 1 wire that connects both Pis. These 2 Pis will be the only systems on the 'bus', it is only a point to point connection.

I am aware of the Dallas 1-wire protocol ( have used it with a temp sensor on the Pi but it had a kernel driver that did all of the work ), but I know it is difficult to meet timing and there is no easy way to use it from Userspace. I have heard of making a UART at 115200 Baud emulate the protocol but I have no free UARTs in my system. So Dallas 1-wire is not feasible.

Basically, when the 2 Pi's are docked, the master will send the slave an SSID string and there will be a simple ping-like operation ( ping from slave / ACK from slave ) that will notify both Pis they are docked. So the communication is very simple.

This can be completely proprietary with emphasis on simplicity. I can use Python or C or Qt ( C++ ), or just Bash if possible...

I would greatly appreciate any help or guidance on how to achieve this. What is the best, very simple way to implement this communication?

Ghanima
  • 15,855
  • 15
  • 61
  • 119
PhilBot
  • 71
  • 3
  • 7
  • 25

1 Answers1

3

This post contains some discussion on 'bit banging' (apparently the term for software-implemented UART) on a Raspberry Pi - it might have some information you could use ?

How to get more than one uart interface

And as far as simple encoding - the Manchester Encoding scheme looks quite straightforward to implement; but as you have two-way communication, it seems you are going to have invent a protocol which allows two-way operation, so you'll need to add this feature to your protocol. Also - I have no idea how you accurate you need to generate your timings to be for this to work.....I guess you will have to implement in 'C' to get the speed /accuracy you need: perhaps a custom Kernel Module - dunno.

Will both Pis have an accurate date/time set at the point when they are connected ? Maybe you could use that somehow to synchronize (if you are willing to transmit/recieve at a very low data-rate ....(I suspect the 'docked' system will not have got it's time at this point though - I guess it is not connected over IP, and this part of the reason you are doing this...)

Additionally: if you do get this working - could be a nice little project to share to the community - could be a handy way to boot-up a Model-A device by getting a 'leg-up' from another already running/connected Raspberry...

monojohnny
  • 569
  • 1
  • 6
  • 17