Author Topic: LPC43XX DMA timer triggered transfers  (Read 1303 times)

0 Members and 1 Guest are viewing this topic.

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1905
  • Country: ca
LPC43XX DMA timer triggered transfers
« on: September 03, 2018, 01:11:24 pm »
Hi,
I have written this simple code, the Memory to memory DMA would work fine, but when I try to use a timer match to trigeer DMA transfers it would fail with this flag in DMA callback
Quote
GPDMA_EVENT_ERROR

Here is my sample code, Do you have any Idea what I'm missing?


Code: [Select]
void mySPI_callback(uint32_t event)
{
    switch (event)
    {
    case GPDMA_EVENT_TERMINAL_COUNT_REQUEST:
        /* Success: Wakeup Thread */
__breakpoint(0);  /* Error: Call debugger or replace with custom error handling */
        break;
    case GPDMA_EVENT_ERROR:
        /*  Occurs in slave mode when data is requested/sent by master
            but send/receive/transfer operation has not been started
            and indicates that data is lost. Occurs also in master mode
            when driver cannot transfer data fast enough. */
        __breakpoint(0);  /* Error: Call debugger or replace with custom error handling */
        break;
    }
}



int main(void)
{
    GPDMA_Initialize();
    uint16_t TXDummi[8]={0x1234,2,3,4,5,6};
    uint16_t RXDummi[8];
  //reset on match 0
LPC_TIMER3->MCR=0x00000002;
  //Toggle on match 0(initial states are hi)
LPC_TIMER3->EMR=0x00000031;
    //Match about 500ms since CPU clock is 180MHz
    LPC_TIMER3->MR0=90000000;
//Clear timer interrupts
LPC_TIMER3->IR=0xFF;
//enable timer
LPC_TIMER3->TCR=0x00000001;

    //Select TImer3 MR0 as DMA Request
GPDMA_PeripheralSelect (7, 0);

    //Configure Channel 1 of DMA
GPDMA_ChannelConfigure (0,
(uint32_t)LPC_TIMER3->TC,
(uint32_t)RXDummi,
256,//800 bytes
GPDMA_CH_CONTROL_SBSIZE(GPDMA_BSIZE_8)              |
GPDMA_CH_CONTROL_DBSIZE(GPDMA_BSIZE_1)              |
GPDMA_CH_CONTROL_SWIDTH(GPDMA_WIDTH_HALFWORD)       |
GPDMA_CH_CONTROL_DWIDTH(GPDMA_WIDTH_HALFWORD)       |
GPDMA_CH_CONTROL_S                                  |
GPDMA_CH_CONTROL_D                                  |
//GPDMA_CH_CONTROL_DI                                 |
GPDMA_CH_CONTROL_I,

GPDMA_CH_CONFIG_SRC_PERI(7)                        |
GPDMA_CH_CONFIG_FLOWCNTRL(GPDMA_TRANSFER_P2M_CTRL_PERI) |
GPDMA_CH_CONFIG_IE                                      |
GPDMA_CH_CONFIG_ITC                                     |
GPDMA_CH_CONFIG_E,

mySPI_callback);
                                                       
    while(1)
    {
    }
}



   
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline moffy

  • Super Contributor
  • ***
  • Posts: 1734
  • Country: au
Re: LPC43XX DMA timer triggered transfers
« Reply #1 on: January 23, 2020, 07:52:42 am »
For a transfer from a peripheral you have to specify AHB1. AHB0 cannot access peripherals.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf