You are here

SPI Slave Selection

There is different number of available SS lines for each DLN-series adapter. There is 1 SS line for DLN-1 adapter, there are 5 SS lines for DLN-2 and 4 SS lines for DLN-4M/S adapters. If you need more SS lines you can use unengaged GPIO pins as well.

An SS line is used to select an SPI slave device. Slave device is selected by calling the DlnSpiMasterSetSS() function.

Selecting Single SPI Slave Device

If you use the DLN-series adapter in Full Duplex or Half Duplex (Single Read) mode, you can only select one slave device at a time.

SPI Full Duplex Transfer

In order to deactivate all devices send a 0xFF (1111 1111) value. A slave device can be selected by changing the corresponding bit value to 0.

Example: Slave device #01 can be selected by calling the DlnSpiMasterSetSS() function and passing 0xFD (1111 1101) value as the ss parameter.

Selecting Several SPI Slave Devices At Once

If you use the DLN-series adapter in Half Duplex (Single Write) mode, you can activate several slave devices at once.

SPI Half Duplex Transfer

A user can address the required slave devices by changing the respective bit values to 0.

Example: Slave device #00 and #02 can be activated by calling the DlnSpiMasterSetSS() function and passing the 0xFA (1111 1010) value as the ss parameter.

Addressing up to 15 SPI Slave Devices

If you connect the ss lines to an external decoder/demultiplexer, you will be able to connect more slave devices to single DLN-series adapter.

SPI Slave Selection with Decoder

In order to use this feature you need an external decoder/demultiplexer (e.g. 74HC4515). With a decoder/demultiplexer connected, the SS lines are used to send a 4-bit value. A user can address the necessary slave by sending its number (values from 0 to 15). The numbers 0 to 14 represent the number of the slave device, while 15 means that no device is selected. This means you can connect up to 15 slave devices to the DLN-series adapter.

Example: Slave device #11, can be activated by calling the DlnSpiMasterSetSS() function and passing the 0xFB (1111 1011) value as the ss parameter.

Rating: 
Average: 2.7 (3 votes)

User login