"1" is the Register we're reading/writing to."0x20" - is the address of the I/O expander."1" - is the I 2C bus we're communicating on.If you know the decimal or hex you can set this directly as "-m 64" or "-m 0x40" for example). "-m $((2#00100000))" - is the mask of which bit(s) to set (here we're using bash to convert from binary to decimal.The above i2cset command options can be broken down as. # Version >2.0 turn HUB off (set bit 5 to 1) # Version 2.0 turn HUB off (set bit 5 to 0) # Version >2.0 turn HUB on (set bit 5 to 0) # Version 2.0 turn HUB on (set bit 5 to 1) For a Version 2.0 the HUB bit (5) needs to be set to 1, for versions >2.0 the bit needs to be set to 0. # Set all pins on the I/O expander to outputs If the low nibble of this value is an 'F' (0x?F) it means all Pi Zeros are powered on and the POR jumper has been cut so all Pi Zeros need to be powered on before setting the expander pins to outputs. If the direction regiser is 0xff you will need to read the logic levels on the I/O expander pins to detect POS. If the value is not 0xff then the expander has been initialised so skip directly to controlling power to the Pi Zeros below. If you don't need to check this you can jump to the "Set all pins on the I/O expander to outputs" section below.įirst check if the direction register is still set to it's default value 0xff (has the I/O expander been initialised). To initialize the I/O expander the "direction" register needs to be set but care is needed in case the POS (power on state) jumper has been cut (to automatically power on the Pi Zeros). Here we're only showing the basics of initial initialisation, turning on/off Pi Zeros, HUB and ALERT LED. On Raspbian based distributions this can be enabled using raspi-config.ĭepending on availability we currently use XRA1200P and PCA9554 I/O expanders (datasheets linked above), the registers 0, 1, 2 and 3 work in the same way for both of these devices.Ĭontrolling the Cluster HAT using the I/O expander is a little more complicated vs the GPIO interface used by the Cluster HAT v1.x but allowed many new features to be added. #FAN CONTROL V1.2 DOWNLOAD INSTALL#To follow the examples install the command line tool.Īs the Cluster HAT is controlled by I 2C you must first ensure I 2C is enabled in the kernel. You can use other commands/languages to communicate with the I 2C expander such as C, C++, Python, etc. In the command line examples below we're using the i2cset tool. #FAN CONTROL V1.2 DOWNLOAD DOWNLOAD#If you're not using our images you can download our clusterctrl script (may need modification for your configuration) or use i2cset/gpio(wiringpi tool) to directly toggle the I/O expander or GPIO pins. $ clusterctrl wp off # Disables EEPROM write protect (only needed for updates) $ clusterctrl wp on # Write protects HAT EEPROM $ clusterctrl led off # Disables Power & P1-P4 LED on Cluster HAT (does not disable ALERT LED) $ clusterctrl led on # Enables Power & P1-P4 LED on Cluster HAT (default) $ clusterctrl hub off # Turns off USB hub $ clusterctrl hub on # Turns on USB hub (default) $ clusterctrl alert off # Turns off ALERT LEDĬluster HAT v2.x (commands not available on Cluster HAT v1.x) $ clusterctrl alert on # Turns on ALERT LED $ clusterctrl off p2 p3 # Turn power off to Pi Zeros in slots P2 and P3 $ clusterctrl on p1 p3 p4 # Turn power to Pi Zeros in slot P1, P3 and P4 on $ clusterctrl on p1 # Turn power on to Pi Zero in slot P1 $ clusterctrl off Turn power to all Pi Zero off From the Controller Pi power to the Pi Zeros can be controlled using the "clusterctrl " command on our configured images.Ĭluster HAT v2.x Cluster HAT v1.x $ clusterctrl on # Turn power to all Pi Zero on
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |