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.

TMS320C6748: SPI callback mode is not working after interrupt configuration

Part Number: TMS320C6748
Other Parts Discussed in Thread: OMAPL138

Hello,

I am working on SPI  1 in "pdk_omapl138_1_0_3". I am using LCDKC6748 board. I initialize SPI  as below

void MCSPICallbackFxn(SPI_Handle handle, SPI_Transaction * transaction)
{
    txCompleteCallbackFlag = 0;
}

static void SetUpSPI(void)
{
     SPI_v0_HWAttrs spi_cfg;
     SPI_init();
     GPIO_init();

     /* Get the default UART init configurations */
    SPI_socGetInitCfg(TEST_SPI_PORT, &spi_cfg);

     spi_cfg.enableIntr = false ;
     spi_cfg.csNum =1;
     spi_cfg.inputClkFreq = 456000000;
     spi_cfg.pinMode=SPI_PINMODE_3_PIN;
     SPI_socSetInitCfg(TEST_SPI_PORT, &spi_cfg);

     /* Open the Board flash NOR device with the test SPI port
        and use the default SPI configurations */

     SPI_Params_init(&spiParams);

     spiParams.frameFormat  = SPI_POL0_PHA1;
     spiParams.mode=SPI_MASTER;
     spiParams.dataSize =8;
     spiParams.bitRate=8000000;

      spiParams.transferMode = SPI_MODE_CALLBACK;
      spiParams.transferCallbackFxn = MCSPICallbackFxn ;
     

      hwHandle = (SPI_Handle)SPI_open(TEST_SPI_PORT, &spiParams);//TEST_SPI_PORT

     if (!hwHandle)
     {
         testPassed = false;
 
     }

     //Enable transfer
    xferEnable = 1;
    SPI_control(hwHandle, SPI_V0_CMD_XFER_ACTIVATE, (void *)&xferEnable);

    xferEnable =0;
    SPI_control(hwHandle, SPI_V0_CMD_DELAY, (void *)&xferEnable);
}

I am calling the below function from my stacktest() task which is the main task, And I found it working fine when I check the SPI_Transaction object and found  "transaction.status = SPI_TRANSFER_COMPLETED"

void  mcp2515_reset(void)
{
 
    CS_HIGH;
    Delay(100);
    CS_LOW;
    Delay(100);


    txCompleteCallbackFlag =1U;
    tx_data[0]= MCP_RESET;
    len =1;
    transaction.txBuf =  &tx_data;
    transaction.rxBuf = &rx_data;
    transaction.count = len;
    transaction.arg = (void *)(hwHandle, &transaction);
    spiParams.dataSize =8;
  
     SPI_transfer(hwHandle, &transaction);
     while(txCompleteCallbackFlag == 1U);

    Delay(100);

    CS_HIGH;

    Delay(100);


}

when I call the same mcp2515_reset() function from my stacktest() task after configuring the interrupt as below, I found the SPI_transfer() is not working. when I check the SPI_Transaction object and found  "transaction.status = SPI_TRANSFER_STARTED"

I also tried to configure the interrupt before spi initialization but I got the same problem.

void configurGpioInterrupt()
{
   Intc_Init();
   Intc_SystemEnable();
    ExcGlobalEnable();
    //  GPIO interrupt for CAN interrupt
   Intc_IntRegister(C674X_MASK_INT4, CANIsr);
   IntEventMap(C674X_MASK_INT4,54);
   Intc_IntEnable(C674X_MASK_INT4);

    Intc_IntRegister(C674X_MASK_INT5, MRIsr);
    IntEventMap(C674X_MASK_INT5,62 );
    Intc_IntEnable(C674X_MASK_INT5);

    Intc_IntRegister(C674X_MASK_INT6, CANIsr2);
    IntEventMap(C674X_MASK_INT6,52 );
    Intc_IntEnable(C674X_MASK_INT6);

}

Kindly suggest me to work both interrupt and SPI callback function.

Note:

SPI blocking mode was working fine even after the interrupt configuration. But I need to configure the SPI in callback mode only.

Thanks & Regards

Navaneetha krishnan