Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-detection of Raspberry Pi is a PiStack node or not? #1

Open
herry13 opened this issue May 10, 2018 · 7 comments
Open

Auto-detection of Raspberry Pi is a PiStack node or not? #1

herry13 opened this issue May 10, 2018 · 7 comments
Labels
question Further information is requested

Comments

@herry13
Copy link

herry13 commented May 10, 2018

Is there any simple way to probe whether a Raspberry Pi is a PiStack node or not? Perhaps by sending a signal through GPIO and evaluate the response.

@herry13 herry13 added the question Further information is requested label May 10, 2018
@herry13
Copy link
Author

herry13 commented May 10, 2018

Currently I use an extra Raspberry Pi as a top-of-the-rack node that controls the PiStack boards through USB-RS232 interface. I think this Pi can do auto-probe by:

  1. detecting if there's /dev/ttyUSB[0-9]
  2. do C.get_hw_version(0..15) to auto-detect the boards

By doing this, we'll have somekind of plug-n-play capability.

@pjb304
Copy link
Member

pjb304 commented May 10, 2018

in stackdaemon.py there is a detect_hat function that checks to see if a hat is detected, if there isn't then it throws an exception. This is done using the EEPROM on the pi stack

@pjb304
Copy link
Member

pjb304 commented May 10, 2018

In the latest version of the comms.py there's a search function which will return a tuple of (Number of pi stacks found, [id1, id2...]. Whilst 15 is the highest ID that can be set using the DIP switches, I've now implemented a few commands that enable you to persistently set an id prefix (ie. change the 4 MSBs in the ID), so the max is now 255.

The search command is defined as search(self, start=0, stop=256) so you can specify the min and max IDs that it looks for.

There is now also the commands to tell the pi stack to always power on a specific pi at boot time so the control pi can also be powered from a pi stack board. set_pi_on_startup(self, dev_id, pi_id, status=True)

Hope they do what you are after :)

@pjb304
Copy link
Member

pjb304 commented May 10, 2018

For the set_pi_on_startup you'll need to be on pistack firmware v4

@herry13
Copy link
Author

herry13 commented May 10, 2018

Thanks, I'll have a look on detect_hat function. It would be nice if the fruit-monitor can generate a monitoring status that the Raspberry Pi is a PiStack node, and if it does then fruit-config can auto-start the PiStack-daemon.

@herry13
Copy link
Author

herry13 commented May 10, 2018

pistack firmware v4

Is this the firmware that you send to me few days ago?

@pjb304
Copy link
Member

pjb304 commented May 10, 2018

That makes sense, feel free to refactor the code if it makes it easier. This was thrown together quickly to test the hardware.

Yes firmware v4 is the one I sent you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants