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.

CC3220S-LAUNCHXL: How to enable SPI DMA?

Part Number: CC3220S-LAUNCHXL
Other Parts Discussed in Thread: CC3200

Hi,

I am using CC3220S-LAUNCHXL for my project where I am trying to send the data through SPI also including DMA for less CPU overhead and faster speed. I have successfully send and received data through SPI using interrupt , but when I am using the same code including DMA I am facing an issue. I am getting stuck in the while loop in Hwi. I tried everything from my side but I could not figure out what is the issue.

And I also found that udma_if.c is not there in cc3220 sdk and I could see that in cc3200 sdk.

Can anyone help me please. 

/*
* ======== Hwi_excHandler ========
*/
Void Hwi_excHandler(UInt *excStack, UInt lr)
{
Hwi_module->excActive[0] = TRUE;

/* spin here if no exception handler is plugged */
while (Hwi_excHandlerFunc == NULL) {
;
}

Hwi_excHandlerFunc(excStack, lr);
}

  • Hi Nitin,

    If you are starting code development on the CC3220, it is highly recommended that you use TI drivers. This is a set of higher-level drivers that encompass all of the hardware peripherals on the CC3220 from the I2C to the SPI, and which removed much of the hard work in getting the DMA and driverlib register writing etc. that you used to have to do on the CC3200.

    For the SPI driver, the TI drivers actually already use DMA by default for efficient transfers. The spimaster example in the SDK goes over how you would use TI drivers for SPI. I suggest you look at that to get familiar with development with TI drivers.

    Let me know if you need further help. Are you porting an existing CC3200 project to the CC3220? If so, I advise you to port your driverlib to TI drivers as it will save you from a lot of headache in the future when trying to debug.

    Regards,
    Michael
  • Hi Michael,

    Thank you for your reply.

    Yes I was porting an existing cc3200 project.

    In my project I am trying to send the received  data which I got from SPI(as slave).I want to tag it with data I will receive from I2C connected to a sensor and finally I want to send it through UDP. UDP part working fine with SPI recieved data with cc3200 drivers.

    I tried to use SPI slave example of cc3220 given in ccs but it did not work.I had little bit understanding of cc3200 so I used its libraries and project I received correct data from SPI but when I included DMA I got stuck in while loop I mentioned before. I understood that was because I was trying to use wrong driver for cc3220 (udma_if.c) which was there in cc3200 I also found that in cc3220 new driver have been included SPICC32XXDMA. Can you help me with the approach I should take now with the above mentioned scenario?

    Regards,

    Nitin

  • Hi Nitin,

    Even if you are porting an existing CC3200 project, I highly recommend you move to TI drivers. If you still wanted to integrate DMA into the SPI driverlib you have, I would suggest you to look at the SPI driver implementation in SPICC32XXDMA.c. Looking at configDMA() and spiHwiFxn() will show you how to setup DMA transfer, and handle DMA transfer completion interrupts. However, it is much, much simpler to simply learn how to use the simpler APIs of TI drivers than it is to try to wrap your head around trying to get DMA functioning with peripherals.

    When you mention that the SPI slave example provided with the CC3220 SDK did not work, how exactly did it fail? I can help you through getting the SPI up and running properly in the SDK example if needed.

    Regards,
    Michael
  • Hi Michael,

    As suggested by you I used SPI slave example in my project it was working fine with SPI alone but the problem I am facing is when I am trying to receive continuous data , as it is getting stopped after receiving 768 bytes of data and going into the same hwi interrupt mentioned in my first question. I mean I have used SPI_transfer function in continuous loop at the same time I am transferring rx buffer data through UDP when ever it is getting filled. Can you help me with the issue please.

    Regards,

    Nitin

  • Hi Nitin,

    Do you still end up in the hwi if you do not use UDP to send the RX data?
    Also, you mention that you end up in the hwi after 768 bytes. Is this consistent? There shouldn't be a fundamental reason why the transfer stalls after 768 bytes. Of the bytes you do receive, if you check the RX buffer does it match the data that you send with the SPI master?

    Regards,
    Michael
  • Hi Michael,
    My continuity problem got resolved I was using SPI_MODE_BLOCKING earlier but now I am using SPI_MODE_CALLBACK. Now my issue is with the data I am receiving in the slave side cc3220 Rx buffer most of the time it is correct but some times it is getting shifted and reverse data for example:

    case 1 : Shifted data

    Original data to rx: 0x1514 = 0001 0101 0001 0100
    Received data : 0x2A28 = 0010 1010 0010 1000

    case 2: Reverse data

    Original data to rx: 0x1514 = 0001 0101 0001 0100
    Received data : 0x5141 = 0101 0001 0100 0001

    Case 3: Reverse of shifted data

    original data to rx: 0x1514 = 0001 0101 0001 0100
    Received data : 0xA282 = 0101 0010 1000 0010

    Can you help me resolving this?


    Regards,
    Nitin