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.

Manual control over SPI chip select for cc2650

Other Parts Discussed in Thread: CC2650

Hi all,

I'm working with cc2650 on a custom board, connected to Xbee wireless communication module by SPI.

I have successfully established SPI communication with the chip select automatically controlled by the driver. However, now I am trying to switch to manual control over the CS pin, since this allows to put the Xbee module in and out of sleep mode.

I didn't find examples or documentation so I did my best to figure it out, but it looks like I missed something. I set PIN_UNASSIGNED as the csnPin in HW attributes in my board.c, and then tried to set the CS pin as low (it's defined as an output GPIO). The program is running but SPI communication isn't working. Is there anything else I should have done? 

I'm working with TI-RTOS 2.14.3.28 and XDCtools 3.31.1.33.

Thanks!

  • Mirib,

    Have you looked at the CC26xx LCD driver?  It uses SPI and separately controls the chip select using the PIN driver.  

    You can find the source for the driver in the TI-RTOS installation: tirtos_simplelink_2_14_03_28\packages\ti\drivers\lcd

    Regards,
    Scott

  • Hi Scott,

    Thank you for pointing out the LCD example.

    I went over the example and the driver, but I'm still not sure where to go from here. From what I can see, the way it works is:

    1. In board.c, the CSN pin in the SPI driver is PIN_UNASSIGNED.

    2. Board_LCD_CSN is initiated as part of the BoardGpioInitTable, and later configured as part of the lcdPinTable in the LCD driver.

    3. The LCD_sendCommand function asserts the pin by PIN_setOutputValue(hPin, hwAttrs->lcdCsnPin, 0) and de-asserts it when the transaction is finished.

    This is pretty much what I did, except I'm asserting the CSN pin at startup and trying to keep it asserted all the time (there is nothing else connected to that SPI line). Could that be my problem?

    Thanks!

  • Mirib,

    When/where exactly are you “asserting the CSN pin at startup”?

    Have you checked the pin state with a meter or scope to verify it is indeed asserted when you are trying to communicate with the Zigbee module?

    Thanks,
    Scott

  • Hi Scott,

    I took another look at the LCD example and compared the settings in BoardGpioInitTable to mine.
    I had the CS pin initiated like this:
    Board_SPI_RF_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MIN,
    and then I had PIN_setOutputValue(gpioPinHandle, Board_SPI_RF_CS, 0) after BIOS_start (in a task).

    I changed the BoardGpioInitTable line to
    Board_SPI_RF_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,
    same as the LCD example, and now all is working.

    Thank you!
    Miri

  • Hi Miri,

    OK, great, thanks for reporting back!

    Regards,
    Scott