This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to select CHIP SELECT pin of SPI driver of TI-RTOS

Other Parts Discussed in Thread: EK-TM4C1294XL

MCU: TM4C1294NCPDT

TI-RTOS: v2.01.00.03

CCS: v6.0.1.0040

Hello,

    How do we select the CS (chip select) pin of an SPI communication line in the structure SPITivaDMA_HWAttrs?

I find the following structure defined in the example files of TM4C1294XL eval board:

/* SPI configuration structure, describing which pins are to be used */
const SPITivaDMA_HWAttrs spiTivaDMAHWAttrs[EK_TM4C1294XL_SPICOUNT] = {
{
SSI2_BASE,
INT_SSI2,
&spiTivaDMAscratchBuf[0],
0,
UDMA_SEC_CHANNEL_UART2RX_12,
UDMA_SEC_CHANNEL_UART2TX_13,
uDMAChannelAssign,
UDMA_CH12_SSI2RX,
UDMA_CH13_SSI2TX
},
{
SSI3_BASE,
INT_SSI3,
&spiTivaDMAscratchBuf[1],
0,
UDMA_SEC_CHANNEL_TMR2A_14,
UDMA_SEC_CHANNEL_TMR2B_15,
uDMAChannelAssign,
UDMA_CH14_SSI3RX,
UDMA_CH15_SSI3TX
}
};

But how do we select a CS pin here?

In the SSI3 module example of Tiva EK-TM4C1294XL, the CS pin is assigned to port pin PQ1 but I want to change it to pin PN4. How to do that?

Thanks in advance

Regards

Soumyajit

  • Soumyajit,

    The application must manage the chip select itself. It is not managed in the SPI driver. We are looking at adding it in a future release. If you have multiple Tasks calling SPI_transfer (with the same SPI_Handle), you need to add protection around the calls. For example (in pseudo-code):

    Semaphore_pend(csSemHandle)
    Assert desired CS
    SPI_transfer()
    Deassert CS
    Semaphore_post(csSemHandle)

    Soumyajit Das said:

    In the SSI3 module example of Tiva EK-TM4C1294XL, the CS pin is assigned to port pin PQ1 but I want to change it to pin PN4. How to do that?

    I'll get back to you on this.

    Todd

  • Soumyajit,

    Soumyajit Das said:
    In the SSI3 module example of Tiva EK-TM4C1294XL, the CS pin is assigned to port pin PQ1 but I want to change it to pin PN4. How to do that?

    GPIOPinConfigure(GPIO_PQ1_SSI3FSS) is called in EK_TM4C1294XL_initSPI() assigns that pin into the peripheral's hardware mode. In other words, the SSI controller (in hardware) toggles this pin for you as specified in the TivaC's datasheet (the toggle format actually depends on the frame format used).

    However, as PN4 is not multiplexed with the SSI3 controller's Fss pin, the hardware chip select is not an option. Instead however, PN4 needs to be configured as a GPIO output pin and then the application must toggle it manually before and after a SPI_transfer() call. This limitation is something that we are currently investigation to improve.

  • Thanks Todd,

        Your idea worked so good. Don't know why this simple idea didn't click in me first!!

    Thanks

    Regards

    Soumyajit Das

  • Thanks Tom for your comments,

        I got the issue sorted out using GPIO based Chip Select control from code.

    Thanks

    Regards

    Soumyajit