![]() |
CROSS Technical Documentation User Manual and Technical Doc.
INFN Milano Bicocca
|
This chip is exploited to set the chips select
SUMMARY:
This chip is the PCA9554 (PCA9554A datasheet).
This chip is exploited to manage the chip select pins of the chips that work with SPI or with a parallel bus. They are 3 chips that are selected, by mean of the user functions by:
The 3 chips are I2C and their addresses, trasparent to the user, are:
There are 2 functions to use. The first is the initialization function: I2C_to_Parallel_ini_PCA9554() with input parameters: uint8_t scheda_su_scheda_giu, uint8_t select_PCA. The second operational function, I2C_to_Parallel_set_PCA9554_outputs_values() with input parameters: uint8_t scheda_su_scheda_giu, uint8_t select_PCA, uint8_t value is the one that allows to set the port.
The PCA9554 has 4 commands listed below. Only the fourth command, which allows to set the chip as an output port, is exploited for our purpose. For diagnostic purpose the first command, the reading command, is exploited.
The 4 commands are implicitily used in the above functions:
The scheme of the PCA9554 is in Figure Figure_I2C_to_parallel.
The first action to do is to initialize all the 3 PCA9554s. Here the case for the first:
Every chip select is active low, but one, so the starting output values, all chps off, transparent to user, is not 0xFF for the 3 chpis, but:
To easy the job there is the 4 taps vector I2C_to_Parallel_ini_set that contains the 3 values above in the last 3 positions (the first poition is unusued).
There are also structured vectors of constants that have set the parameters of interest regarding the PCA and its pin to select:
The I2C_to_Parallel_set_PCA9554_outputs_values() allows to set any value at the output port and it is usefull for parallel bus driven chips, such as the analog mux ADG14082. For this latter refer to its specific page.
Whenever we need to manage a SPI driven chip the first think to do is to anable it and the first function to use is the I2C_to_Parallel_set_PCA9554_outputs_values() to enable the chip; after the job is done, do not forget to disable the chip. Here is an example:
br
The codes for mamnaging the mux are: