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.

AM2634: SPI data reception interrupt on single byte

Part Number: AM2634

Tool/software:

 mcspi_loopback_dma_am263x-cc_r5fss0-0_nortos_ti-arm-clang.rar

Dear Team,

I want to use AM2634 in peripheral mode with DMA and currently using mcspi_loopback_dma example code for reference, for 8 byte this example working fine mean it's generate interrupt after getting configured received bytes, but  whenever  change to 8 to 1 its not receiving data any more mean I want interrupt on every single byte reception,

attached image shows that its giving two time(Yellow) interrupt while sender(Master) sends 8 bytes, Chip select (violet)

please suggest how to configure  SPI data reception interrupt on single byte in DMA  

  • Dear Team,

    your feedback most awaited 

  • Hi Rohal,

    Could you please let me know what is your dataSize.

  • data size is not fixed it may be 20 bytes or 50 bytes or any thing, but we can configure max buffer size is of 255 bytes.

  • Can you try with DataSize=8.

  • i tried that, it works if receiver set to 8 bytes and transmitter also send 8 bytes, but our requirement is different,

    Requirement -  AM2634 doesn't know how many data will send by sender, it might me 50, 100 or 200....

    that's why we choose interrupt on every byte and use of ideal timer to identify the end of communication, but its not working for every byte and stopped getting interrupt. 

    So please tell me how to handle this situation,

  • Rohal,

    The way driver is configured, you need to provide total number of bytes/count and data size. Please check arguments of

    MCSPI_transfer api in mcspi_v0.c file. On basis of this you will get interrupt. Let say your count is 128 bytes and data size as 1Bytes.

    1st way (without FIFO):  The total number of interrupt you will receive is 128/1bytes. i.e. on every transaction you will receive an interrupt.

    2nd way (with FIFO): Assume FIFO trigger level as 16, i.e after every 16 bytes, you will get an interrupt. So, in this case total number of interrupt is 128Bytes/16Bytes = 8.

  • how to disable fifo  because it's not allow to make it Zero

    #define APP_MCSPI_MSGSIZE (128U)

    MCSPI_Transaction_init(&spiTransaction);
    spiTransaction.channel = gConfigMcspi1ChCfg[0].chNum;
    spiTransaction.dataSize = 8U;
    spiTransaction.csDisable = TRUE;
    spiTransaction.count = 1;//APP_MCSPI_MSGSIZE / (spiTransaction.dataSize/8);
    spiTransaction.txBuf = NULL;
    spiTransaction.rxBuf = (void *)gMcspiRxBuffer;
    spiTransaction.args = NULL;
    startTimeInUSec = ClockP_getTimeUsec();
    for(j = 0U; j < APP_MCSPI_TRANSFER_LOOPCOUNT; j++)
    {
    transferOK = MCSPI_transfer(gMcspiHandle[CONFIG_MCSPI1], &spiTransaction);
    }

    is it correct configuration to receive interrupt on every byte?

  • Rohal,

    spiTransaction object configuration seems to be correct.

    By default, driver is using FIFO there is no way to disable it from GUI or from the application. If you still want, I can guide, you the process to disable it but you need to make changes in driver which I would suggest not to do.

  • Please guide in steps how to disable fifo in driver and let me check the behavior, if it fulfill my requirements then ok other wire i'll make it reverse  

  • Can you try commenting out MCSPI_setFifoConfig in MCSPI_lld_write and MCSPI_lld_read api If you are in polled mode. For Interrupt mode use  MCSPI_lld_readIntr and MCSPI_lld_writeIntr.