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.

Problem with SPI, DMA and interrupts

Other Parts Discussed in Thread: CC3200

Hello,

I have a question closely related to my last two questions:
e2e.ti.com/.../1404676
e2e.ti.com/.../1406834

I try to transfer two uint8_t buffers from one CC3200 to another (both are Rev 4.1) via SPI and DMA.
The normal SPI transfer works fine, but is too slow - thus I want to improve it with DMA. I read the past threads on SPI and DMA:
e2e.ti.com/.../353790
e2e.ti.com/.../381940

and tried to follow the code given there as closely as possible.

My problem is, that I will receive an (possible) infinite number of SPI_INT_DMATX interrupts. The output on the slave side looks like this:
Enabled SPI Interface in Slave Mode!
Starting while...
Count: 1
 SPI_INT_DMATX
Count: 2
 SPI_INT_DMATX
Count: 3
 SPI_INT_DMATX
...

(without the printf's it will also loop forever).

For reference here is my code:
slave.c (similar to the main.c given in the thread mentioned above):
http://pastebin.com/imbPFGuC

master.c (no DMA, this one works fine with non-DMA SPI code):
http://pastebin.com/aJ0fsjz2

common.h:
http://pastebin.com/mKUmcWvU

common.c:
http://pastebin.com/tYdbcynk

pinmux.{c|h} are just like in the SDK examples.

On the boards the following jumpers are set:
J2,J3,J4,J6,J7,J8,J9,J10,J11,J12,J13

The pins are connected with short 10cm wires and the transfer works fine when a DMA-less slave.c is used.

Does anyone maybe have any idea where the problem might be?

Thank you for your time,
Severin



  • Hello,

    I want to configure an SPI connection between two CC3200 boards. Currently the master uses a normal SPI setup, while the slave should use DMA. I plan on changing the master to DMA as soon as I have it working on the slave. My current setup, only works for one transfer. So I can transfer data from the master to the slave and at the same time read data from the slave (although the first byte is missing). However, SPI_INT_DMATX and SPI_INT_DMARX seem to never be triggered and consecutive transfers only yield the last byte of the slave over and over again. I attached the master and slave files.

    Here is a sample out put:

    Master:

    Start the slave and press any key to transmit data....
    Filling Tx Buffer
    Sum in the Tx Buffer is: 0
    Checksum in the Tx Buffer is: 0x655e
    Filled Tx Buffer
    Sending...The sum in the Rx buffer is: 1395, tx was : 0
    Checksum in the Rx buffer is: 0x5d6e
    TX-Buffer:
    /33/34/35/36/37/38/39/3a/3b/3c/3d/3e/3f/40/41/42/
    Last: 66
    RX-Buffer:
    /0/56/57/58/59/5a/5b/5c/5d/5e/5f/60/61/62/63/64/
    Last: 100                                                                       
    Press any key to transmit again                                                 
    Sending...The sum in the Rx buffer is: 1600, tx was : 0                         
    Checksum in the Rx buffer is: 0x60cc                                            
    TX-Buffer:                                                                      
    /0/1/2/3/4/5/6/7/8/9/a/b/c/d/e/f/                                               
    Last: 15                                                                        
    RX-Buffer:                                                                      
    /64/64/64/64/64/64/64/64/64/64/64/64/64/64/64/64/   

    Slave:

    TX-Buffer:                                                                      
    /55/56/57/58/59/5a/5b/5c/5d/5e/5f/60/61/62/63/64/                               
    Last: 100                                                                       
    RX-Buffer:                                                                      
    /33/34/35/36/37/38/39/3a/3b/3c/3d/3e/3f/40/41/42/                               
    Last: 66                                                                        
    interrupt: 0                                                                    
    The sum in the Rx buffer is: 936                                                
    TX-Buffer:                                                                      
    /55/56/57/58/59/5a/5b/5c/5d/5e/5f/60/61/62/63/64/                               
    Last: 100                                                                       
    RX-Buffer:                                                                      
    /33/34/35/36/37/38/39/3a/3b/3c/3d/3e/3f/40/41/42/                               
    Last: 66                                                                        
    interrupt: 0

    Here is the relevant part of how I set up DMA/SPI on my slave:

        MAP_SPIReset(GSPI_BASE);
        // DMA
        // setup
        //-----------
        //This block is UDMAInit()
        
        MAP_PRCMPeripheralClkEnable(PRCM_UDMA,PRCM_RUN_MODE_CLK);
        MAP_PRCMPeripheralReset(PRCM_UDMA);
        MAP_uDMAIntRegister(UDMA_INT_ERR, dma_error_handler);
        MAP_uDMAEnable();
        memset(dma_control_table,0,sizeof(tDMAControlTable)*CTL_TBL_SIZE);
        MAP_uDMAControlBaseSet(dma_control_table);      
        for(uint32_t i = 0; i < MAX_NUM_CH; i++)
        {
            dma_callback_handler[i] = NULL;
        }
        //UDMAInit();
        //-----------
        MAP_SPIConfigSetExpClk(GSPI_BASE,MAP_PRCMPeripheralClockGet(PRCM_GSPI),
                         SPI_IF_BIT_RATE,SPI_MODE_SLAVE,SPI_SUB_MODE_0,
                         (SPI_HW_CTRL_CS |
                         SPI_4PIN_MODE |
                         SPI_TURBO_OFF |
                         SPI_CS_ACTIVEHIGH |
                         SPI_WL_8));    
        MAP_SPIIntRegister(GSPI_BASE,interrupt_handler);
        // same calls as SetupTransfer
        // channel  
        // RX
        MAP_uDMAChannelControlSet(UDMA_CH30_GSPI_RX,UDMA_SIZE_8 |  
                                                    UDMA_SRC_INC_NONE |  
                                                    UDMA_DST_INC_8 |
                                                    UDMA_ARB_1);
        MAP_uDMAChannelAttributeEnable(UDMA_CH30_GSPI_RX,UDMA_ATTR_USEBURST);
        MAP_uDMAChannelTransferSet(UDMA_CH30_GSPI_RX,UDMA_MODE_BASIC,
                                    (void *)(GSPI_BASE + MCSPI_O_RX0),
                                    (void *) &rx_buffer,
                                    TR_BUFF_SIZE);
        MAP_uDMAChannelEnable(UDMA_CH30_GSPI_RX);
        // TX
        MAP_uDMAChannelControlSet(UDMA_CH31_GSPI_TX,UDMA_SIZE_8 |  
                                                    UDMA_SRC_INC_8 |  
                                                    UDMA_DST_INC_NONE |
                                                    UDMA_ARB_1);
        MAP_uDMAChannelAttributeEnable(UDMA_CH31_GSPI_TX,UDMA_ATTR_USEBURST);
        MAP_uDMAChannelTransferSet(UDMA_CH31_GSPI_TX,UDMA_MODE_BASIC,
                                    (void *)&tx_buffer,
                                    (void *)(GSPI_BASE + MCSPI_O_TX0),
                                    TR_BUFF_SIZE );
        MAP_uDMAChannelEnable(UDMA_CH31_GSPI_TX);
     
        //--------------
     
        SPIDmaEnable(GSPI_BASE,SPI_RX_DMA|SPI_TX_DMA);
        MAP_SPIIntEnable(GSPI_BASE,SPI_INT_DMATX | SPI_INT_DMARX );
        MAP_SPIEnable(GSPI_BASE);

    If you have any idea why interrupt_handler is never called, I am grateful for any help :)

    Thank you for your time,

    Severin

    master.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    #include "common.h"
    static uint8_t tx_buffer[TR_BUFF_SIZE];
    static uint8_t rx_buffer[TR_BUFF_SIZE];
    int main()
    {
    uint32_t rx_sum = 0;
    uint32_t tx_sum = 0;
    uint8_t tmp;
    init();
    // initialize buffers with some known value
    memset(tx_buffer,0x33,sizeof(tx_buffer));
    memset(rx_buffer,0x44,sizeof(rx_buffer));
    for(int i = 0; i < TR_BUFF_SIZE; i++)
    {
    tx_buffer[i] = 0x33 + i;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    slave.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    // Standard includes
    #include <string.h>
    #include <stdint.h>
    // Driverlib includes
    #include "hw_types.h"
    #include "hw_memmap.h"
    #include "hw_common_reg.h"
    #include "hw_ints.h"
    #include "spi.h"
    #include "rom.h"
    #include "rom_map.h"
    #include "utils.h"
    #include "prcm.h"
    #include "uart.h"
    #include "interrupt.h"
    //for CRC
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi Severin,

    There is a similar thread on CC3200 SPI + DMA : http://e2e.ti.com/support/wireless_connectivity/f/968/t/353790

    Pls check it out and let me know if that helps.

    Thanks and Regards,

    Praveen

  • Hello Praveen,

    sorry I forgot to mention that I read the thread you mentioned (and your main.c example) as well as http://e2e.ti.com/support/wireless_connectivity/f/968/p/381940/1347971. . To my eyes my code to setup SPI and DMA is exactly like your main.c. And the code sort of works: I can complete one SPI DMA transfer, however the interrupt are never called.

    Thank you and best regards,

    Severin

  • Hi Severin,

    Let me check your code in that case, will get back to you.

    Thanks and Regards,
    Praveen
  • > Let me check your code in that case, will get back to you.

    Thank you so much for all your help!
  • I am not sure if it helps to narrow down the problem, but if I disable the interrupt in the interrupt_handler by calling SPIIntDisable(GSPI_BASE, SPI_INT_DMATX ) I can at least complete one transfer:
    if(status & SPI_INT_DMATX)
    {
    Message(" SPI_INT_DMATX\n\r");
    MAP_SPIIntClear(GSPI_BASE,SPI_INT_DMATX);
    SPIIntDisable(GSPI_BASE, SPI_INT_DMATX );
    return;
    }
    if(status & SPI_INT_DMARX)
    {
    Message("SPI_INT_DMARX \n\r");
    MAP_SPIIntClear(GSPI_BASE,SPI_INT_DMARX);
    SPIIntDisable(GSPI_BASE, SPI_INT_DMARX );
    return;
    }

    Further transfers are of course not possible. I do not understand why MAP_SPIIntClear will not clear the interrupt (or why the interrupt is raised again).
  • Another small update:
    If I change slave.c to completely reset SPI and DMA after each transfer (see: http://pastebin.com/1dqY2iv6 ) it works for a 32 element buffer. If I increase the buffer size to 32000 elements, I again end up in an infinite loop.

    It feels like I do not correctly clear the interrupt. However, I am at a loss of where exactly the problem is.
  • Just to add some more strange behaviour: The slave.c mentioned above (http://pastebin.com/1dqY2iv6) works with buffer sizes up to 1024. It even works with SPI speeds up to 20MHz. However, as soon as the buffer size is set to 1025 (or bigger) I again get an endless number of interrupts....
  • Hi Severin,


    Assuming you are using FIFO, whenever the FIFO reaches its configured threshold value it generates the DMA request and If the DMA has nothing to transfer it will simply generate the DMA done interrupt, but at the FIFO it is yet to be serviced.

    Now the system is in a state where FIFO is continuously generating DMA request and DMA (which has nothing to transfer) is continuously generating interrupt.

    MAP_SPIIntClear() is clearing the interrupt but its getting set again.

    You can mask the DMA request from FIFO by invoking MAP_SPIDmaDisable() whenever you don't have any thing to transfer.

    Same is the case with non FIFO mode also, where the configuration can be see as FIFO on depth equal to 1 SPI word

    I can't access the above links my work place, please attach it to this thread itself.

    To attach a file refer : e2e.ti.com/.../148.4-5-attaching-a-file

    Thanks and Regards,
    Praveen
  • Hello Praveen,

    thank you for your reply. I did not know, that you could not access the files on pastebin, I will add them to this post. I was not using FIFO at this point, because I first wanted to get SPI with DMA working.

    Cheers

    Severin

    5657.slave.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    #include "common.h"
    #include "udma.h"
    #include "udma_if.h"
    #include "hw_mcspi.h"
    #define TIMER_TICK 5000000
    static uint32_t interrupt_count;
    static uint8_t tx_buffer[TR_BUFF_SIZE];
    static uint8_t rx_buffer[TR_BUFF_SIZE];
    static void interrupt_handler()
    {
    uint32_t status = MAP_SPIIntStatus(GSPI_BASE,true);
    interrupt_count++;
    Report("Count: %d\n\r",interrupt_count);
    if(interrupt_count > 100)
    {
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
       
    8371.master.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    #include "common.h"
    static uint8_t tx_buffer[TR_BUFF_SIZE];
    static uint8_t rx_buffer[TR_BUFF_SIZE];
    int main()
    {
    uint32_t rx_sum = 0;
    uint32_t tx_sum = 0;
    uint8_t tmp;
    uint32_t tx_crc = 0;
    uint32_t tx_crc_old = 0;
    uint32_t a = 364;
    uint32_t b = 53457;
    uint32_t c = 976;
    uint32_t d = 66;
    init();
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
              
    common.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    #include "common.h"
    /* variables used for xorshift128 */
    static uint32_t x = 5;
    static uint32_t y = 8;
    static uint32_t z = 32;
    static uint32_t w = 8978;
    void init()
    {
    MAP_IntMasterEnable();
    MAP_IntEnable(FAULT_SYSTICK);
    PRCMCC3200MCUInit();
    PinMuxConfig();
    // for CRC
    MAP_PRCMPeripheralClkEnable(PRCM_DTHE, PRCM_RUN_MODE_CLK);
    MAP_PRCMPeripheralClkEnable(PRCM_GSPI,PRCM_RUN_MODE_CLK);
    InitTerm();
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
           common.h    

                       

    orig_slave.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    #include "common.h"
    #include "udma.h"
    #include "udma_if.h"
    #include "hw_mcspi.h"
    #define TIMER_TICK 5000000
    static uint32_t interrupt_count;
    static uint8_t tx_buffer[TR_BUFF_SIZE];
    static uint8_t rx_buffer[TR_BUFF_SIZE];
    static void interrupt_handler()
    {
    uint32_t status = MAP_SPIIntStatus(GSPI_BASE,true);
    interrupt_count++;
    Report("Count: %d\n\r",interrupt_count);
    if(interrupt_count > 100)
    {
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
         

  • Thanks Severin,

    Will check and get back to you.

    Regards,
    Praveen
  • Hello Praveen,

    I tried to understand your post, but cannot really make sense of it. Here is how SPI works in my mind:
    1) The master enables Chip Select and Clock
    2) It will then send the first byte (or whatever the word size is) over the MOSI line
    3) Simultaniously the slave will send its first byte over the MISO line
    4) The master disables CS and CLK

    In software the master looks like this:
    1) Move one byte from a buffer to to SPI_TX register
    2) Read one byte from th SPI_RX register and store it in a buffer
    3) Repeat this for all bytes

    The slave would work the same.

    Now I am not sure how I should expect the slave with DMA to work. In my mind it works like this:
    1) When the slave receives CS and CLK it will:
    2) Move data from the SPI_RX register to a buffer (and always increase the adress as set by UDMA_DST_INC)
    3) After each RX, copy data from a buffer into the SPI_TX register
    4) After N (the third parameter of SetupTransfer) of such transfers, it will issue a
    SPI_RX_DMA or SPI_TX_DMA interrupt (In my mind RX first, because RX is master driven).
    5) After this interrupt CS and CLK are no longer set and DMa lays dormant until the slaves receives CS and CLK again.

    Is there an error in my mental model?

    Thank you,
    Severin
  • Hi Severin,

    You are right.

    Adding one more point after N transfers the DMA has nothing to transfer but the TX SPI register is now in empty condition, this would generate again a transfer request to DMA (SPI has no way identifying DMA has completed the transfer). The DMA would respond to this by generating SPI_TX_DMA interrupt.

    The transfer request from SPI will stay until the TX register is provided with next data.

    Just to test this, you can do a CPU write to the TX register when you receive the first unexpected SPI_TX_DMA interrupt and then clear the interrupt.

    if you know the exact number of transfers required at the slave, you could also set the SPI word count using SPIWordCountSet() API. This would tell the SPI how much data it should expect and not generate extra transfer requests. This feature is only available when FIFO is enabled.

    Thanks and Regards,
    Praveen
  • Dear Praveen,

    thank you for your reply. I will be able to test this on Monday and will get back to you!

    Cheers,
    Severin
  • Dear Praveen,

    I tried to implement FIFO (see attached file), but still have these runaway interrupts. I get one 'working' transfer in which the master gets data from the slave (I cannot verify the slave side, because it gets stuck in the interrupt loop).

    However, after this one transfer I receive endless numbers of SPI_INT_DMARX interrupts (Not TX anymore!) .

    I also experimented with manually calling SPIDataPut/Get in the interrupt handler, but this did not really solve my problem. I could however get rid of the interrupt flood in some cases. 

    Do you maybe know of any SPI/DMA examples or projects out there?

    Thank you and kind regards,

    Severin

    1563.slave.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    #include "common.h"
    #include "udma.h"
    #include "udma_if.h"
    #include "hw_mcspi.h"
    #define TIMER_TICK 5000000
    static uint32_t interrupt_count;
    static uint8_t tx_buffer[TR_BUFF_SIZE];
    static uint8_t rx_buffer[TR_BUFF_SIZE];
    static void interrupt_handler()
    {
    uint32_t status = MAP_SPIIntStatus(GSPI_BASE,true);
    uint32_t tmp = 0;
    interrupt_count++;
    // Report("Count: %d\n\r",interrupt_count);
    if(interrupt_count > 100)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Dear Praveen,

    here is some example output. When I use slave.c as given above output will look like this:
    EOW
    SPI_INT_DMATX
    SPI_INT_DMARX
    SPI_INT_DMARX
    (SPI_INT_DMARX repeated ad infinitum)

    If I add SPIDataGet(GSPI_BASE,&tmp); to the SPI_INT_DMARX interrupt handler part the output is no longer infinite, but still strange:

    EOW
    SPI_INT_DMATX
    SPI_INT_DMARX 2
    SPI_INT_DMARX 5
    ...
    SPI_INT_DMARX 38

    (why 38 interrupts when my buffer is only of size 64?)

    And gets stranger still: When I initiate another transfer at the master, interrupt_count is absurdly high:
    SPI_INT_DMARX 59642849
    SPI_INT_DMARX 59642850
    ...
    SPI_INT_DMARX 59642882

    When starting another transfer:
    SPI_INT_DMARX 97171869
    SPI_INT_DMARX 9717187
    ...
    SPI_INT_DMARX 97171902


    So it is always 33 interrupts for 64 SPI words. However.. I cannot explain why (and how) interrupt_count is incremented.

    Cheers,
    Severin

    PS: Here is the modified slave.c:

    6433.slave.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    #include "common.h"
    #include "udma.h"
    #include "udma_if.h"
    #include "hw_mcspi.h"
    #define TIMER_TICK 5000000
    static uint32_t interrupt_count;
    static uint8_t tx_buffer[TR_BUFF_SIZE];
    static uint8_t rx_buffer[TR_BUFF_SIZE];
    static void interrupt_handler()
    {
    uint32_t status = MAP_SPIIntStatus(GSPI_BASE,true);
    uint32_t tmp = 0;
    interrupt_count++;
    // Report("Count: %d\n\r",interrupt_count);
    if(interrupt_count > 100)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi Severin,

    Thanks for trying out.

    I don't have a SPI Slave DMA example to point to. Please give me some time to go through your code , will get back to you.

    Thanks and Regards,
    Praveen
  • Dear Praveen,

    thank you. I was experimenting a bit more with FIFO and now I seem to be able to get I correct SPI/DMA request. The problem is, that no follow-up interrupts are raised.

    I attached you my latest slave.c

    Thank you so much for your time and help!

    Cheers,

    Severin

    7331.slave.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    #include "common.h"
    #include "udma.h"
    #include "udma_if.h"
    #include "hw_mcspi.h"
    #define TIMER_TICK 5000000
    static uint32_t interrupt_count;
    static uint8_t tx_buffer[TR_BUFF_SIZE];
    static uint8_t rx_buffer[TR_BUFF_SIZE];
    static void interrupt_handler()
    {
    uint32_t status = MAP_SPIIntStatus(GSPI_BASE,true);
    MAP_SPIIntClear(GSPI_BASE,SPI_INT_DMARX | SPI_INT_DMATX | SPI_INT_EOW);
    uint32_t tmp = 0;
    interrupt_count++;
    // Report("Count: %d\n\r",interrupt_count);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Here is another observation:

    Attached code will again restart SPI/DMA after a successful transfer. This works up to buffer sizes of 1024. As soon as the buffer size becomes 1025 or greater, the transfer will not longer work The slave will no longer receive any data from the master.

    Here is again the tested slave.c:

    1200.slave.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    #include "common.h"
    #include "udma.h"
    #include "udma_if.h"
    #include "hw_mcspi.h"
    #define TIMER_TICK 5000000
    static uint32_t interrupt_count;
    static uint8_t tx_buffer[TR_BUFF_SIZE];
    static uint8_t rx_buffer[TR_BUFF_SIZE];
    static void interrupt_handler()
    {
    uint32_t status = MAP_SPIIntStatus(GSPI_BASE,true);
    MAP_SPIIntClear(GSPI_BASE,SPI_INT_DMARX | SPI_INT_DMATX | SPI_INT_EOW);
    uint32_t tmp = 0;
    interrupt_count++;
    // Report("Count: %d\n\r",interrupt_count);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hello Praveen,


    today I tried to tackle the problem from the other side and use SPI/DMA on the master side. Again I run into the limit of 1024 bytes. Attached code works perfectly fine for buffers up to 1024 bytes, and breaks as soon as the buffer size is greater than that.


    Do you know why this is so, if that can be changed and if not, how to work around that issue?

    Thank you for all your help,

    Severin

    3252.master.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    #include "common.h"
    #include "udma.h"
    #include "udma_if.h"
    #include "hw_mcspi.h"
    static uint8_t tx_buffer[TR_BUFF_SIZE];
    static uint8_t rx_buffer[TR_BUFF_SIZE];
    int transfer_complete = 0;
    static void interrupt_handler()
    {
    uint32_t status = MAP_SPIIntStatus(GSPI_BASE,true);
    MAP_SPIIntClear(GSPI_BASE,SPI_INT_EOW);
    Message("Transfer complete!\n\r");
    SPICSDisable(GSPI_BASE);
    transfer_complete = 1;
    }
    void setup()
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi Severin,

    Are you trying to configure DMA with more than 1024 items, this will not work.

    Max number of items the DMA can transfer in one configuration is 1024. If you have more that 1024 items then you will have to split it into blocks of 1024 items.

    Thanks and Regards,
    Praveen
  • Dear Praveen,

    ah yes... I guess this was the root cause of many of my problems. Thank you. I will take a step back and re-design my SPI/DMA implementation.

    Just one suggestion (in general, not sure where to direct it to):
    Would it be possible to simple give an error if one tries to create DMA transfers for more than 1024 items? And if not, would it be possible to at least add these limits to the driverlib/spi.c and udma.c documentation/comments?
    For example the documentation for uDMAChannelTransferSet (used by SetupTransfer) only states: "ulTransferSize is the number of data items to transfer". There is no indication of any limitation. This limit can only be found in SWRU367B (www.ti.com/.../swru367) on page 97.

    Thank you very much for your time and help!
    Severin
  • hello.can u me a demo of CC3200 spi dma ,let me test .i have tested the :cc3200_dma_spi_example-master20160803.zip no OK.can u help me ?tks