Hot!dsPIC33 DMA SPI problem

Author
MateuszPaczynski
New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2018/06/05 07:31:27
  • Location: 0
  • Status: offline
2018/06/06 02:05:18 (permalink)
0

dsPIC33 DMA SPI problem

Dear All,
 
I tried to implement a simple program to learn how to use a DMA feature. I planned to send data to DMA, and I hoped that DMA will automatically send data to the SPI buffer. 
Firstly, I have checked an SPI functionality. It was sending data to the sensor as I wanted. After that, I tried to add a DMA functionality. Unfortunately, I failed and I didn't manage to send any data.
 
I am working a dsPIC33EP128EP204 processor. Configuration was generated with MCC help. Please find my code (full code in attachments) :
 
int main(void)
{
SYSTEM_Initialize();

// Enable the Global Interrupts
INTERRUPT_GlobalEnable();

DMA_PeripheralAddressSet(0,&SPI1BUF);
DMA_PeripheralIrqNumberSet(0,10);
DMA_TransferCountSet(0,1);
DMA_ChannelEnable(0);

/*
DMA0REQbits.FORCE=1;
while (DMA0REQbits.FORCE == 1);
IEC0bits.SPI1IE = 1;
*/

DMA_SoftwareTriggerEnable(0);
DMA_FlagInterruptClear(0);

while (1)
{
//SPI1_Exchange16bit(0xAAaa);
// Add your application code
}

return 0;
}
 
I will be grateful for any help.
Sincerely xyz
#1

2 Replies Related Threads

    RISC
    Super Member
    • Total Posts : 5241
    • Reward points : 0
    • Status: offline
    Re: dsPIC33 DMA SPI problem 2018/06/10 15:20:52 (permalink)
    0
    Hi,
    Please find herewith the code example CE416 for SPI with DMA on dsPIC33EP
    Regards
    #2
    pr.mchp
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2015/03/23 06:20:48
    • Location: 0
    • Status: offline
    Re: dsPIC33 DMA SPI problem 2018/07/12 03:18:14 (permalink)
    0
    Hi
    SPI in MCC is supported for Enhanced mode of Operation only.
    In case of DMA functionality, SPI should be in standard mode only.(Refer FRM for more information).
     
    Thanks
    MCC Team
     
     
     
    #3
    Jump to:
    © 2018 APG vNext Commercial Version 4.5