infineon4engineers Facebook

infineon@google+ Google+

infineon@linkedin linkedin

infineon4engi@twitter twitter

infineon@youtube youtube

+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 18 of 18

Thread: XMC4500 VADC - DMA usage

  1. #11
    Tmt
    Guest
    Where do you place the function void DMA_End_Transfer(DMA_IRQType DMA_IRQ_TFR, uint32_t cb_arg) ? What did you do in your main program to let it work?

    When I try to build the project I get the following error:

    Dave/Generated/src/DMA003/DMA003_Conf.o.data+0x2c): undefined reference to `DMA_End_Transfer'
    collect2.exe: error: ld returned 1 exit status
    make: *** [ADC_DMA_TRY.elf] Error 1


    Thanks in advice
    Last edited by Tmt; Mar 18th, 2015 at 02:44 AM.

  2. #12
    Tmt
    Guest
    Nevermind about this error. I managed to solve this error. But now it seems that I have a problem in my program when I'm debugging.

    It seems like I don't get an interrupt from the ADC001.

    This is my main program:
    #include <DAVE3.h> //Declarations from DAVE3 Code Generation (includes SFR declaration)

    ADC001_ResultHandleType Result;

    void DMA_End_Transfer(DMA_IRQType DMA_IRQ_TFR, uint32_t cb_arg)
    {

    // DMA003_Init();

    const DMA003_ChannelHandleType* Handle;
    Handle = &DMA003_Handle0;
    GPDMA0_GLOBAL_TypeDef* DMARegs = Handle->DMARegs;
    GPDMA0_CH_TypeDef* DMAChRegs = Handle->DMAChRegs;
    uint8_t Channel = Handle->ChannelID;
    uint32_t DMA = (uint32_t)(1UL << Channel);

    /* Reload Src. & Dest. & LLP registers */
    DMAChRegs->SAR = (uint32_t) Handle->ChConfig.SrcAddress; //Not changed by DMA
    DMAChRegs->DAR = (uint32_t) Handle->ChConfig.DstAddress; //Changed after DMA block transfer
    DMAChRegs->LLP = (uint32_t) 0x00000000; //for multi-block chaining

    /* Clear DMA flags */
    DMARegs->CLEARTFR = DMA;
    DMARegs->CLEARBLOCK = DMA; //Not changed in my config
    DMARegs->CLEARSRCTRAN = DMA; //Not changed in my config
    DMARegs->CLEARDSTTRAN = DMA; //Not changed in my config
    DMARegs->CLEARERR = DMA; //Not changed in my config

    /* Finally Enable CHENREG */
    DMARegs->CHENREG = DMA_CH_NUM(Channel);

    }


    int main(void)
    {
    // status_t status; // Declaration of return variable for DAVE3 APIs (toggle comment if required)


    DAVE_Init(); // Initialization of DAVE Apps

    //DMA003_StartTransfer(&DMA003_Handle0);

    /* Generate Load Event*/
    ADC001_GenerateLoadEvent(&ADC001_Handle0);
    DMA003_StartTransfer(&DMA003_Handle0);

    while(1)
    {

    }

    return 0;
    }

    void GlobalResultEvent(void)
    {
    /* Read the Result Register*/
    ADC001_GetResult(&ADC001_Handle0,&Result);

    }


    Any help is welcome. My goal is trying to get an ADC working who reads in 16 different values (for multiple times), sends the result to the DMA and than calculate the average of every value that was read in multiple times
    ?????? ?????? result.PNG‎  
    ?????

  3. #13
    Travis will become famous soon enough
    Join Date
    Feb 2013
    Location
    Singapore
    Posts
    749
    Points
    4580
    I just make a quick review of your software. I think your did not declare the interrupt handler in the NVIC app.


    Click image for larger version

Name:	ADC_DMA Try.JPG
Views:	16
Size:	125.4 KB
ID:	1451

  4. #14
    New Member New Member Dan Griffing is on a distinguished road
    Join Date
    Jun 2014
    Location
    Belgrade, MT
    Posts
    4
    Points
    27.34375
    Hi Travis,

    I'm developing a handheld instrument with DAVE3 based on the XMC4500 relax board. This instrument has an USB, SDCard, and Seggar-driven GUI display and interfaces with an analog board using the Relax pin headers. The most important part is a high-speed analog input that collects 2us samples from P14.0 using ADC002, DMA002 and 2us analog triggering using PWMSP001 and NVIC002 apps.

    I recently downloaded the "xmc4500_DMA002.zip" example from this forum and got it working to prove the technique works. But when I attempted to implement this technique from scratch in a small firmware application using the current versions for each of the Dave3 Apps, everything appears to work, except that only zeros come across in the raw and processed ADC result arrays.

    Do you have any advice in getting the DMA002 data coming in from ADC002?

    Thanks,

    Dan Griffing

  5. #15
    Travis will become famous soon enough
    Join Date
    Feb 2013
    Location
    Singapore
    Posts
    749
    Points
    4580
    Quote Originally Posted by Dan Griffing View Post
    But when I attempted to implement this technique from scratch in a small firmware application using the current versions for each of the Dave3 Apps, everything appears to work, except that only zeros come across in the raw and processed ADC result arrays.

    Do you have any advice in getting the DMA002 data coming in from ADC002?

    Thanks,

    Dan Griffing
    Do you mean that you are reading zeros? If that is the case you have to check your assigned result register for the ADC and be sure that you had DMA from the correct Source address.

    However DMA is meant for mass data transfer and it might not make sense for you just to transfer only a word (32bit) data to the destination. It would be better that you make use of the ADC result interrupt.

  6. #16
    Johannes is on a distinguished road
    Join Date
    Jun 2014
    Posts
    5
    Points
    58.75
    Hi Travis,
    I will also use the DMA to transfer very fast ADC-Channel-Results. Therefore I used the example xmc4500_DMA002.zip. from this forum:

    https://www.infineonforums.com/thread...tion-of-DMA002


    I had the same problem which Dan Griffing wrote above.

    “I recently downloaded the "xmc4500_DMA002.zip" example from this forum and got it working to prove the technique works. But when I attempted to implement this technique from scratch in a small firmware application using the current versions for each of the Dave3 Apps, everything appears to work, except that only zeros come across in the raw and processed ADC result arrays.”

    I checked the ADC result register. The ADC result register is not zero but the DMA-Buffer-Value is zero?
    @ Travis: Can you update the xmc4500_DMA002.zip example with the current versions of the Dave3-Apps?

    Thanks,

    Johannes

  7. #17
    Johannes is on a distinguished road
    Join Date
    Jun 2014
    Posts
    5
    Points
    58.75
    Hi Travis,
    I will also use the DMA to transfer very fast ADC-Channel-Results. Therefore I used the example xmc4500_DMA002.zip. from this forum:
    https://www.infineonforums.com/thread...tion-of-DMA002
    I had the same problem which Dan Griffing wrote above.
    “I recently downloaded the "xmc4500_DMA002.zip" example from this forum and got it working to prove the technique works. But when I attempted to implement this technique from scratch in a small firmware application using the current versions for each of the Dave3 Apps, everything appears to work, except that only zeros come across in the raw and processed ADC result arrays.”

    I checked the ADC-Result-Register. The ADC-Value is not zero but the DMA-Buffer-Value is zero?
    @ Travis: Can you update the xmc4500_DMA002.zip example with the current versions of the Dave3-Apps?

    Thanks,
    Johannes

  8. #18
    Johannes is on a distinguished road
    Join Date
    Jun 2014
    Posts
    5
    Points
    58.75
    Hi Travis,
    I will also use the DMA to transfer very fast ADC-Channel-Results. Therefore I used the example xmc4500_DMA002.zip. from this forum:
    https://www.infineonforums.com/thread...tion-of-DMA002

    I had the same problem which Dan Griffing wrote above.
    “I recently downloaded the "xmc4500_DMA002.zip" example from this forum and got it working to prove the technique works. But when I attempted to implement this technique from scratch in a small firmware application using the current versions for each of the Dave3 Apps, everything appears to work, except that only zeros come across in the raw and processed ADC result arrays.”

    I checked the ADC-Result-Register. The ADC-Value is not zero but the DMA-Buffer-Value is zero?
    @ Travis: Can you please update the xmc4500_DMA002.zip example with the current versions of the Dave3-Apps?

    Thanks,

    Johannes

+ Reply to Thread

Tags for this Thread

Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.