Image by RAEng Publications via Pixabay
Question from the Customer:I am testing SPI devices with the Aardvark I2C/SPI Host Adapter and the Level Shifter Board. For running tests, I am using Control Center Serial Software to control the Aardvark adapter in batch mode. I have a question about the SS (Slave Select) behavior.
The following script sets SS with active low and runs two transactions:
<adapter><configure i2c="1" spi="1" gpio="0" tpower="1" pullups="0"/>
<spi_bitrate khz="1000"/>
<spi_config polarity="rising/falling" phase="sample/setup" bitorder="msb" ss="active_low"/>
<spi_write ss="0" count="2" radix="16">90 00</spi_write>
<sleep ms="10"/>
<spi_write ss="0" count="2" radix="16">91 00</spi_write>
<sleep ms="10"/>
</adapter>
I have probed the SS signal with an oscilloscope and noticed that the SS signal stays low after a transaction is completed. If I run a script with multiple transactions, I see that SS goes high before the first transaction and then low during the 1st transaction, and high again before the 2nd transaction and low during the 2nd transaction, etc. However, after the last transaction, SS stays low – the slave device remains selected.
My concern – I assume it would be safer to unselect the slave device. The “safety” is protecting the slave device from responding to any possible undesired clock edge on the SCLK.
My question – is there a way to execute an Aardvark SPI transaction so that SS returns to and remains in the logic high state after completing a transaction?
Response from Technical Support:Thank you for your question! We see no problems in your script. The challenge you have is a hardware issue, which is easy to address.
When the Aardvark adapter is in master mode, during the transaction the SS signal is actively driven low/high, which depends on the SS configuration. The MOSI and SCLK lines are driven as appropriate for the SPI mode. After each transaction is complete, the SS, MOSI and SCLK lines return to a high impedance state.
In addition to deselecting a slave device, this feature allows the Aardvark adapter that had been acting as a master to reconnect to another environment as a slave. This way, the Aardvark adapter does not fight the master lines in the new environment. For more information about SPI modes, please refer to the section 2.4.3 Pin Driving of the Aardvark I2C/SPI Host Adapter User Manual.
To resolve the issue you described, we recommend adding 4.7K ohm pull up resistors on the SS, MOSI, and SCLK signals on the SPI slave. Note – the Level Shifter Board does not include pull-up resistors.
We hope this answers your questions. Additional resources that you may find helpful include the following:
If you want more information, feel free to contact us with your questions, or request a demo that applies to your application.