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.

CC3200 multi-slave SPI

Other Parts Discussed in Thread: CC3200, CC3100

Dear all

I am using CC3200 as a master to talk to 2 different device one is LCD and the other is SPI to USB converter chip.

since cc3200 dose have only one SPI with only one chip select, I am wondering can I use un-used GPIO and program it as a second chip select to read/write data to either or them explicitly?

Although, I would much rather to use 2 chip select, is there any possibility to daisy chain slaves and is this recommended because I have to have continuous data communication through USB . Is cc3200 capable of doing it? 

would you please also provide reference design for this as well ?

Thanks

Mehran

  • Hi Mehran,

    Yes you can use a GPIO as a CS, the CC3200 would then have to establish a new SPI connection each time you want to talk to a different device (which shouldn't be a problem).


    According to the CC3200 Datasheet, the CS is only there to be able to programm a timing control when using an external clock. I'm not sure though whether you should use the CS pin at all if you are planning to use other GPIOs as CS as well. You might want to check out the SPI implementation on the CC3200.

    Regarding Daisy-Chaining the devices: This would only be possible if all but one device in the chain supported daisy chaining and usually only identical chips which are meant to be daisy chained even support chaining.
     I'd go for the "one-bus-with-CS" option.

    Please also consider, that a Level-Shifter might be needed if not all devices are powered from the same rail.

    Regards
    Max

  • Hi Max

    I guess the next question would be, Can any GPIO be programmed as CS? 

    Do you have example code for programming CC3200 GPIO for this purpose or is there any specific documentation mentioning how to do that?

    Thanks

    Mehran

  • Hi Mehran,

    my info is based entirely on my research on the CC3100 and may not entirely apply to the CC3200, therefore you should double check everything I say here.


    So far: Yes any GPIO that isn't otherwise used can be used as a ChipSelect. You would simply pull one CS line low manually in the firmware before initializing a SPI transfer. I don't know how high-level the SPI library for the CC3200 is, however if it automatically controlls the on-chip CS pin as well, I would advise not to connect it, as it may result in multiple slaves trying to communicate at once.

    There should be some SPI sample code in the CC3200 samples, I'd recommend to have a look at those before settling on a specific design.

  • Hi again

    Below is the main function of SPI demo code for CC3200 I just want to verify that the Chip Select can be set manually into different pin

    this part of code can configured to change pin MUX

    PinMuxConfig();

    //
        // Enable Peripheral Clocks
        //
        MAP_PRCMPeripheralClkEnable(PRCM_UARTA0, PRCM_RUN_MODE_CLK);
        MAP_PRCMPeripheralClkEnable(PRCM_GSPI, PRCM_RUN_MODE_CLK);

        //
        // Configure PIN_55 for UART0 UART0_TX
        //
        MAP_PinTypeUART(PIN_55, PIN_MODE_3);

        //
        // Configure PIN_57 for UART0 UART0_RX
        //
        MAP_PinTypeUART(PIN_57, PIN_MODE_3);

        //
        // Configure PIN_05 for SPI0 GSPI_CLK
        //
        MAP_PinTypeSPI(PIN_05, PIN_MODE_7);

        //
        // Configure PIN_06 for SPI0 GSPI_MISO
        //
        MAP_PinTypeSPI(PIN_06, PIN_MODE_7);

        //
        // Configure PIN_07 for SPI0 GSPI_MOSI
        //
        MAP_PinTypeSPI(PIN_07, PIN_MODE_7);

        //
        // Configure PIN_08 for SPI0 GSPI_CS
        //
        MAP_PinTypeSPI(PIN_08, PIN_MODE_7);
    }


    Then code will jumps to Master function and in 

    MasterMain();

    after message got initiated then

    MAP_SPIConfigSetExpClk(GSPI_BASE,MAP_PRCMPeripheralClockGet(PRCM_GSPI),
                         SPI_IF_BIT_RATE,SPI_MODE_MASTER,SPI_SUB_MODE_0,
                         (SPI_SW_CTRL_CS |
                         SPI_4PIN_MODE |
                         SPI_TURBO_OFF |
                         SPI_CS_ACTIVEHIGH |
                         SPI_WL_8));

    then the next line of code is

     MAP_SPIEnable(GSPI_BASE);

    Enables the chip select in software controlled mode

    and then will put the message into buffer and will transfer it, so far there is no signs of being able to choose how and which CS need to be activated!!!!!!!!

    now i found these two guys

    • SPI_SW_CS
    • SPI_HW_CS

    however I couldn't find any information about SPI_HW_CS  which i think it could be solution. would you please give me more information about this whether this can activate the targeted pin as a CS????

     

    Thanks.

     

  • Hi,

    if you look at the Pin Description in the CC3200 datasheet, you can see that Pin 8 is the "included" Chip-Select Pin and Mode 7 sets the pin so SPI_CS Mode. This is where this line comes from:

        //
        // Configure PIN_08 for SPI0 GSPI_CS
        //
        MAP_PinTypeSPI(PIN_08, PIN_MODE_7);

     

    1. This pin Mode however is only present on Pin8, i.e. you can't just replace PIN_08 by any pin you wish.
    1. It may be, that you can somehow choose via the MAP_SPIConfigSetExpClk function, how the CS should be managed, have a look in the implementation of that function, if the source is available.

     

    However I still believe that if a different CS pin isn't directly supported by the SPI API, you still could programm a manual CS function yourself. This might be a bit involved however.


    You could also think about a multiplexer chip behind the CC3200's CS pin.

     

    Please also have a look at the http://www.ti.com/lit/ug/swru367b/swru367b.pdf document as there may be useful info in there.

  • Here is a forum post including a code fragment from TI Support showing how to use a GPIO for SPI CS:

    http://e2e.ti.com/support/wireless_connectivity/f/968/p/359727/1265934.aspx#1265934

  • Hi Mehran,

    I am closing the thread, if issue still exist please open a new thread and add a link to this one for reference.

    Best regards,

    Naveen