View previous topic :: View next topic |
Author |
Message |
Ttelmah
Joined: 11 Mar 2010 Posts: 19195
|
|
Posted: Sun Apr 15, 2018 11:48 pm |
|
|
OK. You move forward.
The DMA needs to be set to increment the source buffer address. Otherwise it transfers from a single address to a single address. |
|
|
curt2go
Joined: 21 Nov 2003 Posts: 200
|
|
Posted: Mon Apr 16, 2018 8:38 am |
|
|
I was sure I had that set. I will check.
Thank you again all for your help. This has been a crazy one for me. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19195
|
|
Posted: Mon Apr 16, 2018 1:46 pm |
|
|
What you posted as your example, did not have the increment enabled.
As a comment one big problem is not handling the SPI receive. Problem is that unless you do the overrun error flag will become set. When this happens the peripheral will stop operating.... |
|
|
curt2go
Joined: 21 Nov 2003 Posts: 200
|
|
Posted: Mon Apr 16, 2018 2:17 pm |
|
|
Thank you. I will check tonight. I thought I looked at the flags and seen it was set. I also thought the CCS code sets it unless you tell it not to set #define DMA_NO_INC 0x10 . But then again I made a lot of assumptions lately that have gotten me nowhere.
But i'm sure you are right. I don't think i've seen an instance of where you were wrong yet.
EDIT: Yes I do not have it in continuous mode, I did so many back and forth stuff over the last few days. I will set that and hopefully be off to the races.
And I did use another DMA on the receive side. Even though i don't need it. It will keep the buffer clean.
Thank you again. |
|
|
curt2go
Joined: 21 Nov 2003 Posts: 200
|
|
Posted: Mon Apr 16, 2018 5:44 pm |
|
|
Its clocking out way too fast ? The DMA does not seem to be stopping it just shoves as fast as it can ?
Code: |
setup_dma(0, DMA_OUT_SPI1, DMA_WORD); //could be DMA_BYTE
setup_dma(1, DMA_IN_SPI1, DMA_WORD); //could be DMA_BYTE
enable_interrupts(INT_DMA0);
dma_start(0,DMA_PING_PONG|DMA_CONTINOUS,playBufferAddress,fillBufferAddress,127);
dma_start(1,DMA_CONTINOUS|DMA_PING_PONG,DMAIncomming,DMAIncomming2,127);
enable_interrupts(INT_DMA1);
|
playBuffer and fillbuffer are 256 byte buffers. I am filling each opposite one everytime into the DMA int. Let me know if you have any thoughts. Again I am in SLAVE mode using frame sync. The timing works fine if i manually watch the buffer and shove data in when it's empty using SPI1BUFF. |
|
|
curt2go
Joined: 21 Nov 2003 Posts: 200
|
|
Posted: Mon Apr 16, 2018 5:55 pm |
|
|
I had my FORCE inside my loop. That is what was going on. But now the DMA is not firing again!
LOL.. It just gets better and better. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19195
|
|
Posted: Tue Apr 17, 2018 11:04 am |
|
|
If you only want to do a block and stop, then don't use continuous. Trigger the DMA, and you get the DMA interrupt when the block has been transferred. |
|
|
curt2go
Joined: 21 Nov 2003 Posts: 200
|
|
Posted: Tue Apr 17, 2018 1:58 pm |
|
|
I have found the very root of all the issues. If I would have done this from the start it probably would have only been a few hours of fooling around.
Late last night I decided to try something. Instead of using CCS to set up the SPI I decided to do it manually. Once I set it up i decided to enable the SPI after I set up the DMA and enabled them. Well guess what. Everything works as predicted now. I get interrupts when I should , I get transfers starting properly and running properly after.
I will post some code later. |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1910 Location: Norman, OK
|
|
Posted: Tue Apr 17, 2018 4:16 pm |
|
|
You might also pass this on the CCS folks.
They may have some code bug issues. _________________ Google and Forum Search are some of your best tools!!!! |
|
|
|