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.

RTOS/AWR1642BOOST: SPI in slave mode with ISR

Part Number: AWR1642BOOST
Other Parts Discussed in Thread: AWR1642, SYSBIOS, MMWAVE-SDK

Tool/software: TI-RTOS

Hi.
I've been trying to configure the AWR1642 boost in SPI slave mode. I am able to configure it post pinmux and setting params, but when i perform SPI_Transfer(), the dss_main component fails.
I then came to realize that SPI_Transfer can't be recalled in a loop if the previous transfer did not take place correctly. Which led me to write a GPIO ISR to trigger SPI_Transfer when the master is ready to ask for data. I'm new to TI-RTOS and Sysbios, if i could get some pointers on how i can attach an interrupt to a GPIO. I'll be indebted. 

Thanks and regards, 
Rakshit

  • Hello Rakshit,

    You can refer to the GPIO driver test application that is available in MMWAVE-SDK "$mmwave-sdk\packages\ti\drivers\gpio\test\xwr16xx\" . In this example, "GPIO_1" is configured as an input pin with interrupt capability. The test application gives you a detailed step by step procedure to set pin as interrupt, register the handler etc.

    Hope this helps resolve your issue.

    -Raghu
  • Hi. 
    I managed to get SPI in blocking mode as a slave working, but I'm facing issues when I configure it to work in non-blocking mode. 
    What's happening is, SPI_Transfer in callback mode doesn't trigger the callback when transfer is completed, Neither is it receiving/transmitting data.

    I configure my DMA 

      DMA_Params_init(&dmaParams);
        gDmaHandle = DMA_open(0, &dmaParams, &errCode);
        if(gDmaHandle == NULL)
        {
            printf("Open DMA driver failed with error=%d\n", errCode);
            return;
        }

    and my SPI

    SPI_Params_init(&params);
        params.mode = SPI_SLAVE;
        params.dataSize = 8;
        params.dmaEnable = 1;
        params.dmaHandle = gDmaHandle;
        params.u.slaveParams.dmaCfg.txDmaChanNum =1U;
        params.u.slaveParams.dmaCfg.rxDmaChanNum =0U;
        params.frameFormat = SPI_POL0_PHA1;
        params.shiftFormat = SPI_MSB_FIRST;
        params.pinMode = SPI_PINMODE_4PIN_CS;
        params.transferMode = SPI_MODE_CALLBACK;
        params.eccEnable = 1;
        params.csHold = 1;
        params.transferCallbackFxn = spiCallback;
    

    My callback : 

    void spiCallback(SPI_Handle handle, SPI_Transaction *transaction)
    {
    
    
       if(transaction->status == SPI_TRANSFER_COMPLETED)
       {
           Semaphore_post(SPISem);
    
       }
    
     return;
    }

    void SPITask(UArg arg0, UArg arg1)
    {
    
        char *msg = "1abcdefghijklmnopqrstuvwxyzDONE2abcdefghijklmnopqrstuvwxyzDONE";
        char rx[63];
        System_printf("SPI Task Started \n");
        spiTransaction.count = (size_t)62;
        spiTransaction.txBuf = (void*) msg;
        spiTransaction.rxBuf = (void * )rx;
        spiTransaction.arg = NULL;
        spiTransaction.slaveIndex = 0U;
        while(1){
            Semaphore_pend(SPISem, BIOS_WAIT_FOREVER);
            System_printf("Transfer now\n");
            SPI_transfer(handle, &spiTransaction);
        }
    }






    Also, in blocking mode, when the transfer frame is long (size > 50) the SPI_transfer() call doesn't block.

    Thanks 

  • Hi Raghunandan,
    Continuing from the other thread, what could the problem be ?