Hardware Reference
In-Depth Information
Figure 10-5. Connection methods; SPI sharing with SABB
The first step is to drop the chip-select line low between SABB devices. A null byte is sent to all devices on the bus
instead of a matching address or broadcast. Now, as long as this common chip-select line remains low, none of the
devices sharing the SABB device will attempt to hold the data lines. After this step, an SPI device may be used in slave
mode. While SABB does not require additional chip-select lines between devices, SPI does. A chip-select line per slave
to be connected should be used. Connect the SPI device to the MISO, MOSI, and SCK of the SABB device and the
dedicated chip-select line as well. When this unique chip-select line is pulled low, SPI communication can take place.
To release the lines, raise the chip-select lines.
Conversion to Mega
Consistent with other chapters, the code for this chapter was written to support the Arduino Uno. Should the need arise,
you can convert from Uno code to Mega relatively simply. The Mega, having more I/O pins and more program space,
could be replaced by multiprocessing smaller boards. While this is certainly a viable option, the Mega uses a chip set with
more features than the Uno. The Mega may also be an attractive solution because of its density of I/O pins per device.
The first step is to identify the pins and ports that will be used on both devices. When using the SPI core, we
are locked into using specific but unique pins from one board to another. Both devices use PORTB for SPI, but the
bit position in the register is unique, as is the order. This confusion stems from design considerations on the part of
Atmel in assigning PORT definitions. It is then abstracted again by Arduino, in the mapping of the pins on the board
to the chip set. Once the pins and ports are identified, it is a good idea to create a cross-reference chart, as shown in
Tables 10-11 and 10-12 .
 
Search WWH ::




Custom Search