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.

CC3220SF: How many bytes of data can be received as a SPI slave?

Part Number: CC3220SF

Hi team,

Here's an issue from the customer may need your help:

https://dev.ti.com/tirex/content/simplelink_cc32xx_sdk_6_10_00_05/docs/drivers/doxygen/html/_s_p_i_c_c32_x_x_d_m_a_8h.html

Regarding the example on the doc above, the customer has following 2 questions:

1) How many bytes of data does this program actually want to transfer, 2000 bytes or?

2) What is the relationship between the three txBuff and the two rxBuff? TxBuff1\2\3 each point to a separate memory?
Or txBuff1/txbuff2 are both the beginning of a section of memory, and txbuff3 is the middle of this section of memory?

Could you help check this case? Thanks.

Best Regards,

Cherry

  • Howdy Cherry,

    I am going to be answering the following questions from this code. Just to make sure were on the same page.

    // SPI already opened in callback mode
    SPI_Transaction t0, t1, t2;
    t0.txBuf = txBuff0;
    t0.rxBuf = rxBuff0;
    t0.count = 2000;
    t1.txBuf = txBuff1;
    t1.rxBuf = rxBuff1;
    t1.count = 1000;
    t2.txBuf = txBuff2;
    t2.rxBuf = NULL;
    t2.count = 1000;
    bool transferOk = false;
    if (SPI_transfer(spiHandle, &t0)) {
        if (SPI_transfer(spiHandle, &t1)) {
                transferOk = SPI_transfer(spiHandle, &t2);
            }
        }
    }

    In this code 3 instances of the struct SPI_Transactions are created t0, t1, and t2. Each struct has the following variables. Link

    size_t 	count
     
    void * 	txBuf
     
    void * 	rxBuf
     
    void * 	arg
     
    SPI_Status 	status
     
    void * 	nextPtr

    1.)  t0.count is set to 2000. This means that SPI_Transfer(spiHandle, &t0) will not return a 1 or complete until 2000 frames were transferred. The amount of bytes transferred ultimately depend on the Frame size of the buffer so 8, 16, or 32 bit. 

    2.) txBuff1, 2 ,3 are all separate buffers in their own place in memory which have been assigned to each respective tx.buff variable.

    I hope this helps,

    Rogelio

  • Hi Rogelio,

    Thanks for your support.

    1) How many bytes of data does this program actually want to transfer, 2000 bytes or?

    For example, the SPI frame size is set to 8 bits, which is 1 byte. So how many bytes or frames does this program send? 

    Also, the count value of the first instance of SPI_Transactions, t0, is set to 2000 and has exceeded 1024 bytes. Will it still work? 

    Thanks and regards,

    Cherry

  • Hi Cherry,

    Yes it will still work due to the DMA working in ping pong mode.

    For example, the SPI frame size is set to 8 bits, which is 1 byte. So how many bytes or frames does this program send? 

    Well 4000 bytes in a queue fashion. The first 2000 will be from the Spi Transaction T0, 1000 from T1, and another 1000 from T2.

    Kind Regards,

    Rogelio