Post Go back to editing

SPI: Chip Select Signal high after every byte

Category: Software
Product Number: ADSP-SC584
Software Version: CCES 2.12.0

Hi all,

I am working with the ADSP SC584 and am currently trying out the SPI driver. I have installed the add-in for SPi via system.scv.
During my tests I noticed that the chip-select signal goes high after every byte even if you transfer a buffer with several bytes. I have tested different modes (blocking, non-blocking, callback), but it was always the same observation. (No DMA mode)
Is this a normal and desired behavior of the SPI driver? If so, can it be defined differently?

I tried to define the chip select signal as GPIO pin and set it manually to low and high, but that did not work. Is it not possible to use the pins of the SPI modules as GPIO pins?
I worked with the SPI2 module because it is easy to access the signals with the P3 connector.

best regards and thanks for the help

Phil

CS is yellow and green is clock

Thread Notes

  • Hi,

    Please find the details here.
    >>>Is this a normal and desired behavior of the SPI driver? If so, can it be defined differently?

    The SPI_SS signal is an active-low signal. The master asserts the signal during the transfer. The signal can be de-asserted or remain asserted between transfers.

    The SPI module uses the SPI_CTL.ASSEL bit to determine when the SPI hardware or software control the SPI_SEL[n] line.

    Once SPI as master and slave select pin is enabled, SPI slave select signal will be in asserted state (Low since it is active low signal).
    1.When Slave Select Polarity Between Transfers bit (SPI_CTL.SELST) is 0 and hardware slave select is chosen (SPI_CTL.ASSEL=1) SPI hardware automatically brings assert state (Low) to deassert state (High) between the SPI each data transfer.
    2.When SPI_CTL.SELST bit is 1 and SPI_CTL.ASSEL=1, SPI ss line remains in assert state (Low) between the SPI each data transfer.
    Required APIs:
    adi_spi_SetHwSlaveSelect(phSpiMaster,true);
    adi_spi_SetSlaveSelect(phSpiMaster, ADI_SPI_SSEL_ENABLE1);


    Otherwise, SPI Hardware slave select is disabled (SPI_CTL.ASSEL=0), SPI slave select signal will be in asserted state (remains in assert state (Low) between the SPI each data transfer.).

    Required APIs:
    adi_spi_SetHwSlaveSelect(phSpiMaster,false);
    adi_spi_SetSlaveSelect(phSpiMaster, ADI_SPI_SSEL_ENABLE1);

    SPI2_SEL1 Pin must be connected to slave device which is asserted low during the transfers by the hardware. Slave device is woken up by this signal and try to sample/shift the data based on the clock driven by the master. Once data transfer is over, master deasserts the ss pin automatically which disconnects the slave device from the bus. Note that pinmux must be done for that.

    I tried to define the chip select signal as GPIO pin and set it manually to low and high, but that did not work. Is it not possible to use the pins of the SPI modules as GPIO pins?

    >>> Yes. This is possible. You can use GPIO pin to act as slave instead of using dedicated slave select pin. You can use hardware / software slave select method to achieve this. Please note that pinmux for slave select need not be done for this condition.

    Hope this helps.

    Best Regards,
    Santhakumari.K

  • Hi,

    thanks for the qiuck and helpful reply. The first problem is solved for me now. I added this line to my initSPI():

    *pREG_SPI2_CTL |= BITM_SPI_CTL_SELST; // chip select signal stay low between byte transfer


    But for the second question there are still problems:
    My goal ist to use the SPI module with its driver libraies, but still be able to manually control the Chip select line as GPIO output, to set it high and low. I need this because my slave needs one function where the CS signal is low for a specific time and then high again, but now other signal (clock, miso,mosi) should be active.

    For my SPI module i need to pinmux my CS signal to Pin C_06, but then i can't use Pin C_06 as a GPIO output any more. I tried the SPI module and the GPIO Pin in seperate projects and both worked perfectly fine on their own, but when putting both together in one project, I can't use the Pin C_06 as a GPIO output any more.

    Any suggestions how i can use both functinalities simultaneously?

    Is there maybe a Bit in one SPI register, where i can controll the Chip Select line and simply set and clear that bit? I don't want to use a second output GPIO pin to set and clear the CS signal.

    Thanks for the help
    Phil

  • Hi Phil,

    Unfortunately here is no other option to control the Chip Select line to set and clear for SPI.

    The SPI2_SEL1b and SPI2_SSb pins are multiplexed with PC_06 pin. Therefore, you cannot use both SPI2_SEL1b and PC_06 in the same application.

    If you want to use PC_06 in your application, please consider using SPI2_SEL2b or any other slave select pins, as the SPI2_SEL2b pins do not conflict with those PC_06 pins.

    Please ensure to make connection with SPI2_SEL2b via P1A from ADSP-SC584 EZ-Board for SPI communication.

    For more information, please refer the ADSP-SC584 EZ-KIT Schematic linked below:
    www.analog.com/.../ADSP-SC584_EZ_Board_Schematic-Rel_1-4A.pdf

    Hope this helps.

    Best Regards,
    Santhakumari.K