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.

CC1310: SPI PINS

Part Number: CC1310


Hi, im looking the spislave example and i dont understand in what pins, in what IOID,  this signals are connected: 

Board_SPI_MASTER_READY

Board_SPI_SLAVE_READY

is a typedef definition but in what pins are connected?

  • OK, is IOID15 AND 21. 

    but one question, this signals are necessary? I want to connected CC1310 whit Raspberry, is necesarry this signals or whit MOSI,MISO CLK is sufficient?

  • MASTER_READY and SLAVE_READY are not required.

    See  https://dev.ti.com/tirex/explore/node?node=AOng5xFsavzvQ16.KytQHg__eCfARaV__LATEST for usage of the driver.

  • Hi, i have a CC1310 master and CC1310 Slave, i want to send  this data "envio :n", n is the number off transmition. I have only 1 slave, is necesarry connect CS pin? and how can do this?  this is my code. I want to transmit all time

    //SLAVE
    
    void *slaveThread(void *arg0)
    {
        SPI_Handle      spi;                    //MANEJADOR SPI
        SPI_Params      spiParams;              //PARAMETRO SPI
        SPI_Transaction spiTransaction;         // TRANSACCION SPI
        uint8_t transmitirBuffer[SPI_MSG_LENGTH];      //BUFFER TX SPI
        uint8_t recibirBuffer[SPI_MSG_LENGTH];         //BUFFER RX SPI
        bool            transferOK;             // BOOL PARA SAVER SI SE HA HECHO LA TRANSMISION
        SPI_init(); // Inicializar el controlador SPI
        SPI_Params_init(&spiParams); // Inicializar parámetros SPI
    
        spiParams.frameFormat = SPI_POL0_PHA1;              //FORMATO DE LA TRAMA
        spiParams.mode = SPI_SLAVE;                         //MODO ESCLAVO
        spiParams.transferCallbackFxn = transferCompleteFxn;    //FUNCION CALLBACK CUANDO SE REALIZA UN ENVIO
        spiParams.transferMode = SPI_MODE_CALLBACK;             //MODO CALLBACK
        spi = SPI_open(Board_SPI_SLAVE, &spiParams);       //ABRIR PINES CON PARAMETROS
          if (spi == NULL) {
              Display_printf(display, 0, 0, "Error initializing slave SPI\n");
              while (1);
          }
    
        //COPIAR DATOS EN EL BUFFER PARA TRANSMITIR
        strncpy((char *) slaveTxBuffer, SLAVE_MSG, SPI_MSG_LENGTH); //COPIA LA FRASE DE SLAVE_MSG
    
        while(1)
        {
                slaveTxBuffer[sizeof(SLAVE_MSG) - 1] = (cuenta%10) + '0'; //pongo el numero de transmision en el buffer
                cuenta++;                                               //aumento transmision
                memset((void *) slaveRxBuffer, 0, SPI_MSG_LENGTH);      //limpia buffer de recepcion
                //Rellenar structura transaccion
                spiTransaction. count = SPI_MSG_LENGTH;
                spiTransaction. txBuf = (void *)transmitirBuffer;
                spiTransaction. rxBuf = (void *)recibirBuffer;
                Display_printf(display, 0, 0, "slave envia trama\n");
                //envio trama
                transferOK = SPI_transfer(spi, &spiTransaction);
                if (transferOK) //si el envvio esta en progreso
                {
                    GPIO_write(Board_GPIO_LED1, Board_GPIO_LED_ON);
                    /* Wait until transfer has completed */
                    sem_wait(&slaveSem);
                    Display_printf(display, 0, 0, "Slave received: %s", slaveRxBuffer); //muestro uart lo que se recive del maestro
                }
                else
                {
                    GPIO_write(Board_GPIO_LED1, Board_GPIO_LED_OFF);
                    Display_printf(display, 0, 0, "Error TRASNFERENCIA\n");
                }
    
        }
        //return (NULL);
    }

  • As you can see from the "Synchronous Serial Interface (SSI)" chapter in https://www.ti.com/lit/pdf/swcu117 you see that the CS is part of the SPI bus. 

    Dependent on SPI mode you can either let the driver control the CS pin or you can set the CS pin in the code (see https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/898432/launchxl-cc1310-spi-connection-problem-revealed-between-launchpad-and-memory-device)

    It's not clear from your last post if you see an issue and if you do, what you have issues with. Have you connected a scope or logic analyzer to the lines to monitor and see where the communication fails? 

  • I have my own microcontroller with 3 pins, CLK, MOSI, MISO,
    the first question is: is it necessary to define the CS on the pin board?
    I only have those three signals and since I only have one exclave it shouldn't be necessary.
    The second question is: how can I do it without using cs?
    Is this piece of code okay?

    SPI_Handle mango;
    SPI_Params parámetros;
    transacción SPI_Transaction;
    uint8_t rxBuf[100]; // Búfer de recepción
    Inicie SPI y especifique parámetros no predeterminados
    SPI_Params_init(&parámetros);
    parámetros. bitRate = 1000000;
    parámetros. frameFormat = SPI_POL1_PHA1;
    parámetros. modo = SPI_SLAVE;
    Configurar la transacción
    transacción. recuento = 100;
    transacción. txBuf = NULL;
    transacción. rxBuf = rxBuf;
    Abra el SPI y realice la transferencia
    handle = SPI_open(Board_SPI, &params);
    SPI_transfer(handle, &transacción);

    If I have to use cs, can I put any gpio and set it to 1?
  • As you can see from the "Synchronous Serial Interface (SSI)" chapter in https://www.ti.com/lit/pdf/swcu117 you see that the CS is part of the SPI bus. 

    Did you check the figure that shows the SPI transfer for spiParams.frameFormat = SPI_POL0_PHA1; ?

    If you don't have a dedicated pin for CS you can use a GPIO where you set this to comply with the CS signal requirements shown for the SPI mode you are using. 

    From the TRM: "For Motorola SPI and MICROWIRE frame formats, the serial frame (SSIn_FSS) pin is active low and is asserted (pulled down) during the entire transmission of the frame."

  • OK, NOW WORK WHIT CS PIN. i read in someplace that if use slave mode for recieve form master have a bug whit first bit not?

  • See the "Slave Mode Can Sample New TX Data From SYSBUS Clock Domain Using SSPCLK With No Synchronization" in the CC1310 errata (https://www.ti.com/lit/pdf/swrz062