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: 3.5 (2 votes)
BJ Avery
BJ Avery's picture
Offline
Last seen: 2 years 2 weeks ago
Joined: 07/09/2015 - 13:45
Selection with DLN-2 5 lines

Just a question -- it seems a bit unclear in the section on "addressing up to 15 SPI Slave devices" how this applies to the DLN 2 with 5 SS lines. Are only the first 4 SS lines used, or can a DLN2 address up to 31 SPI Slave devices? In this case, is 15 still treated as "no selection" or would that be 31 instead? Thanks.

Maxim
Maxim's picture
Offline
Last seen: 9 months 3 weeks ago
Joined: 07/14/2013 - 09:10
You can simply use 5 inputs

You can simply use 5 inputs decoder to get 32 outputs for DLN-2.

User login