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.

CC2650: Sharing SPI between MCU and SCE code

Part Number: CC2650


Hello,

I am implementing a BLE application where I am reading an analog sensor using ADC in SCE and writing a stream of data to a SPI FRAM. From the main core I am reading the data from the FRAM and transmit over BLE. 

SCE is able to write to FRAM when used through sensor controller studio, but when I am running the task from TI-RTOS context, the SCE is not writing anything to FRAM. I am guessing that once the SPI peripheral is initialized in TI-RTOS the same pins can't be bit-banged by SCE to write to FRAM. Is this correct? If so, how can we share the same pins between SPI peripheral driver in TI-RTOS context and SCE bit-banged SPI driver? 

The following is the crude algo of my code

1. RTOS thread initialized

2. SPI_Init()

Loop {

3. Start SCE task

a. read sensor data

b. write to FRAM over SPI

4. SPI_Open()

5. Read data from FRAM

6. SPI_Close()

7. Transmit data over BLE

}

Niraj

  • Can someone respond to this ?
  • Hi,
    does it work when you keep the SPI driver closed while accessing the pins from the SCE? My understanding is that you cannot use the SPI driver and the SCE at the same time because when calling SPI_open(), the SPI driver decouples the selected SPI pins from the GPIO unit and routes them to the SPI peripheral. Reads and writes won't have an effect then.
  • Richard,

    No, the SPI driver is closed the M3 core every time it finishes the SPI communication. It is taken care that the SCE and the M3 core will not access the SPI pins at the same time.

    I am assuming when we do SPI_Close() the pins assigned to the SPI driver (during SPI_Init()) are release and they assume the GPIO configuration provided during PIN_Init(). Is my assumption correct?

    If not, how can we release the pins from SPI peripheral in the M3 core before I switch to SCE? So that SCE can use it to communicate with FRAM.

    Regards
    Niraj
  • Hi,
    after closing the SPI driver, you need to call scifReinitTaskIo() for the SCE task that you want the IO pins to use. You find this function in the interface code generated by Sensor Controller Studio in scif.h/c.